rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return mc[option]
monClasses = mc[option] if monClasses: return monClasses
def _getMonClasses(option): """ for a given app,backend pair return the monitoring classes or an empty string if it's not defined """ try: return mc[option] except (ConfigError,KeyError): return ''
return ''
pass return ''
def _getMonClasses(option): """ for a given app,backend pair return the monitoring classes or an empty string if it's not defined """ try: return mc[option] except (ConfigError,KeyError): return ''
cnt = len(jobs) fg = Foreground() fx = Effects() bg = Background() status_colours = {'new' : fx.normal, 'submitted' : fg.orange, 'running' : fg.green, 'completed' : fg.blue, 'failed' : fg.red } ds += "[Jobs]: %d\n" % cnt if cnt > 0:
ds += "[Jobs]: %d\n" % len(jobs) if len(jobs) > 0:
def _display(self, interactive = 0): from Ganga.Utility.ColourText import ANSIMarkup, NoMarkup, Foreground, Background, Effects if interactive: markup = ANSIMarkup() else: markup = NoMarkup()
ds += "ID status name backend \n" for j in jobs: try: colour = status_colours[j.status] except KeyError: colour = fx.normal if hasattr(j.backend, 'actualCE'): ds+= markup(" else: ds+= markup("
ds += jobs._display(interactive)
def _display(self, interactive = 0): from Ganga.Utility.ColourText import ANSIMarkup, NoMarkup, Foreground, Background, Effects if interactive: markup = ANSIMarkup() else: markup = NoMarkup()
res.objects[j.id] = _wrap(j)
res.objects[j.id] = j
def getjobs(self, path = None): """Gives list of all jobs (objects) referenced in current folder or folder in the path if the latter is provided. """ #jobslice ##res = [] res = JobRegistrySlice("") registry = self._getRegistry() do_clean = False if registry is not None: registry = registry._parent path = os.path.join(*...
return res
return _wrap(res)
def getjobs(self, path = None): """Gives list of all jobs (objects) referenced in current folder or folder in the path if the latter is provided. """ #jobslice ##res = [] res = JobRegistrySlice("") registry = self._getRegistry() do_clean = False if registry is not None: registry = registry._parent path = os.path.join(*...
exec self._import_string
exec self.importDynamicUtil()
def _cl_task_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self._import_string 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(j), ...
exec self._import_string
exec self.importDynamicUtil()
def _cl_job_meta_message(self): j = self.job_info # called on client, so job_info is Job object exec self._import_string 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.physics_M...
userInfoDirName = userInfoDirName + now.strftime("%Y-%m-%d|%H:%M:%S")
userInfoDirName = userInfoDirName + now.strftime("%Y-%m-%d-%H:%M:%S")
def renameDataFiles(directory):
logger.error("If you want to delete the incomplete objects, you can type 'for i in %s.incomplete_ids(): %s(i).remove()' (press 'Enter' twice)" % (self.registry.name, self.registry.name))
global printed_explanation if not printed_explanation: logger.error("If you want to delete the incomplete objects, you can type 'for i in %s.incomplete_ids(): %s(i).remove()' (press 'Enter' twice)" % (self.registry.name, self.registry.name)) printed_explanation = True
def update_index(self,id = None,verbose=False): """ Update the list of available objects Raise RepositoryError""" # First locate and load the index files logger.debug("updating index...") objs = self.get_index_listing() summary = [] for id, idx in objs.iteritems(): # Make sure we do not overwrite older jobs if someone ...
return
raise InaccessibleObjectError(self,id,x)
def load(self, ids, load_backup=False): for id in ids: fn = self.get_fn(id) if load_backup: fn = fn+"~" try: fobj = file(fn,"r") except IOError, x: if x.errno == errno.ENOENT: # remove index so we do not continue working with wrong information try: self._internal_del__(id) # remove internal representation os.unlink(os....
logger.error("Could not logon to remote host " + self.username + "@" + self.host)
logger.error("Could not logon to remote host " + self.username + "@" + self.host + " after three attempts. Restart Ganga to have another go.") Remote._transportarray = [Remote._transportarray, [self.username, self.host, None, None]]
def opentransport( self ):
try: result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"application\": %s," % addQuotes(job.application.__class__.__name__)) result.append("\"backend\": %s," % a...
result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"inputdir\": %s," % addQuotes(job.inputdir)) result.append("\"outputdir\": %s," % addQuotes(job.outputdir)) ...
def get_job_JSON(job): undefinedAttribute = 'UNDEFINED' try: result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"application\": %s," % addQuotes(job.application...
try: result.append("\"actualCE\": %s" % addQuotes(job.backend.actualCE))
result.append("\"application\": %s," % addQuotes(job.application.__class__.__name__)) result.append("\"backend\": %s," % addQuotes(job.backend.__class__.__name__)) result.append("\"subjobs\": %s," % addQuotes(str(len(job.subjobs)))) result.append("\"uuid\": %s," % addQuotes(job.info.uuid)) try: result.append("\"actual...
def get_job_JSON(job): undefinedAttribute = 'UNDEFINED' try: result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"application\": %s," % addQuotes(job.application...
result.append("\"actualCE\": %s" % addQuotes(undefinedAttribute)) result.append("}") return "".join(result)
result.append("\"actualCE\": %s," % addQuotes(undefinedAttribute))
def get_job_JSON(job): undefinedAttribute = 'UNDEFINED' try: result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"application\": %s," % addQuotes(job.application...
return ""
pass if result[len(result)-1][-1] == ',': last = result[-1] result = result[:-1] result.append(last[:-1]) result.append("}") return "".join(result)
def get_job_JSON(job): undefinedAttribute = 'UNDEFINED' try: result = [] result.append("{") result.append("\"id\": %s," % addQuotes(job.fqid)) result.append("\"status\": %s," % addQuotes(job.status)) result.append("\"name\": %s," % addQuotes(job.name)) result.append("\"application\": %s," % addQuotes(job.application...
if fromDate is None and toDate is None:
if timeCreated is None: if fromDate is None and toDate is None: json_jobs_strings.append(jobInfo.getJobJSON()) json_jobs_strings.append(",") elif fromDate is None and toDate is None:
def get_jobs_JSON(fromDate=None, toDate=None): json_jobs_strings = [] json_jobs_strings.append("{\"user_taskstable\": [") for jobInfo in jobs_dictionary.values(): timeCreated = jobInfo.getTimeCreated() if fromDate is None and toDate is None: json_jobs_strings.append(jobInfo.getJobJSON()) json_jobs_strings.append("...
jobs_dictionary[job_id] = JobRelatedInfo(get_job_JSON(job), job.time.timestamps['new'])
try: jobs_dictionary[job_id] = JobRelatedInfo(get_job_JSON(job), job.time.timestamps['new']) except RegistryKeyError: jobs_dictionary[job_id] = JobRelatedInfo(get_job_JSON(job), None)
def update_jobs_dictionary(): reg = getRegistry("jobs") #get the changed jobs changed_ids = reg.pollChangedJobs("WebGUI") for job_id in changed_ids: try: job = jobs(job_id) jobs_dictionary[job_id] = JobRelatedInfo(get_job_JSON(job), job.time.timestamps['new']) except RegistryKeyError: del jobs_dictionary[job_id]
jobs_dictionary[job.id] = JobRelatedInfo(get_job_JSON(job), job.time.timestamps['new'])
jobid = job.id jobJSON = get_job_JSON(job) try: jobs_dictionary[jobid] = JobRelatedInfo(jobJSON, job.time.timestamps['new']) except RegistryKeyError: jobs_dictionary[jobid] = JobRelatedInfo(jobJSON, None) print jobJSON
def fill_jobs_dictionary(): for job in jobs: try: jobs_dictionary[job.id] = JobRelatedInfo(get_job_JSON(job), job.time.timestamps['new']) except RegistryKeyError: pass
return 'file://' + webMonitoringLink + '?port=' + str(port)
return 'file://' + webMonitoringLink + '?port=' + str(port) + '
def getMonitoringLink(port): #exeDir = os.getcwd() webMonitoringLink = os.path.join(config['System']['GANGA_PYTHONPATH'], 'Ganga', 'Core', 'WebMonitoringGUI', 'client', 'index.html' ) return 'file://' + webMonitoringLink + '?port=' + str(port)
AthenaUtils.extFile=[] AthenaUtils.setExtFile(self.append_to_user_area) AthenaUtils.excludeFile=[] AthenaUtils.setExcludeFile(','.join(self.exclude_from_user_area)) verbose = False if self.atlas_exetype in ['EXE'] and not self.athena_compile: maxFileSize = config['EXE_MAXFILESIZE'] archiveName, archiveFullName = crea...
def prepare(self, **options): """Extract Athena job configuration and prepare job for submission"""
jobFolder = 'job_%s' % str(job.id)
jobFolder = 'job_%s' % str(job.fqid)
def renameDataFiles(directory):
repositoryPath = repositoryPath.replace('$thousandsNum', str(job.id/1000))
is_subjob = job.fqid.find('.') > -1 if is_subjob: jobid, subjobid = job.fqid.split('.')[0], job.fqid.split('.')[1] repositoryPath = repositoryPath.replace('$thousandsNum', str(int(jobid)/1000)) repositoryPath = os.path.join(repositoryPath, jobid) else: repositoryPath = repositoryPath.replace('$thousandsNum', str(job...
def renameDataFiles(directory):
indexFileTargetPath = os.path.join(fullLogDirName, 'repository', indexFileName) shutil.copyfile(indexFileSourcePath, indexFileTargetPath)
if not is_subjob: indexFileTargetPath = os.path.join(fullLogDirName, 'repository', indexFileName) shutil.copyfile(indexFileSourcePath, indexFileTargetPath)
def renameDataFiles(directory):
backend_name = job_info.backend.__class__.__name__ self._import_string = "from Ganga.Lib.MonitoringServices.Dashboard import %sUtil as dynamic_util" % backend_name self._util_string = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil" % backend_name
def importDynamicUtil(self): backend_name = self.job_info.backend.__class__.__name__ import_string = "from Ganga.Lib.MonitoringServices.Dashboard import %sUtil as dynamic_util" % backend_name return import_string
def __init__(self, job_info, config_info): """Construct the Dashboard Backend Monitoring Service.""" DashboardMS.__init__(self, job_info, config_info) backend_name = job_info.backend.__class__.__name__ self._import_string = "from Ganga.Lib.MonitoringServices.Dashboard import %sUtil as dynamic_util" % backend_name self....
exec self._import_string __import__(self._util_string) import sys
exec self.importDynamicUtil() backend_name = self.job_info.backend.__class__.__name__ util_string = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil" % backend_name __import__(util_string) import sys
def getSandboxModules(self): """Return list of module dependencies.""" import Ganga.Lib.MonitoringServices.Dashboard exec self._import_string __import__(self._util_string) import sys return DashboardMS.getSandboxModules(self) + [ Ganga.Lib.MonitoringServices.Dashboard.CommonUtil, Ganga.Lib.MonitoringServices.Dashboard....
sys.modules[self._util_string],
sys.modules[util_string],
def getSandboxModules(self): """Return list of module dependencies.""" import Ganga.Lib.MonitoringServices.Dashboard exec self._import_string __import__(self._util_string) import sys return DashboardMS.getSandboxModules(self) + [ Ganga.Lib.MonitoringServices.Dashboard.CommonUtil, Ganga.Lib.MonitoringServices.Dashboard....
exec self._import_string
exec self.importDynamicUtil()
def getJobInfo(self): """Create job_info from Job object.""" j = self.job_info # called on client, so job_info is Job object exec self._import_string ji = { 'fqid': j.fqid, 'EXECUTION_BACKEND': dynamic_util.cl_execution_backend(j), 'OWNERDN': dynamic_util.cl_ownerdn(), 'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job_id_i...
exec self._import_string
exec self.importDynamicUtil()
def complete(self, **opts): """Log complete event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'complete %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log('debug', 'Not sending unwanted message on complete for master wrapper job %s.' % j.fqid) return ...
exec self._import_string
exec self.importDynamicUtil()
def fail(self, **opts): """Log fail event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'fail %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log('debug', 'Not sending unwanted message on fail for master wrapper job %s.' % j.fqid) return # send LB Done o...
exec self._import_string
exec self.importDynamicUtil()
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self._import_string msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE. e.g...
if self.application.atlas_dbrelease and not self.application.atlas_dbrelease == "LATEST":
if self.application.atlas_dbrelease == "LATEST": self.application.atlas_dbrelease = Client.getLatestDBRelease(False) if self.application.atlas_dbrelease:
def check(self): super(AnaTransform,self).check() if not self.inputdata.dataset: return if not self.backend: logger.warning("Determining backend and cloud...")
logger.warning('Job %d has status %s and is being ignored.', j.id, j.status)
logger.warning('Job %s has status %s and is being ignored.', j.fqid, j.status)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
logger.error('Job %d has status %s and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', j.id, j.status)
logger.error('Job %s has status %s and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', j.fqid, j.status)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
logger.error("Job %d is in an unsupported status %s and so the merge can not continue. '\ 'Supported statuses are 'completed', 'failed' or 'killed' (if the ignorefailed flag is set).", j.id, j.status)
logger.error("Job %s is in an unsupported status %s and so the merge can not continue. '\ 'Supported statuses are 'completed', 'failed' or 'killed' (if the ignorefailed flag is set).", j.fqid, j.status)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
logger.error('The merge of Job %d failed and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', j.id)
logger.error('The merge of Job %s failed and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', j.fqid)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
logger.warning('The file %s in Job %d was not found. The file will be ignored.',str(f),j.id)
logger.warning('The file %s in Job %s was not found. The file will be ignored.',str(f),j.fqid)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
logger.error('The file %s in Job %d was not found and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', str(f), j.id)
logger.error('The file %s in Job %s was not found and so the merge can not continue. '\ 'This can be overridden with the ignorefailed flag.', str(f), j.fqid)
def merge(self, jobs, outputdir = None, ignorefailed = None, overwrite = None): """ Method to merge the output of jobs. jobs may be a single job instance or a sequence of Jobs outputdir is the name of the directry to put the merge results in. It will be created if needed. ignorefailed and overwrite have the same meani...
if TiersOfATLAS.getSiteProperty(sitename,'alternateName')==dq2alternatename and (TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASMCDISK') or TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASDATADISK') or TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASSCRATCHDI...
if TiersOfATLAS.getSiteProperty(sitename,'alternateName')==dq2alternatename and \ (TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASMCDISK') or \ TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASDATADISK') or \ TiersOfATLAS.getSiteProperty(sitename,'srm').startswith('token:ATLASSCR...
def register_datasets_details(datasets,outdata): reglines=[] for line in outdata: try: #[dataset,lfn,guid,siteID]=line.split(",") [dataset,lfn,guid,size,md5sum,siteID]=line.split(",") except ValueError: continue size = long(size) adler32='ad:'+md5sum if len(md5sum)==32: adler32='md5:'+md5sum siteID=siteID.strip() # r...
return 'local_dest_CE'
from Ganga.Utility.Config import getConfig batch = getConfig('Configuration')['Batch'] host = getConfig('System')['GANGA_HOSTNAME'] return '%s_local_%s' % (host, 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) """ return 'local_dest_CE'
from Ganga.Utility.Config import getConfig???
from Ganga.Utility.Config import getConfig
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
if app.user_area and app.user_area.name: inputbox.append(File(app.user_area.name))
if app.userarea : inputbox.append(File(app.userarea))
def master_prepare(self,app,appmasterconfig): if app.siteroot: os.environ["SITEROOT"]=app.siteroot os.environ["CMTSITE"]=app.cmtsite
elif status.jobStatus == 'cancelled':
elif status.jobStatus == 'cancelled' and job.status not in ['completed','failed']:
def master_updateMonitoringInformation(jobs): '''Monitor jobs''' from pandatools import Client
rc, output = commands.getstatusoutput('cp %s %s' % (app.user_area.name, inputsandbox))
rc, output = commands.getstatusoutput('cp %s %s.gz' % (app.user_area.name, inputsandbox))
def master_prepare(self,app,appconfig): '''Prepare the master job'''
sys.stdout=file('./__syslog__','w') sys.stderr=sys.stdout
def __init__(self): self.imods = '' self.wrapper_script_template = """#!/usr/bin/env python
path_to_module = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil"%backend_name __import__(path_to_module) import sys self.dynamic_util = sys.modules[path_to_module]
def __init__(self, job_info, config_info): """Construct the Dashboard Backend Monitoring Service.""" DashboardMS.__init__(self, job_info, config_info) try: backend_name = self.job_info.backend.__class__.__name__ path_to_module = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil"%backend_name __import__(path_to_module) imp...
self.dynamic_util = None
backend_name = self.job_info['BACKEND'] path_to_module = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil"%backend_name __import__(path_to_module) import sys self.dynamic_util = sys.modules[path_to_module]
def __init__(self, job_info, config_info): """Construct the Dashboard Backend Monitoring Service.""" DashboardMS.__init__(self, job_info, config_info) try: backend_name = self.job_info.backend.__class__.__name__ path_to_module = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil"%backend_name __import__(path_to_module) imp...
self.dynamic_util
self.dynamic_util,
def getSandboxModules(self): """Return list of module dependencies.""" import Ganga.Lib.MonitoringServices.Dashboard import sys return DashboardMS.getSandboxModules(self) + [ Ganga.Lib.MonitoringServices.Dashboard.CommonUtil, Ganga.Lib.MonitoringServices.Dashboard.BackendMS, self.dynamic_util ]
dq2_config = getConfig("DQ2")["DQ2 configuration options"]
dq2_config = getConfig("DQ2")
def checkCompletedApp(self, app): j = app._getParent() for odat in j.outputdata.outputdata: # Look out: if this is changed, there is anothher one like it below! 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.o...
match = re.search('^(\S*).%s.*'%location, dataset)
if location: match = re.search('^(\S*).%s.*'%location, dataset) else: match = re.search('^(\S*)\..*', dataset)
def fill(self, type=None, name=None, **options ): """Determine outputdata and outputsandbox locations of finished jobs and fill output variable"""
return CommonUtil.hostname()
return None
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...
if str(app.atlas_release)[:3] == '16.'):
if (str(app.atlas_release[:3]) == '16.'):
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): """prepare the subjob specific configuration"""
def importDynamicUtil(self): backend_name = self.job_info.backend.__class__.__name__ import_string = "from Ganga.Lib.MonitoringServices.Dashboard import %sUtil as dynamic_util" % backend_name return import_string
try: backend_name = self.job_info.backend.__class__.__name__ path_to_module = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil"%backend_name __import__(path_to_module) import sys self.dynamic_util = sys.modules[path_to_module] except AttributeError: self.dynamic_util = None
def __init__(self, job_info, config_info): """Construct the Dashboard Backend Monitoring Service.""" DashboardMS.__init__(self, job_info, config_info)
exec self.importDynamicUtil() backend_name = self.job_info.backend.__class__.__name__ util_string = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil" % backend_name __import__(util_string)
def getSandboxModules(self): """Return list of module dependencies.""" import Ganga.Lib.MonitoringServices.Dashboard exec self.importDynamicUtil() backend_name = self.job_info.backend.__class__.__name__ util_string = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil" % backend_name __import__(util_string) import sys retur...
sys.modules[util_string],
self.dynamic_util
def getSandboxModules(self): """Return list of module dependencies.""" import Ganga.Lib.MonitoringServices.Dashboard exec self.importDynamicUtil() backend_name = self.job_info.backend.__class__.__name__ util_string = "Ganga.Lib.MonitoringServices.Dashboard.%sUtil" % backend_name __import__(util_string) import sys retur...
exec self.importDynamicUtil()
def getJobInfo(self): """Create job_info from Job object.""" j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() ji = { 'fqid': j.fqid, 'EXECUTION_BACKEND': dynamic_util.cl_execution_backend(j), 'OWNERDN': dynamic_util.cl_ownerdn(), 'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job...
'EXECUTION_BACKEND': dynamic_util.cl_execution_backend(j), 'OWNERDN': dynamic_util.cl_ownerdn(), 'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job_id_inside_the_task(j), 'TASKNAME': dynamic_util.cl_task_name(j), 'UNIQUEJOBID': dynamic_util.cl_unique_job_id(j),
'EXECUTION_BACKEND': self.dynamic_util.cl_execution_backend(j), 'OWNERDN': self.dynamic_util.cl_ownerdn(), 'JOB_ID_INSIDE_THE_TASK': self.dynamic_util.cl_job_id_inside_the_task(j), 'TASKNAME': self.dynamic_util.cl_task_name(j), 'UNIQUEJOBID': self.dynamic_util.cl_unique_job_id(j),
def getJobInfo(self): """Create job_info from Job object.""" j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() ji = { 'fqid': j.fqid, 'EXECUTION_BACKEND': dynamic_util.cl_execution_backend(j), 'OWNERDN': dynamic_util.cl_ownerdn(), 'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job...
exec self.importDynamicUtil() message = self._cl_job_status_message(dynamic_util.cl_grid_status(j), 'LB', None) message['GRIDEXITCODE'] = dynamic_util.cl_grid_exit_code(j) message['GRIDEXITREASON'] = dynamic_util.cl_grid_exit_reason(j)
message = self._cl_job_status_message(self.dynamic_util.cl_grid_status(j), 'LB', None) message['GRIDEXITCODE'] = self.dynamic_util.cl_grid_exit_code(j) message['GRIDEXITREASON'] = self.dynamic_util.cl_grid_exit_reason(j)
def complete(self, **opts): """Log complete event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'complete %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log('debug', 'Not sending unwanted message on complete for master wrapper job %s.' % j.fqid) return ...
exec self.importDynamicUtil() message = self._cl_job_status_message(dynamic_util.cl_grid_status(j), 'LB', None) message['GRIDEXITCODE'] = dynamic_util.cl_grid_exit_code(j) message['GRIDEXITREASON'] = dynamic_util.cl_grid_exit_reason(j)
message = self._cl_job_status_message(self.dynamic_util.cl_grid_status(j), 'LB', None) message['GRIDEXITCODE'] = self.dynamic_util.cl_grid_exit_code(j) message['GRIDEXITREASON'] = self.dynamic_util.cl_grid_exit_reason(j)
def fail(self, **opts): """Log fail event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'fail %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log('debug', 'Not sending unwanted message on fail for master wrapper job %s.' % j.fqid) return # send LB Done o...
exec self.importDynamicUtil()
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
'DESTCE': dynamic_util.cl_dest_ce(j),
'DESTCE': self.dynamic_util.cl_dest_ce(j),
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
'EXECUTION_BACKEND': dynamic_util.cl_execution_backend(j),
'EXECUTION_BACKEND': self.dynamic_util.cl_execution_backend(j),
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
'GRIDJOBID': dynamic_util.cl_grid_job_id(j),
'GRIDJOBID': self.dynamic_util.cl_grid_job_id(j),
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
'JOB_ID_INSIDE_THE_TASK': dynamic_util.cl_job_id_inside_the_task(j), 'OWNERDN': dynamic_util.cl_ownerdn(),
'JOB_ID_INSIDE_THE_TASK': self.dynamic_util.cl_job_id_inside_the_task(j), 'OWNERDN': self.dynamic_util.cl_ownerdn(),
def _cl_job_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
'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_status_message(self, status, status_source, status_start_time=None): # Not null: EXECUTION_BACKEND, GRIDJOBID, JOB_ID_INSIDE_THE_TASK, TASKNAME, UNIQUEJOBID j = self.job_info # called on client, so job_info is Job object exec self.importDynamicUtil() msg = { 'DESTCE': dynamic_util.cl_dest_ce(j), # Actual CE...
if job.application._name != 'TagPrepare' and job.application.atlas_dbrelease:
if hasattr(job.application,"atlas_dbrelease") and job.application.atlas_dbrelease:
def split(self,job):
if not filename in input_files:
if filename and not filename in input_files:
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...
input_files = athinfo['files']['read'].split(',')
dum = athinfo['files']['read'] if dum: input_files = dum.split(',')
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...
else: lfn = longfilename
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...
status,out = Client.runBrokerage([Client.convertDQ2toPandaID(x) for x in sites.split(':')],tag,verbose=False,trustIS=config['trustIS'],processingType=config['processingType'])
status,out = Client.runBrokerage(pandaSites,tag,verbose=False,trustIS=config['trustIS'],processingType=config['processingType'])
def selectPandaSite(job,sites): from pandatools import Client tag = '' try: if job.application.atlas_production=='': tag = 'Atlas-%s' % job.application.atlas_release else: tag = '%s-%s' % (job.application.atlas_project,job.application.atlas_production) except: # application is probably AthenaMC try: if len(job.applicat...
numberoffiles = datasetsiteinfo[0]['found'] locations_num[location]=int(numberoffiles) guidsSite = datasetsiteinfo[0]['content'] for guid in guidsDataset: if guid in guidsSite: temp = guidLocation[guid] temp.append(location) guidLocation[guid] = temp
if datasetsiteinfo[0]['found'] != None: numberoffiles = datasetsiteinfo[0]['found'] locations_num[location]=int(numberoffiles) guidsSite = datasetsiteinfo[0]['content'] for guid in guidsDataset: if guid in guidsSite: temp = guidLocation[guid] temp.append(location) guidLocation[guid] = temp else: logger.warning('cannot...
def dq2_list_locations_siteindex(datasets=[], timeout=15, days=2, replicaList=False, allowed_sites = [] ): if datasets.__class__.__name__=='str': datasets = [ datasets ] dataset_locations_list = { } dataset_guid_location_list = {} guidLocation = {} for dataset in datasets: try: dq2_lock.acquire() try: locations = dq...
return 'baclend_CE'
return 'backend_CE'
def cl_target(job): return 'baclend_CE' """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.st...
if job._getRoot().splitter and job._getRoot().inputdata._name == 'EventPicking' :
if job._getRoot().splitter and job._getRoot().inputdata and job._getRoot().inputdata._name == 'EventPicking' :
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): """prepare the subjob specific configuration"""
self.logger.error('Failed to source %s (Error was "%s"). Check your file for syntax errors.', fileName, str(e))
self.logger.error('Failed to source %s (Error was "%s"). Check your file for syntax errors.', fileName, str(x))
def override_credits(): credits._Printer__data += '\n\nGanga: The Ganga Developers (http://cern.ch/ganga)\n' copyright._Printer__data += '\n\nCopyright (c) 2000-2008 The Ganga Developers (http://cern.ch/ganga)\n'
"Does loosing this job worry you?"]],
"Does losing this job worry you?"]],
def respond(self,str): # find a match among keys for i in range(0,len(self.keys)): match = self.keys[i].match(str) if match: # found a match ... stuff with corresponding value # chosen randomly from among the available options resp = random.choice(self.values[i]) # we've got a response... stuff in reflected text where ...
"Are you afraid, like Gaudi, of not completeing your work?",
"Are you afraid, like Gaudi, of not completing your work?",
def respond(self,str): # find a match among keys for i in range(0,len(self.keys)): match = self.keys[i].match(str) if match: # found a match ... stuff with corresponding value # chosen randomly from among the available options resp = random.choice(self.values[i]) # we've got a response... stuff in reflected text where ...
env_str = ""
def master_prepare(self,app,appconfig): '''Prepare the master job'''
allHandlers.add('Athena','Panda',AthenaPandaRTHandler)
for app in ['Athena', 'ExecutableDQ2', 'RootDQ2']: allHandlers.add(app,'Panda',AthenaPandaRTHandler)
def prepare(self,app,appsubconfig,appmasterconfig,jobmasterconfig): '''prepare the subjob specific configuration'''
local_libds_nobuild = False
local_libds_nobuild = not app.athena_compile
def master_prepare(self,app,appconfig): '''Prepare the master job'''
rd = os.path.abspath(self.rundirectory) if rd in path: fn = fname[len(rd)+1:] path = rd
ua = os.path.abspath(self.userarea) if ua in path: fn = fname[len(ua)+1:] path = ua
def master_prepare(self,app,appconfig): '''Prepare the master job'''
re_osb = re.compile('^.*OutputSandbox\s+\=\s+\{(.*)\}$')
re_osb = re.compile('^.*OutputSandbox\s+\=\s+\{(.*)\}\s?\]?$')
def __cream_resolveOSBList__(job, jdl): osbURIList = [] re_osb = re.compile('^.*OutputSandbox\s+\=\s+\{(.*)\}$') for l in jdl.split(';'): m = re_osb.match( l ) if m: osb = m.group(1) osb = re.sub(r'\s?\"\s?', '', osb) for f in osb.split(','): if not urlparse(f)[0]: osbURIList.append('%s/%s' % ( job.backend.osbURI, ...
logger.debug('load default LCGSandboxCAche')
logger.debug('load default SandboxCache')
def __init__(self): super(CREAM, self).__init__()
userInfoDirName = userInfoDirName + now.strftime("%Y-%m-%d %H:%M:%S")
userInfoDirName = userInfoDirName + now.strftime("%Y-%m-%d|%H:%M:%S")
def renameDataFiles(directory):
resultArchive = '%s.tag.gz' % folderToArchive
resultArchive = '%s.tar.gz' % folderToArchive
def renameDataFiles(directory):
return resultArchive
return (resultArchive, uploadFileServer)
def renameDataFiles(directory):
resultArchive = report_inner(job) print 'You can find your user report here : ' + resultArchive
resultArchive, uploadFileServer = report_inner(job) run_upload(server=uploadFileServer, path=resultArchive) print 'Error report sent to the server'
def renameDataFiles(directory):
elif app.atlas_rel>= "14.0.0" :
elif app.atlas_rel>= "14.0.0" and app.atlas_rel<= "15.6.1":
def master_prepare(self,app,appmasterconfig): if app.siteroot: os.environ["SITEROOT"]=app.siteroot os.environ["CMTSITE"]=app.cmtsite
raise Error('cannot upack tarball with InputSandbox')
raise Exception('cannot upack tarball %s with InputSandbox'%tgzfile)
def getPackedInputSandbox(tarpath,dest_dir='.'): """Get all sandbox_files from tarball and write them to the workdir. This function is called by wrapper script at the run time. Arguments: 'tarpath': a path to the tarball 'dest_dir': a destination directory """ #tgzfile = os.path.join(src_dir,INPUT_TARBALL_NAME) tgzfil...
os.system("tar chf - -C %s . | tar xf - -C %s" %(src_dir,dest_dir))
cmd = "tar chf - -C %s . | tar xf - -C %s" %(src_dir,dest_dir) if 0 != os.system(cmd) raise Exception("getInputSandbox() failed to execute command: %s"%cmd)
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 """ os.system("tar chf - -C %s . | tar ...
filename = os.path.join(tmpDir,'install.sh' )
filename = os.path.join(archiveDir,'install.sh' )
def files_lcg_ng(self): """Add install.sh and requirements to inputsandbox needed on LGC/NG backend"""
filename = os.path.join(tmpDir,'requirements' )
filename = os.path.join(archiveDir,'requirements' )
def files_lcg_ng(self): """Add install.sh and requirements to inputsandbox needed on LGC/NG backend"""
extraFilesPath.append(os.path.join(tmpDir, ifile))
extraFilesPath.append(os.path.join(archiveDir, ifile))
def files_lcg_ng(self): """Add install.sh and requirements to inputsandbox needed on LGC/NG backend"""
usrhex = m.hexdigest()
usrhex = md.hexdigest()
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...
tmpSites = []
def runPandaBrokerage(job): from pandatools import Client # get locations when site==AUTO if job.backend.site == "AUTO": libdslocation = [] if job.backend.libds: try: libdslocation = Client.getLocations(job.backend.libds,[],job.backend.requirements.cloud,False,False) except exceptions.SystemExit: raise BackendError('P...
if job.jobStatus == 'failed':
if job.jobStatus in ['failed', 'killed']:
def master_resubmit(self,jobs): '''Resubmit failed subjobs''' from pandatools import Client
_cloudNameList = { 'TO' : 'CERN',
_cloudNameList = { 'T0' : 'CERN',
def getReleaseBlacklistInfo(): """List release blacklist""" _refreshCESEInfo() if CESEInfo['blacklist_release_info']: return CESEInfo['blacklist_release_info'] else: return []
raise BackendError('LCG','Job cannot be submitted as unknown OS %s has been requested.',self.os)
raise BackendError('LCG','Job cannot be submitted as unknown OS %s has been requested.'%self.os)
def convert(self): '''Convert the condition in a JDL specification''' requirements = super(AtlasLCGRequirements,self).convert()
return getSites(cloud)
sites = getSites(cloud) if sites: return sites raise BackendError('LCG','Could not find any sites for selected cloud %s. Allowed clouds: %s'%(cloud,self._cloudNameList.keys()))
def list_sites_cloud(self, cloudName=''):
self.sandboxcache.middleware = self.middleware.upper()
self.sandboxcache.middleware = 'GLITE'
def __setup_sandboxcache__(self, job): '''Sets up the sandbox cache object to adopt the runtime configuration of the LCG backend'''
inputs = {'remote':{},'local':[]}
def preparejob(self,jobconfig,master_job_sandbox): '''Prepare the JDL'''