rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.read(*args, **kwargs)
if len(args) + len(kwargs) > 0: self.read(*args, **kwargs)
def __init__(self, *args, **kwargs): ''' Create a table set instance
s += PrettyStrings.formatDatum("compute element", str(job.backend.actualCE))
try: s += PrettyStrings.formatDatum("compute element", str(job.backend.actualCE)) except: pass
def getStatus(self): """ This method prints basic information about the running job, like its job-id and the worker node the job is running on. """ if self.__checkStatus(): s = PrettyStrings.makeHeader("current job status") job = self.getJobObject()
if j.backend.__class__.__name__ == 'Panda' and j.backend.url is not None: j.info.monitoring_links = [(task_mon_link,'dashboard'), (j.backend.url, 'panda')]
if j.backend.__class__.__name__ == 'Panda' and len(j.backend.buildjobs) > 0 and j.backend.buildjobs[0].url is not None: j.info.monitoring_links = [(task_mon_link,'dashboard'), (j.backend.buildjobs[0].url, 'panda')]
def submit(self, **opts): """Log submit event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'submit %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log('debug', 'Not sending unwanted message on submit for master wrapper job %s.' % j.fqid) return # send G...
raise ApplicationConfigurationError(None,"job.outputdata.outputdata must be empty if atlas_exetype='ATHENA' (outputs are auto-detected)")
raise ApplicationConfigurationError(None,"job.outputdata.outputdata must be empty if atlas_exetype='ATHENA' and Panda backend is used (outputs are auto-detected)")
def master_prepare(self,app,appconfig): '''Prepare the master job'''
raise ApplicationConfigurationError(None,"job.outputdata.outputdata is required for atlas_exetype in ['PYARA','ARES','TRF','ROOT']")
raise ApplicationConfigurationError(None,"job.outputdata.outputdata is required for atlas_exetype in ['PYARA','ARES','TRF','ROOT'] and Panda backend")
def master_prepare(self,app,appconfig): '''Prepare the master job'''
logger.warning('Job %s has disappeared from the batch system.', str(j.id))
logger.warning('Job %s has disappeared from the batch system.', str(j.getFQID('.')))
def get_status(f): """Give (pid,queue,actualCE,exit code) for job"""
print report
def fill_report(uuid = None, eventVersion = None, remoteSite=None, localSite=None, timeStart=None, catStart=None, relativeStart=None, transferStart=None, validateStart=None, timeEnd=None, duid=None,version=None, dataset=None, protocol=None, filename=None, filesize=None, guid=None, usr=None, hostname=None, ip=None, susp...
raise RegistryKeyError('Job id=%d not found'%id)
if self.name == 'templates': raise RegistryKeyError('Template %d not found'%id) else: raise RegistryKeyError('Job %d not found'%id)
def __call__(self,id): """ Retrieve a job by id. """ t = type(id) if t is int: try: return self.objects[id] except KeyError: raise RegistryKeyError('Job id=%d not found'%id) elif t is tuple: ids = id elif t is str: ids = id.split(".") else: raise RegistryAccessError('Expected a job id: int, (int,int), or "int.int"')
raise RegistryKeyError('Job %d not found'%ids[0])
if self.name == 'templates': raise RegistryKeyError('Template %d not found'%ids[0]) else: raise RegistryKeyError('Job %d not found'%ids[0])
def __call__(self,id): """ Retrieve a job by id. """ t = type(id) if t is int: try: return self.objects[id] except KeyError: raise RegistryKeyError('Job id=%d not found'%id) elif t is tuple: ids = id elif t is str: ids = id.split(".") else: raise RegistryAccessError('Expected a job id: int, (int,int), or "int.int"')
logger.info('Compressing to %s ...', archiveFullName )
def prepare(self, **options): """Extract Athena job configuration and prepare job for submission"""
archiveName, archiveFullName = AthenaUtils.archiveSourceFiles(self.userarea, runDir, currentDir, tmpDir, verbose, self.glue_packages)
archiveName, archiveFullName = AthenaUtils.archiveSourceFiles(self.userarea, runDir, currentDir, archiveDir, verbose, self.glue_packages)
def prepare(self, **options): """Extract Athena job configuration and prepare job for submission"""
AthenaUtils.archiveInstallArea(self.userarea, self.grouparea, archiveName, archiveFullName, tmpDir, nobuild, verbose)
AthenaUtils.archiveInstallArea(self.userarea, self.grouparea, archiveName, archiveFullName, archiveDir, nobuild, verbose)
def prepare(self, **options): """Extract Athena job configuration and prepare job for submission"""
out = commands.getoutput('pushd . && cd %s && tar -f %s -rh %s && popd' % (tmpDir, archiveFullName, filename))
out = commands.getoutput('pushd . && cd %s && tar -f %s -rh %s && popd' % (archiveDir, archiveFullName, filename))
def prepare(self, **options): """Extract Athena job configuration and prepare job for submission"""
self.atlas_environment=['DBRELEASE_OVERRIDE=%s'%dbvers]
self.atlas_environment+=['DBRELEASE_OVERRIDE=%s'%dbvers]
def master_configure(self):
if not cmtconfig in [ 'i686-slc4-gcc34-opt', 'i686-slc5-gcc43-opt' ]
if not cmtconfig in [ 'i686-slc4-gcc34-opt', 'i686-slc5-gcc43-opt' ]:
def master_prepare( self, app, appconfig): """Prepare the master job"""
c = StandardJobConfig(app.exe,app._getParent().inputsandbox,app.args,app._getParent().outputsandbox,app.env)
c = StandardJobConfig(app.exe,app._getParent().inputsandbox,convertIntToStringArgs(app.args),app._getParent().outputsandbox,app.env)
def prepare(self,app,appconfig,appmasterconfig,jobmasterconfig): from Ganga.GPIDev.Adapters.StandardJobConfig import StandardJobConfig
return LCGJobConfig(app.exe,app._getParent().inputsandbox,app.args,app._getParent().outputsandbox,app.env)
return LCGJobConfig(app.exe,app._getParent().inputsandbox,convertIntToStringArgs(app.args),app._getParent().outputsandbox,app.env)
def prepare(self,app,appconfig,appmasterconfig,jobmasterconfig): from Ganga.Lib.LCG import LCGJobConfig
return gLiteJobConfig(app.exe,app._getParent().inputsandbox,app.args,app._getParent().outputsandbox,app.env)
return gLiteJobConfig(app.exe,app._getParent().inputsandbox,convertIntToStringArgs(app.args),app._getParent().outputsandbox,app.env)
def prepare(self,app,appconfig,appmasterconfig,jobmasterconfig): from Ganga.Lib.gLite import gLiteJobConfig
if cmtconfig != 'i686-slc4-gcc34-opt':
if not cmtconfig in [ 'i686-slc4-gcc34-opt', 'i686-slc5-gcc43-opt' ]
def master_prepare( self, app, appconfig): """Prepare the master job"""
if app.options: self.job_options += ' %s ' % app.options
def master_prepare(self,app,appconfig): '''Prepare the master job'''
uploadFileServer= "http://127.0.0.1:8000/errorreports"
uploadFileServer= "http://gangamon.cern.ch/django/errorreports/"
def report_inner(job=None): userInfoDirName = "userreport" tempDirName = "reportsRepository" #job relevant info inputDirName = "inputdir" outputDirName = "outputdir" jobSummaryFileName = "jobsummary.txt" jobFullPrintFileName = "jobfullprint.txt" #non job relevant info - user's info environFileName = "environ.txt" user...
else: break
def split(self,job):
athena_options = ' '.join([os.path.basename(opt_file.name) for opt_file in app.option_file])2
athena_options = ' '.join([os.path.basename(opt_file.name) for opt_file in app.option_file])
def master_prepare( self, app, appconfig): """Prepare the master job"""
mydelid = self.credential.identity()
mydelid = '%s_%s' % (self.credential.identity(), get_uuid())
def cream_proxy_delegation(self, ce): '''CREAM CE proxy delegation'''
infos = [] for odat in j.outputdata.outputdata: info = [f for f in j.outputdata.output if odat in f][0].split(",") info[0] = datasetname infos.append(",".join(info)) outputdata.register_datasets_details(None, infos)
try: infos = [] for odat in j.outputdata.outputdata: info = [f for f in j.outputdata.output if odat in f][0].split(",") info[0] = datasetname infos.append(",".join(info)) outputdata.register_datasets_details(None, infos) except DQFileExistsInDatasetException: pass
def checkCompletedApp(self, app): j = app._getParent() for odat in j.outputdata.outputdata: if 0==len([f for f in j.outputdata.output if ".".join(odat.split(".")[:-1]) in f]): logger.error("Job %s has not produced %s file, only: %s" % (j.id, odat, j.outputdata.output)) return False # if this is the first app to complet...
m=md5.new() m.update(usrDN)
md.update(usrDN)
def fill_report(uuid = None, eventVersion = None, remoteSite=None, localSite=None, timeStart=None, catStart=None, relativeStart=None, transferStart=None, validateStart=None, timeEnd=None, duid=None,version=None, dataset=None, protocol=None, filename=None, filesize=None, guid=None, usr=None, hostname=None, ip=None, susp...
jspec.destinationSE = job.backend.site
if Client.isDQ2free(job.backend.site): jspec.destinationSE = 'local' else: jspec.destinationSE = job.backend.site
def master_prepare(self,app,appconfig): '''Prepare the master job'''
jspec.destinationSE = site
if Client.isDQ2free(job.backend.site): jspec.destinationSE = 'local' else: jspec.destinationSE = site
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
def cmd(self,cmd,soutfile=None,allowed_exit=[0], capture_stderr=False,timeout=None):
def cmd(self,cmd,soutfile=None,allowed_exit=[0], capture_stderr=False,timeout=None, mention_outputfile_on_errors=True):
def cmd(self,cmd,soutfile=None,allowed_exit=[0], capture_stderr=False,timeout=None): "Execute an OS command and captures the stderr and stdout which are returned in a file"
logger.warning('full output is in file: %s',soutfile)
if mention_outputfile_on_errors: logger.warning('full output is in file: %s',soutfile)
def cmd(self,cmd,soutfile=None,allowed_exit=[0], capture_stderr=False,timeout=None): "Execute an OS command and captures the stderr and stdout which are returned in a file"
rc,outfile,m = self.cmd(cmd,None,allowed_exit,capture_stderr,timeout)
rc,outfile,m = self.cmd(cmd,None,allowed_exit,capture_stderr,timeout,mention_outputfile_on_errors=False)
def cmd1(self,cmd,allowed_exit=[0],capture_stderr=False,timeout=None): "Executes an OS command and captures the stderr and stdout which are returned as a string" rc,outfile,m = self.cmd(cmd,None,allowed_exit,capture_stderr,timeout) output=file(outfile).read() os.unlink(outfile) return rc,output, m
logger.warning("Filling provenance info for dataset %s...", d )
logger.info("Filling provenance info for dataset %s...", d )
def fill_provenance(self,extraargs = []):
logger.warning("Good Run List '%s' file selected" % self.goodRunListXML.name)
logger.info("Good Run List '%s' file selected" % self.goodRunListXML.name)
def search(self, pattern='', maxresults = config['MaxNumOfDatasets'], extraargs = []): argument=[] dsetList = [] if self.goodRunListXML.name != '':
raise TypeError("keep_going must be a boolean. Probably you wanted to do %s(%s).%s()" % (keep_going,self.name,keep_going,method))
raise GangaException("The variable 'keep_going' must be a boolean. Probably you wanted to do %s(%s).%s()" % (self.name,keep_going,method))
def do_collective_operation(self,keep_going,method,*args,**kwds): """ """ if not type(keep_going) is bool: raise TypeError("keep_going must be a boolean. Probably you wanted to do %s(%s).%s()" % (keep_going,self.name,keep_going,method)) result = [] for id,obj in self.objects.iteritems(): try: if type(method) is str: do...
spacetokens.append(queueToAllowedSites(s))
spacetokens.append(convertQueueNameToDQ2Names(s))
def list_sites(self): from pandatools import Client refreshPandaSpecs()
tokens = queueToAllowedSites(s)
tokens = convertQueueNameToDQ2Names(s)
def list_ddm_sites(self,allowTape=False): from pandatools import Client refreshPandaSpecs()
tokens = queueToAllowedSites(self.site)
tokens = convertQueueNameToDQ2Names(self.site)
def list_ddm_sites(self,allowTape=False): from pandatools import Client refreshPandaSpecs()
if 'ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET' in config and config['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']: nickname = getNickname(allowMissingNickname=True) else: nickname = getNickname(allowMissingNickname=False) if nickname and 'USE_NICKNAME_DQ2OUTPUTDATASET' in config and config['USE_NICKNAME_DQ2OUTPUTDATASET']:...
def __init__(self): super( AthenaMCInputDatasets, self ).__init__() # Extract username from certificate proxy = GridProxy() username = proxy.identity()
assert _usertag and _usertag!="users"
assert _usertag
def get_dataset(self, app,backend): '''seek dataset informations and returns (hopefully) a formatted set of information for all processing jobs (turls, catalog servers, dataset location for each lfn). Called by master_submit'''
assert _usertag and _usertag!="users"
assert _usertag
def prep_data(self,app): ''' generate output paths and file prefixes based on app and outputdata information. Generate corresponding entries in DQ2. ''' fileprefixes,outputpaths=self.outrootfiles.copy(),{} # first of all, check that _usertag is set properly: try: assert _usertag and _usertag!="users" except: logger.err...
assert _usertag and _usertag!="users"
assert _usertag
def getDQ2Locations(self,se_name): ''' Provides the triplet: LFC, site and srm path from input se''' lfcstrings=getLFCmap() outputlocation={} default_site="CERN-PROD_SCRATCHDISK" job=self._getParent() app=job.application # first of all, check that _usertag is set properly: try: assert _usertag and _usertag!="users" ex...
def runMonitoring( self, steps=1, timeout=60 ):
def runMonitoring( self, steps=1, timeout=60, jobs=None ):
def runMonitoring( self, steps=1, timeout=60 ): """ Enable/Run the monitoring loop and wait for the monitoring steps completion. Parameters: steps: number of monitoring steps to run timeout: how long to wait for monitor steps termination (seconds) Return: False, if the loop cannot be started or the timeout occured wh...
try: statusfile=file(statusfilename,'w') except IOError,x: print 'ERROR: not able to write a status file: ', statusfilename print 'ERROR: ',x raise
heartbeatfilename = os.path.join(sharedoutputpath,'__heartbeat__') statusfile=open_file(statusfilename) heartbeatfile=open_file(heartbeatfilename)
def flush_file(f): f.flush() os.fsync(f.fileno()) #this forces a global flush (cache synchronization on AFS)
os.utime(statusfilename,None)
heartbeatfile.write('.') flush_file(heartbeatfile)
def flush_file(f): f.flush() os.fsync(f.fileno()) #this forces a global flush (cache synchronization on AFS)
time = get_last_alive(statusfile)
time = get_last_alive(heartbeatfile)
def get_status(f): """Give (pid,queue,exit code) for job"""
config.addOption('timeout',300,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
config.addOption('timeout',600,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
def filefilter(fn): # FILTER OUT Batch INTERNAL INPUT/OUTPUT FILES: # 10 digits . any number of digits . err or out import re internals = re.compile(r'\d{10}\.\d+.(out|err)') return internals.match(fn) or fn == '.Batch.start'
config.addOption('timeout',300,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
config.addOption('timeout',600,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
def __init__(self): super(LSF,self).__init__()
config.addOption('timeout',300,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
config.addOption('timeout',600,'Timeout in seconds after which a job is declared killed if it has not touched its heartbeat file. Heartbeat is touched every 30s so do not set this below 120 or so.')
def __init__(self): super(PBS,self).__init__()
self.status_colours = { 'new' : fx.normal, 'submitted' : fg.orange, 'running' : fg.green, 'completed' : fg.blue, 'failed' : fg.red }
try: status_colours = config['jobs_status_colours'] self.status_colours = dict( [ (k, eval(v)) for k,v in status_colours.iteritems() ] ) except Exception,x: logger.warning('configuration problem with colour specification: "%s"', str(x)) status_colours = config.options['jobs_status_colours'].default_value self.status_co...
def __init__(self,name): super(JobRegistrySlice,self).__init__(name,display_prefix="jobs") from Ganga.Utility.ColourText import Foreground, Background, Effects fg = Foreground() fx = Effects() bg = Background() self.status_colours = { 'new' : fx.normal, 'submitted' : fg.orange, 'running' : fg.green, 'complet...
if 'ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET' in config and config['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']:
if 'ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET' in configDQ2 and configDQ2['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']:
def __init__(self): super( AthenaMCInputDatasets, self ).__init__() # Extract username from certificate proxy = GridProxy() username = proxy.identity() if 'ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET' in config and config['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']: nickname = getNickname(allowMissingNickname=True) else: ni...
if nickname and 'USE_NICKNAME_DQ2OUTPUTDATASET' in config and config['USE_NICKNAME_DQ2OUTPUTDATASET']:
if nickname and 'USE_NICKNAME_DQ2OUTPUTDATASET' in configDQ2 and configDQ2['USE_NICKNAME_DQ2OUTPUTDATASET']:
def __init__(self): super( AthenaMCInputDatasets, self ).__init__() # Extract username from certificate proxy = GridProxy() username = proxy.identity() if 'ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET' in config and config['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']: nickname = getNickname(allowMissingNickname=True) else: ni...
datasets = resolve_container(self.dataset)
datasets = resolve_container([self.datasetname])
def check_content_consistency(self, numsubjobs, **options ): """Check outputdataset consistency""" # Resolve container into datasets datasets = resolve_container(self.dataset)
numrequestedoutputfiles = len(self.outputdata.outputdata)*numsubjobs
numrequestedoutputfiles = len(self.outputdata)*numsubjobs
def check_content_consistency(self, numsubjobs, **options ): """Check outputdataset consistency""" # Resolve container into datasets datasets = resolve_container(self.dataset)
logger.warning('Number of output files %s in outputdataset %s is not consistent with number of subjobs and requested outputfiles %s - Please carefully check output !', numoutputfiles, dataset, numrequestedoutputfiles)
logger.warning('%s output files in outputdataset %s is not consistent with %s subjobs and %s requested outputfiles - Please carefully check output !', numoutputfiles, dataset,numsubjobs, numrequestedoutputfiles)
def check_content_consistency(self, numsubjobs, **options ): """Check outputdataset consistency""" # Resolve container into datasets datasets = resolve_container(self.dataset)
numrequestedoutputfiles = len(self.outputdata.outputdata) if not numrequestedoutputfiles == numoutputfiles: logger.warning('Number of output files %s in outputdataset %s is not consistent with number of subjobs and requested outputfiles %s - Please carefully check output !', numoutputfiles, dataset, numrequestedoutputf...
for outputinfo in self.output: filename = outputinfo.split(',')[1] if not filename in contents_files: logger.warning('output file %s is not in outputdataset %s - Please carefully check output !', filename, dataset)
def check_content_consistency(self, numsubjobs, **options ): """Check outputdataset consistency""" # Resolve container into datasets datasets = resolve_container(self.dataset)
def wn_dest_ce():
def wn_dest_ce(ji):
def cl_unique_job_id(job): """Build unique_job_id. Only run on client.""" return job.info.uuid
dest_ce = CommonUtil.env('GLOBUS_CE') if not dest_ce: dest_ce = CommonUtil.stdout('edg-brokerinfo getCE') if not dest_ce: dest_ce = CommonUtil.stdout('glite-brokerinfo getCE') return CommonUtil.strip_to_none(dest_ce)
return '%s_localbatch_%s' % (ji['GANGA_HOSTNAME'], ji['Batch'])
def wn_dest_ce(): """Build dest_ce. Only run on worker node.""" dest_ce = CommonUtil.env('GLOBUS_CE') if not dest_ce: dest_ce = CommonUtil.stdout('edg-brokerinfo getCE') if not dest_ce: dest_ce = CommonUtil.stdout('glite-brokerinfo getCE') return CommonUtil.strip_to_none(dest_ce)
def wn_dest_site():
def wn_dest_site(ji):
def wn_dest_site(): """Build dest_site. Only run on worker node.""" return CommonUtil.env('SITE_NAME')
return CommonUtil.env('SITE_NAME')
return ji['GANGA_HOSTNAME']
def wn_dest_site(): """Build dest_site. Only run on worker node.""" return CommonUtil.env('SITE_NAME')
supports_keep_going = 'keep_going' in inspect.getargspec(self.backend.master_submit).args
supports_keep_going = 'keep_going' in inspect.getargspec(self.backend.master_submit)[0]
def submit(self,keep_going=None,keep_on_fail=None): '''Submits a job. Return true on success.
supports_master_resubmit = len(inspect.getargspec(self.backend.master_resubmit).args)>1
supports_master_resubmit = len(inspect.getargspec(self.backend.master_resubmit)[0])>1
def resubmit(self,backend=None): """Resubmit a failed or completed job. A backend object may be specified to change some submission parameters (which parameters may be effectively changed depends on a particular backend implementation).
new_file_handler = handlers.RotatingFileHandler(logfile,maxBytes=logfile_size)
new_file_handler = handlers.RotatingFileHandler(logfile,maxBytes=logfile_size,backupCount=1)
def _make_file_handler(logfile,logfile_size): import traceback import os.path logfile = os.path.expanduser(logfile) global file_handler if logfile: try: new_file_handler = handlers.RotatingFileHandler(logfile,maxBytes=logfile_size) except IOError,x: private_logger.error('Cannot open the log file: %s',str(x)) return # r...
cmd += ' -e %s' % ce
cmd += ' -e %s' % ce.split('/cream')[0]
def cream_proxy_delegation(self, ce): '''CREAM CE proxy delegation'''
for f in input_sandbox: getPackedInputSandbox(f)
def preparejob(self,jobconfig,master_input_sandbox):
if app.max_events > 0:
if app.atlas_exetype == 'ATHENA' and app.max_events > 0:
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
if not orig_numfiles>0:
if not orig_numsubjobs>0 and not orig_numfiles>0:
def split(self,job):
if job.backend._name == 'LCG':
if job.backend._name in [ 'LCG' ]:
def retrieve(self, type=None, name=None, **options ): """Retrieve files listed in outputdata and registered in output from remote SE to local filesystem in background thread""" from Ganga.GPIDev.Lib.Job import Job from GangaAtlas.Lib.ATLASDataset import Download import os, threading
if (job.outputdata.outputdata and job.backend._name == 'LCG' and job.outputdata.output) or (job.backend._name == 'Panda' and job.outputdata.output):
if (job.outputdata.outputdata and job.backend._name in [ 'LCG', 'CREAM'] and job.outputdata.output) or (job.backend._name == 'Panda' and job.outputdata.output):
def retrieve(self, type=None, name=None, **options ): """Retrieve files listed in outputdata and registered in output from remote SE to local filesystem in background thread""" from Ganga.GPIDev.Lib.Job import Job from GangaAtlas.Lib.ATLASDataset import Download import os, threading
break
def split(self,job):
sites = [site for site in complete_sites[cloud] if site in allowed_sites[backend]]
if backend == "Panda": sites = [site for site in complete_sites[cloud] if Client.convertDQ2toPandaID(site) in allowed_sites["Panda"]] else: sites = [site for site in complete_sites[cloud] if site in allowed_sites[backend]]
def findCompleteCloudBackend(self,db_sites,allowed_sites,replicas): # Sort complete replicas into clouds # returns sorted list of tuples (cloud, backend) clouds = config["cloudPreference"] + TiersOfATLAS.ToACache.dbcloud.keys() complete_sites = {} for c in clouds: complete_sites[c] = [] for s in replicas[1]: try: cloud...
sites = [site for site in incomplete_sites[cloud] if site in allowed_sites[backend]]
if backend == "Panda": sites = [site for site in incomplete_sites[cloud] if Client.convertDQ2toPandaID(site) in allowed_sites["Panda"]] else: sites = [site for site in incomplete_sites[cloud] if site in allowed_sites[backend]]
def findIncompleteCloudBackend(self,db_sites,allowed_sites,replicas): # If no cloud/backend combination is found for complete replicas, # find cloud/backend with maximal number of replicas # returns list of tuples sorted by number of sites with replicas: (cloud, backend) clouds = config["cloudPreference"] + TiersOfATLA...
allowed_sites["Panda"] = [site["ddm"] for site in Client.getSiteSpecs()[1].values()]
allowed_sites["Panda"] = Client.PandaSites.keys()
def check(self): super(AnaTransform,self).check() if not self.inputdata.dataset: return if not self.backend: logger.warning("Determining backend and cloud...")
dest_ce = CommonUtil.env('GLOBUS_CE') if not dest_ce: dest_ce = CommonUtil.stdout('edg-brokerinfo getCE') if not dest_ce: dest_ce = CommonUtil.stdout('glite-brokerinfo getCE')
dest_ce = CommonUtil.env('CE_ID')
def wn_dest_ce(): """Build dest_ce. Only run on worker node.""" dest_ce = CommonUtil.env('GLOBUS_CE') if not dest_ce: dest_ce = CommonUtil.stdout('edg-brokerinfo getCE') if not dest_ce: dest_ce = CommonUtil.stdout('glite-brokerinfo getCE') return CommonUtil.strip_to_none(dest_ce)
logger.warning('The job %d has reached unexpected the Cleared state and Ganga cannot retrieve the output.',job.id)
logger.warning('The job %d has reached unexpected the Cleared state and Ganga cannot retrieve the output.',job.getFQID('.'))
def updateGangaJobStatus(job,status): '''map backend job status to Ganga job status'''
print param
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
mo = self.__job.info.monitor
def complete(self, cause): if not JEMloader.INITIALIZED: logger.debug("Job Execution Monitor is disabled or failed to initialize") return
elif not self.__job.info.monitor or self.__job.info.monitor.__class__.__name__ != "JobExecutionMonitor":
elif not isinstance(mo, JobExecutionMonitor.JobExecutionMonitor): return elif mo.enabled == False:
def complete(self, cause): if not JEMloader.INITIALIZED: logger.debug("Job Execution Monitor is disabled or failed to initialize") return
if job.inputdata.pfnListFile:
if job.inputdata.pfnListFile.name:
def split(self,job): from Ganga.GPIDev.Lib.Job import Job subjobs = [] logger.debug("ATLASTier3Splitter split called") if not job.inputdata: raise ApplicationConfigurationError(None, "ATLASTier3Splitter requires ATLASTier3Dataset") if job.inputdata._name != 'ATLASTier3Dataset': raise ApplicationConfigurationError(None...
logger.debug("setting %s to '%s'" % (k, str(v)))
def getPath(executable): """ If the given file is found as-is (because the path is included), return None. Else, search the exe in $PATH, and return the path to it if found. """ if os.path.isfile(executable): return None else: paths = os.environ['PATH'].split(os.pathsep) for p in paths: f = os.path.join(p, executable) ...
fpaths = list_castor_files(dirs=self.dataset, pattern='.*\.root.*')
fpaths = list_castor_files(dirs=self.dataset, pattern='.*')
def get_surls(self, ddmSiteName=None, guidRefill=True): '''Gets a list of physical files located at certain site. Using DQ2_LOCAL_SITE_ID if site name is not specified explicitely.
fpaths = find(dirs=self.dataset, pattern='.*\.root.*')
fpaths = find(dirs=self.dataset, pattern='.*')
def get_surls(self, ddmSiteName=None, guidRefill=True): '''Gets a list of physical files located at certain site. Using DQ2_LOCAL_SITE_ID if site name is not specified explicitely.
list.append(sjs.time.timestamps[status])
if type(sjs.time.timestamps[status]) == datetime.datetime: list.append(sjs.time.timestamps[status]) else: logger.debug('Attempt to add a non datetime object in the timestamp, job=%d, subjob=%d',j.id,sjs.id)
def sjStatList_return(self, status): list = [] final = ['backend_final', 'final'] j = self.getJobObject() for sjs in j.subjobs: try: list.append(sjs.time.timestamps[status]) except KeyError: logger.debug("Status '%s' not found in timestamps of job %d.%d.", status, sjs.master.id, sjs.id) list.sort() try: if status in fi...
self.indivOutDsList = [tmpDSName]
self.indivOutDsList.append(tmpDSName)
def master_prepare(self,app,appconfig): '''Prepare the master job'''
AthenaUtils.convertConfToOutput(self.runConfig,jspec,outMap,job.backend.individualOutDS,self.extOutFile)
AthenaUtils.convertConfToOutput(self.runConfig,jspec,outMap,job.backend.individualOutDS,self.extOutFile,masterjob.outputdata.datasetname)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
subjobOutputLocation = Client.PandaSites[job.backend.site]['ddm']
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
if not f.dataset in self.indivOutDsList:
if not f.dataset in self.indivOutContList:
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
logger.info('Creating individualOutDS %s'%f.dataset) Client.addDataset(f.dataset,False,location=self.outDsLocation) dq2_set_dataset_lifetime(f.dataset, self.outDsLocation) self.indivOutDsList.append(f.dataset)
logger.info('Creating output container %s'%f.dataset) Client.createContainer(f.dataset,False) self.indivOutContList.append(f.dataset) except exceptions.SystemExit: raise BackendError('Panda','Exception in Client.createContainer %s: %s %s'%(f.dataset,sys.exc_info()[0],sys.exc_info()[1])) if not f.destinationDBlock in se...
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
splitter.update_siteindex = False
def check(self): super(AnaTransform,self).check() if not self.inputdata.dataset: return if not self.backend: logger.warning("Determining backend and cloud...")
self.partitions_sites = None
self.partitions_sites = [sj.backend.site for sj in sjl]
def check(self): super(AnaTransform,self).check() if not self.inputdata.dataset: return if not self.backend: logger.warning("Determining backend and cloud...")
j.backend.requirements.sites = self.partitions_sites[partitions[0]-1]
if stripProxy(j.backend)._name == "Panda": j.backend.site = self.partitions_sites[partitions[0]-1] else: j.backend.requirements.sites = self.partitions_sites[partitions[0]-1]
def getJobsForPartitions(self, partitions): j = self.createNewJob(partitions[0]) if len(partitions) >= 1: j.splitter = AnaTaskSplitterJob() j.splitter.subjobs = partitions j.inputdata = self.partitions_data[partitions[0]-1] if self.partitions_sites: j.backend.requirements.sites = self.partitions_sites[partitions[0]-1] ...
if job.inputdata.tag_info:
if self.inputdatatype == 'DQ2' and job.inputdata.tag_info:
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
print t_total, critical_thread_ids, non_critical_thread_ids
def should_wait_batch_cb(t_total, critical_thread_ids, non_critical_thread_ids): print t_total, critical_thread_ids, non_critical_thread_ids # if there are critical threads then wait or shutdown depending on configuration if critical_thread_ids: if t_total < config['forced_shutdown_timeout']: return True else: logger.w...
exec self.importDynamicUtil()
def _cl_task_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'APPLICATION': LCGAthenaUtil.cl_application(j), # e.g. ATHENA 'APPLICATIONVERSION': LCGAthenaUtil.cl_application_version(j), # e.g. 15.5.1 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset...
'OWNERDN': dynamic_util.cl_ownerdn(),
'OWNERDN': self.dynamic_util.cl_ownerdn(),
def _cl_task_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'APPLICATION': LCGAthenaUtil.cl_application(j), # e.g. ATHENA 'APPLICATIONVERSION': LCGAthenaUtil.cl_application_version(j), # e.g. 15.5.1 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset...
'TASKNAME': dynamic_util.cl_task_name(j),
'TASKNAME': self.dynamic_util.cl_task_name(j),
def _cl_task_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'APPLICATION': LCGAthenaUtil.cl_application(j), # e.g. ATHENA 'APPLICATIONVERSION': LCGAthenaUtil.cl_application_version(j), # e.g. 15.5.1 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset...
exec self.importDynamicUtil()
def _cl_job_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'GRIDJOBID': dynamic_util.cl_grid_job_id(j), # e.g. https://grid-lb0.desy.de:9000/moqY5njFGurEuoDkkJmtBA 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset(j), # e.g. fdr08_run2.0052283.phys...
'GRIDJOBID': dynamic_util.cl_grid_job_id(j),
'GRIDJOBID': self.dynamic_util.cl_grid_job_id(j),
def _cl_job_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'GRIDJOBID': dynamic_util.cl_grid_job_id(j), # e.g. https://grid-lb0.desy.de:9000/moqY5njFGurEuoDkkJmtBA 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset(j), # e.g. fdr08_run2.0052283.phys...
'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job_id_inside_the_task(j),
'JOB_ID_INSIDE_THE_TASK': self.dynamic_util.cl_job_id_inside_the_task(j),
def _cl_job_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'GRIDJOBID': dynamic_util.cl_grid_job_id(j), # e.g. https://grid-lb0.desy.de:9000/moqY5njFGurEuoDkkJmtBA 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset(j), # e.g. fdr08_run2.0052283.phys...
'TASKNAME': dynamic_util.cl_task_name(j), 'UNIQUEJOBID': dynamic_util.cl_unique_job_id(j),
'TASKNAME': self.dynamic_util.cl_task_name(j), 'UNIQUEJOBID': self.dynamic_util.cl_unique_job_id(j),
def _cl_job_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'GRIDJOBID': dynamic_util.cl_grid_job_id(j), # e.g. https://grid-lb0.desy.de:9000/moqY5njFGurEuoDkkJmtBA 'INPUTDATASET': LCGAthenaUtil.cl_input_dataset(j), # e.g. fdr08_run2.0052283.phys...
self.job_options += '-c %s ' % app.options
if app.options.startswith('-c'): self.job_options += ' %s ' % app.options else: self.job_options += ' -c %s ' % app.options
def master_prepare(self,app,appconfig): '''Prepare the master job'''