rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.logger.debug('ISB URI: %s' % isb)
logger.debug('ISB URI: %s' % isb)
def preparejob(self,jobconfig,master_job_sandbox): '''Prepare the JDL'''
def wn_dest_ce():
def wn_dest_ce(ji):
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) """ from Ganga.Utility.Config impor...
from Ganga.Utility.Config import getConfig batch = getConfig('Configuration')['Batch'] host = getConfig('System')['GANGA_HOSTNAME'] return '%s_local_%s' % (host, batch)
return '%s_localnode' % ji['GANGA_HOSTNAME']
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) """ from Ganga.Utility.Config impor...
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') from Ganga.Utility.Config import getConfig host = getConfig('System')['GANGA_HOSTNAME'] return host
from Ganga.Utility.Config import getConfig host = getConfig('System')['GANGA_HOSTNAME'] return host
return ji['GANGA_HOSTNAME']
def wn_dest_site(): """Build dest_site. Only run on worker node.""" #return CommonUtil.env('SITE_NAME') from Ganga.Utility.Config import getConfig host = getConfig('System')['GANGA_HOSTNAME'] return host
output_lfn = '%s/%s/ganga/%s/' % (usertag, username, output_datasetname)
if config['USE_NICKNAME_DQ2OUTPUTDATASET']: output_lfn = '%s/%s/%s/%s/' % (usertag, username, jobdate, output_datasetname) else: output_lfn = '%s/%s/ganga/%s/' % (usertag, username, output_datasetname)
def dq2outputdatasetname(datasetname, jobid, isGroupDS, groupname): jobdate = time.strftime('%Y%m%d') usertag = config['usertag'] # Get DN or nickname username = gridProxy.identity(safe=True) if config['ALLOW_MISSING_NICKNAME_DQ2OUTPUTDATASET']: nickname = getNickname(allowMissingNickname=True) else: nickname = getNi...
clouds = config["cloudPreference"] + TiersOfATLAS.ToACache.dbcloud.keys()
addclouds = TiersOfATLAS.ToACache.dbcloud.keys() random.shuffle(addclouds) clouds = config["cloudPreference"] + addclouds
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...
clouds = config["cloudPreference"] + TiersOfATLAS.ToACache.dbcloud.keys()
addclouds = TiersOfATLAS.ToACache.dbcloud.keys() random.shuffle(addclouds) clouds = config["cloudPreference"] + addclouds
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...
using_cloud = common_cbl[0][0] using_backend = common_cbl[0][1]
cb = common_cbl[0] using_cloud = cb[0] using_backend = cb[1]
def check(self): super(AnaTransform,self).check() if not self.inputdata.dataset: return if not self.backend: logger.warning("Determining backend and cloud...")
tf.backend = stripProxy(backend).clone()
if backend is None: tf.backend = None else: tf.backend = stripProxy(backend).clone()
def setBackend(self,backend): """Sets the backend on all transforms""" for tf in self.transforms: tf.backend = stripProxy(backend).clone()
allowed_force_states = { 'completed' : ['completing'],
allowed_force_states = { 'completed' : ['completing','failed'],
def fail(self,force=False): """Deprecated. Use force_status('failed') instead.""" raise JobError('fail() method is deprecated, use force_status("failed") instead.')
inputsandbox = 'inputsandbox.%s.tar' % commands.getoutput('uuidgen')
inputsandbox = 'sources.%s.tar' % commands.getoutput('uuidgen')
def master_prepare(self,app,appconfig): '''Prepare the master job'''
jspec.transformation = '%s/runGen-00-00-01' % Client.baseURLSUB
jspec.transformation = '%s/runGen-00-00-02' % Client.baseURLSUB
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
outfiles[f] = "outputbox%i.tar.gz" % tarnum
outfiles[f] = "outputbox%i.%s.%s.tar.gz" % (tarnum, job.getFQID('.'), time.strftime("%Y%m%d%H%M%S") )
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
outfiles[f] = f
outfiles[f] = "%s.%s.%s" %(f, job.getFQID('.'), time.strftime("%Y%m%d%H%M%S")) fout = FileSpec() fout.lfn = outfiles[f] fout.type = 'output' fout.dataset = job.outputdata.datasetname fout.destinationDBlock = job.outputdata.datasetname fout.destinationSE = job.backend.site jspec.addFile(fout)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
siteCount = siteCount + 1 print 'ERROR: file not saved to %s - using now %s ...' %(siteID, temp_locations[siteCount] ) count = 0
if siteCount<len(temp_locations): siteCount = siteCount + 1 count = 0 print 'ERROR: file not saved to %s - using now %s ...' %(siteID, temp_locations[siteCount] ) else: count = retry
def check_duplicates_in_dataset(datasetname, output_files): """Checks for duplicate output files in outputdataset""" try: dq2_lock.acquire() try: contents = dq2.listFilesInDataset(out_datasetname) except: print 'Problem retrieving content info dataset %s from DQ2! ' %datasetname return finally: dq2_lock.release() if ...
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\n/g\' > input.txt; python ' + self.job_options
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\\\n/g\' > input.txt; python ' + self.job_options
def master_prepare(self,app,appconfig): '''Prepare the master job'''
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\n/g\' > input.txt; athena.py ' + self.job_options
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\\\n/g\' > input.txt; athena.py ' + self.job_options
def master_prepare(self,app,appconfig): '''Prepare the master job'''
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\n/g\' > input.txt; root -b -q ' + self.job_options
self.job_options = '/bin/echo %IN | sed \'s/,/\\\\\\n/g\' > input.txt; root -b -q ' + self.job_options
def master_prepare(self,app,appconfig): '''Prepare the master job'''
A subset of jobs may be created by slicing (e.g. jobs[:-10] last ten jobs)
A subset of jobs may be created by slicing (e.g. jobs[-10:] last ten jobs)
def remove(self,keep_going,force): self.do_collective_operation(keep_going,'remove',force=force)
jobs[:-10] : get last 10 jobs.
jobs[-10:] : get last 10 jobs.
def __getslice__(self, i1,i2): """ Get a slice. Examples: jobs[2:] : get first two jobs, jobs[:-10] : get last 10 jobs. """ return _wrap(self._impl.__getslice__(i1,i2))
file.destinationDBlock=file.dataset
file.destinationDBlock = re.sub('_sub\d+$','',file.destinationDBlock)
def master_resubmit(self,jobs): '''Resubmit failed subjobs''' from pandatools import Client
raise ApplicationConfigurationError(None,"The workflow job.inputdata.type='FILE_STAGER' is not enabled for the %s backend." % job.backend._name )
if job.inputdata and job.inputdata._name in [ 'DQ2Dataset' ] and job.inputdata.type == 'FILE_STAGER': raise ApplicationConfigurationError(None,"The workflow job.inputdata.type='FILE_STAGER' is not enabled for the %s backend." % job.backend._name )
def master_configure(self):
return None
return ''
def cl_target(job): """Build target. Only run on client.""" if hasattr(job.backend, 'CE'): targets = [] if job.backend.CE: targets.append('CE_%s' % job.backend.CE) for site in job.backend.requirements.sites: if site: targets.append('SITE_%s' % site) targetcsv = ','.join(targets) return CommonUtil.strip_to_none(targetcs...
time.sleep(30)
def open_file(fname): try: filehandle=file(fname,'w') except IOError,x: print 'ERROR: not able to write a status file: ', fname print 'ERROR: ',x raise return filehandle
except IOError,x:
except OSError,x:
def get_last_alive(f): """Time since the statusfile was last touched in seconds""" import os.path,time talive = 0 try: talive = time.time()-os.path.getmtime(f) except IOError,x: logger.debug('Problem reading status file: %s (%s)',f,str(x)) return talive
exe_name = job.application.exe
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
cmd = cmd + ' -D %s' % proxy_id
cmd = cmd + ' -D %s' % self.proxy_id
def cream_submit(self, jdlpath, ce): '''CREAM CE direct job submission'''
if stripProxy(j.backend)._name == "Panda":
if stripProxy(j.backend)._name == "Panda" and j.application.atlas_exetype == "ATHENA":
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 and job.inputdata.type == 'DQ2_COPY' and not config['ENABLE_DQ2COPY']:
if job.inputdata and job.inputdata._name in [ 'DQ2Dataset' ] and job.inputdata.type == 'DQ2_COPY' and not config['ENABLE_DQ2COPY']:
def master_configure(self):
data = get_md5_obj().update( data ).hexdigest()
md5_obj = get_md5_obj() md5_obj.update( data ) data = md5_obj.hexdigest()
def get_uuid(*args): ''' Generates a universally unique ID. ''' t = long( time.time() * 1000 ) r = long( random.random()*100000000000000000L ) try: a = socket.gethostbyname( socket.gethostname() ) except: # if we can't get a network address, just imagine one a = random.random()*100000000000000000L data = str(t)+' '+str...
logger.warning('!!! Number of subjobs %s is larger than maximum allowed of %s - reducing to %s !!!', nrjobs, config['MaxJobsDQ2JobSplitter'], config['MaxJobsDQ2JobSplitter'] )
logger.warning('!!! Number of subjobs %s is larger than maximum allowed of %s - reducing to %s !!!', nrjob, config['MaxJobsDQ2JobSplitter'], config['MaxJobsDQ2JobSplitter'] )
def split(self,job):
output_location = os.path.join(output_location, jid)
if job._getRoot().subjobs and config['IndividualSubjobDirsForLocalOutput']: output_location = os.path.join(output_location, "%d/%d" % (job._getRoot().id, job.id)) else: output_location = os.path.join(output_location, jid)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): """prepare the subjob specific configuration"""
for f in j.outputdata.output: if "root" in f: return True logger.error("Job %s has not produced %s file, only: %s" % (j.id, "root", j.outputdata.output)) return False
for odat in j.outputdata.outputdata: if 0==len([f for f in j.outputdata.output if odat in f]): logger.error("Job %s has not produced %s file, only: %s" % (j.id, odat, j.outputdata.output)) return True
def checkCompletedApp(self, app): j = app._getParent() for f in j.outputdata.output: if "root" in f: return True logger.error("Job %s has not produced %s file, only: %s" % (j.id, "root", j.outputdata.output)) return False
A subset of tasks may be created by slicing (e.g. tasks[:-10] last ten tasks)
A subset of tasks may be created by slicing (e.g. tasks[-10:] last ten tasks)
def pause(self,keep_going): self.do_collective_operation(keep_going,'pause')
tasks[:-10] : get last 10 tasks.
tasks[-10:] : get last 10 tasks.
def __getslice__(self, i1,i2): """ Get a slice. Examples: tasks[2:] : get first two tasks, tasks[:-10] : get last 10 tasks. """ return _wrap(self._impl.__getslice__(i1,i2))
for f in input_sandbox: getPackedInputSandbox(f)
def open_file(fname): try: filehandle=file(fname,'w') except IOError,x: print 'ERROR: not able to write a status file: ', fname print 'ERROR: ',x raise return filehandle
exec_bin = True
def list_match(self, jdlpath, ce=None): '''Returns a list of computing elements can run the job'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd), allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd), allowed_exit=[0,255])
def list_match(self, jdlpath, ce=None): '''Returns a list of computing elements can run the job'''
cmd = 'edg-job-submit'
cmd = 'edg-job-submit' exec_bin = False
def submit(self, jdlpath, ce=None, doListMatch=False, jdlpathForListMatch=None): '''Submit a JDL file to LCG'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def submit(self, jdlpath, ce=None, doListMatch=False, jdlpathForListMatch=None): '''Submit a JDL file to LCG'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def native_master_cancel(self,jobids): '''Native bulk cancellation supported by GLITE middleware.'''
cmd = 'edg-job-status'
cmd = 'edg-job-status' exec_bin = False
def status(self,jobids,is_collection=False): '''Query the status of jobs on the grid'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd), allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd), allowed_exit=[0,255])
def status(self,jobids,is_collection=False): '''Query the status of jobs on the grid'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def get_loginfo(self,jobids,directory,verbosity=1): '''Fetch the logging info of the given job and save the output in the job's outputdir'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def get_output(self,jobid,directory,wms_proxy=False): '''Retrieve the output of a job on the grid'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def cancelMultiple(self, jobids): '''Cancel multiple jobs in one LCG job cancellation call'''
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=True),cmd),allowed_exit=[0,255])
rc, output, m = self.shell.cmd1('%s%s' % (self.__get_cmd_prefix_hack__(binary=exec_bin),cmd),allowed_exit=[0,255])
def cancel(self,jobid): '''Cancel a job'''
if job.inputdata.tag_info[tag_file]['refs'][0][2] in remaining_guids:
num = 0 for ref in job.inputdata.tag_info[tag_file]['refs']: if ref[2] in remaining_guids: num += 1 if num > 0 and num != len(job.inputdata.tag_info[tag_file]['refs']): for ref in job.inputdata.tag_info[tag_file]['refs']: if ref[2] in remaining_guids: remaining_guids.remove(ref[2]) logger.warning('Not all guids refere...
def split(self,job):
mpat = re.compile(r'(\[(?P<section>\S+)\]|)(?P<option>[a-zA-z0-9._]+)=(?P<value>.+)')
mpat = re.compile(r'(\[(?P<section>\S+)\]|)(?P<option>[a-zA-z0-9._/]+)=(?P<value>.+)')
def parse_cmdline_config_options(cmdline_options): """ Parse a list of command line config options and return a list of triplets (section,option,value). In case of parsing errors, raise ConfigError exception. """ import re mpat = re.compile(r'(\[(?P<section>\S+)\]|)(?P<option>[a-zA-z0-9._]+)=(?P<value>.+)') section = N...
logger.error('unable to open file %s', p)
logger.debug('unable to open file %s', p)
def getStateTime(self, status): """Obtains the timestamps for the 'running', 'completed', and 'failed' states.
logger.error("Value Error in file: '%s': string does not match required format.", p)
logger.debug("Value Error in file: '%s': string does not match required format.", p)
def getStateTime(self, status): """Obtains the timestamps for the 'running', 'completed', and 'failed' states.
param += '-j "(wget %s/cache/%s || wget --no-check-certificate %s/cache/%s) && tar xzvf %s && chmod -f +x %s; echo === executing user script ===; PATH=$PATH:. %s" ' % (srcURL, self.inputsandbox, srcURL, self.inputsandbox, self.inputsandbox, job.application.exe, job.application.exe)
param += '-j "(wget %s/cache/%s || wget --no-check-certificate %s/cache/%s) && tar xzvf %s && chmod -f +x %s; echo === executing user script ===; PATH=$PATH:. %s" ' % (srcURL, self.inputsandbox, srcURL, self.inputsandbox, self.inputsandbox, exe_name, exe_name)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
param += '-j "chmod -f +x %s; echo === executing user script ===; PATH=$PATH:. %s" ' % (job.application.exe, job.application.exe)
param += '-j "chmod -f +x %s; echo === executing user script ===; PATH=$PATH:. %s" ' % (exe_name, exe_name)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
param += '-j "%s" -p "%s" ' % ( job.application.exe,urllib.quote(" ".join(job.application.args)))
param += '-j "%s" -p "%s" ' % ( exe_name,urllib.quote(" ".join(job.application.args)))
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
from Ganga.Core import monitoring_component while not monitoring_component.enabled:
while True: from Ganga.Core import monitoring_component if not monitoring_component is None and monitoring_component.enabled: break
def _thread_main(self): """ This is an internal function; the main loop of the background thread """ ## Add runtime handlers for all the taskified applications, since now all the backends are loaded from Ganga.GPIDev.Adapters.ApplicationRuntimeHandlers import allHandlers from TaskApplication import handler_map for base...
self.setPartitionsStatus(range(1,len(value)+1), "ready")
def check(self): nargs = len(self.args) self.setPartitionsStatus(range(1,nargs+1), "ready")
def _checksetNestedLists(self,value): """The rule is that if there are nested lists then they must not contain GangaObjects, as this corrupts the repository""" if isNestedList(value) and containsGangaObjects(value): raise TypeMismatchError('Assigning nested lists which contain Ganga GPI Objects is not supported.') self...
self.setPartitionsLimit(len(value)+1)
self.setPartitionsLimit(nargs+1)
def _checksetNestedLists(self,value): """The rule is that if there are nested lists then they must not contain GangaObjects, as this corrupts the repository""" if isNestedList(value) and containsGangaObjects(value): raise TypeMismatchError('Assigning nested lists which contain Ganga GPI Objects is not supported.') self...
outMapNew.update(x)
outMapNew.update(dict(x))
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
def master_submit(self,rjobs,subjobconfigs,masterjobconfig,keep_going):
def master_submit(self,rjobs,subjobconfigs,masterjobconfig,keep_going=False):
def master_submit(self,rjobs,subjobconfigs,masterjobconfig,keep_going):
def master_submit(self,masterjobconfig,subjobconfigs):
def master_submit(self,masterjobconfig,subjobconfigs,keep_going):
def master_submit(self,masterjobconfig,subjobconfigs): ... do_some_processsing_of(masterjobconfig) ... return Backend.master_submit(self,masterjobconfig,subjobconfigs)
return Backend.master_submit(self,masterjobconfig,subjobconfigs)
return IBackend.master_submit(self,subjobconfigs,masterjobconfig,keep_joing) Implementation note: we set keep_going to be optional in the signature of IBackend.master_submit() to allow the existing backend implementations which do not support keep_going=True and which at some point may call IBackend.master_submit() t...
def master_submit(self,masterjobconfig,subjobconfigs): ... do_some_processsing_of(masterjobconfig) ... return Backend.master_submit(self,masterjobconfig,subjobconfigs)
infoLine = trashDatasetname + ',' + trashFile + ',' + guid + ',' + contents[guid]['filesize'] + ',' + contents[guid]['checksum'] + ',' + location
infoLine = trashDatasetname + ',' + trashFile + ',' + guid + ',' + '%s' %contents[guid]['filesize'] + ',' + contents[guid]['checksum'].replace('ad:','') + ',' + location
def clean_duplicates_in_dataset(self, datasetname = None): """Clean duplicate filesfrom dataset if e.g. shallow retry count occured"""
trashDatasetname = datasetname + '.trash'
def clean_duplicates_in_dataset(self, datasetname = None): """Clean duplicate filesfrom dataset if e.g. shallow retry count occured"""
self.create_dataset(trashDatasetName)
try: self.create_dataset(trashDatasetname) except: logger.warning('Trash dataset %s already exists !', trashDatasetname )
def clean_duplicates_in_dataset(self, datasetname = None): """Clean duplicate filesfrom dataset if e.g. shallow retry count occured"""
logger.warning('Duplicate files are now in dataset: %s', trashDataset)
logger.warning('Duplicate files are now in dataset: %s', trashDatasetname)
def clean_duplicates_in_dataset(self, datasetname = None): """Clean duplicate filesfrom dataset if e.g. shallow retry count occured"""
print "port : " + str(port)
def run(self):
server.serve_forever() """
print print 'You can monitor your jobs on the following link: ' + getMonitoringLink(port)
def run(self):
print "stopping HTTP server thread" os.remove(tempFilePath)
pass
def run(self):
"""
def run(self):
if status.jobStatus in ['defined','unknown','assigned','waiting','activated','sent','finished']:
bjstats = [bj2.status for bj2 in job.backend.buildjobs] new_stat = None for s in ['defined','unknown','assigned','waiting','activated','sent','finished', 'starting','running','holding','transferring', 'failed', 'cancelled']: if s in bjstats: new_stat = s break if new_stat in ['defined','unknown','assigned','waiting',...
def master_updateMonitoringInformation(jobs): '''Monitor jobs''' from pandatools import Client
elif status.jobStatus in ['starting','running','holding','transferring']:
elif new_stat in ['starting','running','holding','transferring']:
def master_updateMonitoringInformation(jobs): '''Monitor jobs''' from pandatools import Client
elif status.jobStatus == 'failed':
elif new_stat == 'failed':
def master_updateMonitoringInformation(jobs): '''Monitor jobs''' from pandatools import Client
elif status.jobStatus == 'cancelled':
elif new_stat == 'cancelled':
def master_updateMonitoringInformation(jobs): '''Monitor jobs''' from pandatools import Client
self.user_area.name = archiveFullName
self.userarea = archiveFullName
def prepare(self): """Prepare each job/subjob from the user area""" from pandatools import AthenaUtils # get Athena versions rc, out = AthenaUtils.getAthenaVer() # failed if not rc: raise ApplicationConfigurationError(None, 'CMT could not parse correct environment ! \n Did you start/setup ganga in the run/ or cmt/ subd...
def wn_dest_ce():
def wn_dest_ce(ji):
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)
if 0 != os.system(cmd)
if os.system(cmd) != 0:
def getInputSandbox(src_dir,dest_dir='.'): """Get all input sandbox_files from tarball and write them to the workdir. This function is called by wrapper script at the run time. Arguments: 'src_dir': a source directory with InputSandbox files. 'dest_dir': a destination directory """ cmd = "tar chf - -C %s . | tar xf -...
self.subjobs = subjobs for j in self.subjobs:
for j in subjobs:
def submit(self,keep_going=False,keep_on_fail=False): '''Submits a job. Return true on success.
def wn_dest_ce():
def wn_dest_ce(ji):
def wn_dest_ce(): """Build dest_ce. Only run on worker node.""" dest_ce = CommonUtil.env('CE_ID') return CommonUtil.strip_to_none(dest_ce)
input_sandbox_names.append( os.path.basename(f) )
def preparejob(self,jobconfig,master_job_sandbox): '''Prepare the JDL'''
tag = 'Atlas-%s' % job.application.atlas_release
if job.application.atlas_production=='': tag = 'Atlas-%s' % job.application.atlas_release else: tag = '%s-%s' % (job.application.atlas_project,job.application.atlas_production)
def runPandaBrokerage(job): from pandatools import Client # get locations when site==AUTO if job.backend.site == "AUTO": libdslocation = [] if job.backend.libds: # TODO: fix the cloud here try: libdslocation = Client.getLocations(job.backend.libds,[],job.backend.requirements.cloud,False,False) except exceptions.System...
pass
try: if len(job.application.atlas_release.split('.')) == 3: tag = 'Atlas-%s' % job.application.atlas_release else: tag = 'AtlasProduction-%s' % job.application.atlas_release except: logger.warning("Could not determine athena tag for Panda brokering")
def runPandaBrokerage(job): from pandatools import Client # get locations when site==AUTO if job.backend.site == "AUTO": libdslocation = [] if job.backend.libds: # TODO: fix the cloud here try: libdslocation = Client.getLocations(job.backend.libds,[],job.backend.requirements.cloud,False,False) except exceptions.System...
config.addOption('heartbeat_frequence', '30', "Heartbeat frequence config variable")
config.addOption('heartbeat_frequency', '30', "Heartbeat frequency config variable")
def get_status(f): """Give (pid,queue,actualCE,exit code) for job"""
config.addOption('heartbeat_frequence', '30', "Heartbeat frequence config variable")
config.addOption('heartbeat_frequency', '30', "Heartbeat frequency config variable")
def __init__(self): super(LSF,self).__init__()
config.addOption('heartbeat_frequence', '30', "Heartbeat frequence config variable")
config.addOption('heartbeat_frequency', '30', "Heartbeat frequency config variable")
def __init__(self): super(PBS,self).__init__()
url="http://www.megaupload.com/?d="+code req = urllib2.Request(url) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') req.add_header('Cookie', 'l=es; user='+user) try: response = urllib2.urlopen(req) except: req = urllib2.Request(url.replace(" ","...
logger.info("getmegauploadvideo0") req = urllib2.Request("http://www.megaupload.com/?d="+code) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') req.add_header('Cookie', 'l=es; user='+user) try: opener = urllib2.build_opener(SmartRedirectHandle...
def getmegauploadvideo(code,user): url="http://www.megaupload.com/?d="+code req = urllib2.Request(url) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') req.add_header('Cookie', 'l=es; user='+user) try: response = urllib2.urlopen(req) except: req ...
if usingsamba: ficheros = samba.get_files(BOOKMARK_PATH) else: ficheros = os.listdir(BOOKMARK_PATH) ficheros.sort() filenumber = int( ficheros[len(ficheros)-1][0:-4] )+1
if usingsamba: ficheros = samba.get_files(BOOKMARK_PATH) else: ficheros = os.listdir(BOOKMARK_PATH) ficheros.sort() if len(ficheros)>0: filenumber = int( ficheros[len(ficheros)-1][0:-4] )+1 else: filenumber=1
def savebookmark(titulo,url,thumbnail,server,plot): logger.info("[favoritos.py] savebookmark") # No va bien ms que en Windows #bookmarkfiledescriptor,bookmarkfilepath = tempfile.mkstemp(suffix=".txt",prefix="",dir=BOOKMARK_PATH) # Crea el directorio de favoritos si no existe if not usingsamba: try: os.mkdir(BOOKMARK_...
The criteria is a colon-separated list, where each item in the list has the form [name]=[value]. The following criteria are supported: surname=[name] Match a person with [name] in any part of the surname. name=[name] Match a person with [name] in any part of the given name. birth=[year] Match a person whose birth yea...
The criteria is a colon-separated list, where each item in the list has the form [name]=[value]. The following criteria are supported: * surname=[name] - Match a person with [name] in any part of the surname. * name=[name] - Match a person with [name] in any part of the given name. * birth=[year] - Match a person whos...
def criteria_match(self,criteria): """ Check in this element matches all of the given criteria. The criteria is a colon-separated list, where each item in the
except:
except IndexError:
def given_name(self): """ Return person's given name """ try: return self.name()[0] except: return None
except:
except IndexError:
def surname(self): """ Return person's surname """ try: return self.name()[1] except: return None
except:
except ValueError:
def birth_year(self): """ Return the birth year of a person in integer format """ date = "" for e in self.children_lines(): if e.tag() == "BIRT": for c in e.children_lines(): if c.tag() == "DATE": datel = string.split(c.value()) date = datel[len(datel)-1] if date == "": return -1 try: return int(date) except: return -1
except:
except ValueError:
def death_year(self): """ Return the death year of a person in integer format """ date = "" for e in self.children_lines(): if e.tag() == "DEAT": for c in e.children_lines(): if c.tag() == "DATE": datel = string.split(c.value()) date = datel[len(datel)-1] if date == "": return -1 try: return int(date) except: return -1
except:
except ValueError:
def criteria_match(self,criteria): """ Check in this individual matches all of the given criteria.
except:
except ValueError:
def marriage_years(self): """ Return a list of marriage years for a person, each in integer format. """ dates = [] for e in self.children_lines(): if e.tag() == "FAMS": f = self.dict.get(e.value(),None) if f == None: return dates for g in f.children_lines(): if g.tag() == "MARR": for h in g.children_lines(): if h.tag()...
print mytemplate.render_unicode(stack=stack, index=latex_index(stack), pages=pages)
print mytemplate.render_unicode(stack=stack, index=latex_index(stack), pages=pages).encode('utf-8')
def pages(individual): pages = [] if individual.parent_family() is not None: return [individual.parent_family().xref()] for f in individual.families(): if f is not None: pages.append(f.xref()) return pages
self.__init()
self._init()
def __init__(self,level,pointer,tag,value,dict): Element.__init__(self,level,pointer,tag,value,dict)
self.__init()
def parent_family(self): self.__init() return self.__parent_family
self.__init()
def families(self): self.__init() return self.__families
self.__init()
def father(self): self.__init() if self.parent_family() != None: if self.parent_family().husband() != None: return self.parent_family().husband()
self.__init()
def mother(self): self.__init() if self.parent_family() != None: if self.parent_family().wife() != None: return self.parent_family().wife()