def isCredentialRequired(credObj): """ The logic to decide if a given invalid credential should trigger the deactivation of Ganga internal services. """ from Ganga.Runtime import Workspace_runtime from Ganga.Runtime import Repository_runtime if getName(credObj) == "AfsToken": return Workspace_runtime.requiresAfsToken() or Repository_runtime.requiresAfsToken() if getName(credObj) == "GridProxy": if Repository_runtime.requiresGridProxy() or Workspace_runtime.requiresGridProxy(): return True from Ganga.GPI import jobs, typename from Ganga.GPIDev.Base.Proxy import stripProxy for j in jobs: ji = stripProxy(j) if ji.status in ["submitted", "running", "completing"]: if getName(ji.backend) == "LCG": return True return False log.warning("Unknown credential object : %s" % credObj)
def isCredentialRequired(credObj): """ The logic to decide if a given invalid credential should trigger the deactivation of Ganga internal services. """ from Ganga.Runtime import Workspace_runtime from Ganga.Runtime import Repository_runtime if getName(credObj) == 'AfsToken': return Workspace_runtime.requiresAfsToken() or Repository_runtime.requiresAfsToken() if getName(credObj) == 'GridProxy': if Repository_runtime.requiresGridProxy() or Workspace_runtime.requiresGridProxy(): return True from Ganga.GPI import jobs, typename from Ganga.GPIDev.Base.Proxy import stripProxy for j in jobs: ji = stripProxy(j) if ji.status in ['submitted', 'running', 'completing']: if ji.getNodeIndexCache() is not None and 'display:backend' in ji.getNodeIndexCache().keys(): if ji.getNodeIndexCache()['display:backend'] == 'LCG': return True else: if getName(ji.backend) == 'LCG': return True return False log.warning("Unknown credential object : %s" % credObj)
def isCredentialRequired(credObj): """ The logic to decide if a given invalid credential should trigger the deactivation of Ganga internal services. """ from Ganga.Runtime import Workspace_runtime from Ganga.Runtime import Repository_runtime if getName(credObj) == 'AfsToken': return Workspace_runtime.requiresAfsToken() or Repository_runtime.requiresAfsToken() if getName(credObj) == 'GridProxy': from Ganga.Core.GangaRepository import getRegistryProxy from Ganga.Runtime.GPIFunctions import typename from Ganga.GPIDev.Base.Proxy import stripProxy from Ganga.GPIDev.Lib.Job.Job import lazyLoadJobBackend, lazyLoadJobStatus for j in getRegistryProxy('jobs'): ji = stripProxy(j) this_status = lazyLoadJobStatus(ji) if this_status in ['submitted', 'running', 'completing']: this_backend = lazyLoadJobBackend(ji) if getName(this_backend) == 'LCG': return True return False log.warning("Unknown credential object : %s" % credObj)
def isCredentialRequired(credObj): """ The logic to decide if a given invalid credential should trigger the deactivation of Ganga internal services. """ from Ganga.Runtime import Workspace_runtime from Ganga.Runtime import Repository_runtime if getName(credObj) == 'AfsToken': return Workspace_runtime.requiresAfsToken( ) or Repository_runtime.requiresAfsToken() if getName(credObj) == 'GridProxy': from Ganga.Core.GangaRepository import getRegistryProxy from Ganga.Runtime.GPIFunctions import typename from Ganga.GPIDev.Base.Proxy import stripProxy from Ganga.GPIDev.Lib.Job.Job import lazyLoadJobBackend, lazyLoadJobStatus for j in getRegistryProxy('jobs'): ji = stripProxy(j) this_status = lazyLoadJobStatus(ji) if this_status in ['submitted', 'running', 'completing']: this_backend = lazyLoadJobBackend(ji) if getName(this_backend) == 'LCG': return True return False log.warning("Unknown credential object : %s" % credObj)
def isCredentialRequired (credObj): """ The logic to decide if a given invalid credential should trigger the deactivation of Ganga internal services. """ from Ganga.Runtime import Workspace_runtime from Ganga.Runtime import Repository_runtime if credObj.__class__.__name__ == 'AfsToken': return Workspace_runtime.requiresAfsToken() or Repository_runtime.requiresAfsToken() if credObj.__class__.__name__ == 'GridProxy': if Repository_runtime.requiresGridProxy() or Workspace_runtime.requiresGridProxy(): return True from Ganga.GPI import jobs,typename return bool([j for j in jobs if typename(j.backend)=='LCG' and j.status in ['submitted','running','completing']]) log.warning("Unknown credential object : %s" % credObj)
# JobTree jobtree = GPIProxyObjectFactory(getRegistry("jobs").getJobTree()) exportToPublicInterface('jobtree', jobtree, 'Objects', 'Logical tree view of the jobs') exportToPublicInterface('TreeError', TreeError, 'Exceptions') # ------------------------------------------------------------------------------------ # ShareRef shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef()) exportToPublicInterface( 'shareref', shareref, 'Objects', 'Mechanism for tracking use of shared directory resources') # ------------------------------------------------------------------------------------ # bootstrap the workspace Workspace_runtime.bootstrap() # ------------------------------------------------------------------------------------ # export full_print exportToPublicInterface('full_print', full_print, 'Functions') # ------------------------------------------------------------------------------------ # bootstrap core modules interactive = False Ganga.Core.bootstrap(getattr(Ganga.GPI.jobs, implRef), interactive) Ganga.GPIDev.Lib.Config.bootstrap() # ------------------------------------------------------------------------------------ # run post bootstrap hooks for r in allRuntimes.values(): try:
# ------------------------------------------------------------------------------------ # JobTree jobtree = GPIProxyObjectFactory(getRegistry("jobs").getJobTree()) exportToPublicInterface( 'jobtree', jobtree, 'Objects', 'Logical tree view of the jobs') exportToPublicInterface('TreeError', TreeError, 'Exceptions') # ------------------------------------------------------------------------------------ # ShareRef shareref = GPIProxyObjectFactory(getRegistry("prep").getShareRef()) exportToPublicInterface('shareref', shareref, 'Objects', 'Mechanism for tracking use of shared directory resources') # ------------------------------------------------------------------------------------ # bootstrap the workspace Workspace_runtime.bootstrap() # ------------------------------------------------------------------------------------ # export full_print exportToPublicInterface('full_print', full_print, 'Functions') # ------------------------------------------------------------------------------------ # bootstrap core modules interactive = False Ganga.Core.bootstrap(getattr(Ganga.GPI.jobs, implRef), interactive) Ganga.GPIDev.Lib.Config.bootstrap() # ------------------------------------------------------------------------------------ # run post bootstrap hooks for r in allRuntimes.values(): try: