def __init__(self, config, name): # Determine ROOT path from previous settings / environment / config file self._rootpath = config.get('root path', os.environ.get('ROOTSYS', ''), persistent=True, onChange=changeInitNeeded('sandbox')) if not self._rootpath: raise ConfigError( 'Either set environment variable "ROOTSYS" or set option "root path"!' ) utils.vprint('Using the following ROOT path: %s' % self._rootpath, -1) # Special handling for executables bundled with ROOT self._executable = config.get('executable', onChange=changeInitNeeded('sandbox')) exeFull = os.path.join(self._rootpath, 'bin', self._executable.lstrip('/')) self.builtIn = os.path.exists(exeFull) if self.builtIn: config.set('send executable', 'False') # store resolved built-in executable path? # Apply default handling from UserTask UserTask.__init__(self, config, name) self.updateErrorDict(utils.pathShare('gc-run.root.sh')) # Collect lib files needed by executable self.libFiles = []
def __init__(self, config, prefix = '', exeDefault = noDefault): initSandbox = changeInitNeeded('sandbox') self._executableSend = config.getBool('%s send executable' % prefix, True, onChange = initSandbox) if self._executableSend: self._executable = config.getPath('%s executable' % prefix, exeDefault, onChange = initSandbox) else: self._executable = config.get('%s executable' % prefix, exeDefault, onChange = initSandbox) self._arguments = config.get('%s arguments' % prefix, '', onChange = initSandbox)
def __init__(self, config, prefix="", exeDefault=noDefault): initSandbox = changeInitNeeded("sandbox") self._executableSend = config.getBool("%s send executable" % prefix, True, onChange=initSandbox) if self._executableSend: self._executable = config.getPath("%s executable" % prefix, exeDefault, onChange=initSandbox) else: self._executable = config.get("%s executable" % prefix, exeDefault, onChange=initSandbox) self._arguments = config.get("%s arguments" % prefix, "", onChange=initSandbox)
def __init__(self, config, name): NamedPlugin.__init__(self, config, name) initSandbox = changeInitNeeded('sandbox') self._varCheck = validNoVar(config) # Task requirements jobs_config = config.changeView(viewClass = 'TaggedConfigView', addSections = ['jobs'], addTags = [self]) # Move this into parameter manager? self.wallTime = jobs_config.getTime('wall time', onChange = None) self.cpuTime = jobs_config.getTime('cpu time', self.wallTime, onChange = None) self.cpus = jobs_config.getInt('cpus', 1, onChange = None) self.memory = jobs_config.getInt('memory', -1, onChange = None) self.nodeTimeout = jobs_config.getTime('node timeout', -1, onChange = initSandbox) # Compute / get task ID self.taskID = config.get('task id', 'GC' + md5_hex(str(time()))[:12], persistent = True) self.taskDate = config.get('task date', strftime('%Y-%m-%d'), persistent = True, onChange = initSandbox) self.taskConfigName = config.getConfigName() self._job_name_generator = config.getPlugin('job name generator', 'DefaultJobName', cls = JobNamePlugin, pargs = (self,)) # Storage setup storage_config = config.changeView(viewClass = 'TaggedConfigView', setClasses = None, setNames = None, addSections = ['storage'], addTags = [self]) self.taskVariables = { # Space limits 'SCRATCH_UL': storage_config.getInt('scratch space used', 5000, onChange = initSandbox), 'SCRATCH_LL': storage_config.getInt('scratch space left', 1, onChange = initSandbox), 'LANDINGZONE_UL': storage_config.getInt('landing zone space used', 100, onChange = initSandbox), 'LANDINGZONE_LL': storage_config.getInt('landing zone space left', 1, onChange = initSandbox), } storage_config.set('se output pattern', 'job_@GC_JOB_ID@_@X@') self.seMinSize = storage_config.getInt('se min size', -1, onChange = initSandbox) self.sbInputFiles = config.getPaths('input files', [], onChange = initSandbox) self.sbOutputFiles = config.getList('output files', [], onChange = initSandbox) self.gzipOut = config.getBool('gzip output', True, onChange = initSandbox) self._subst_files = config.getList('subst files', [], onChange = initSandbox) self.dependencies = lmap(str.lower, config.getList('depends', [], onChange = initSandbox)) # Get error messages from gc-run.lib comments self.errorDict = {} self.updateErrorDict(utils.pathShare('gc-run.lib')) # Init parameter source manager psrc_repository = {} self._setupJobParameters(config, psrc_repository) self._pfactory = config.getPlugin('internal parameter factory', 'BasicParameterFactory', cls = ParameterFactory, pargs = (psrc_repository,), tags = [self], inherit = True) self.source = config.getPlugin('parameter adapter', 'TrackedParameterAdapter', cls = ParameterAdapter, pargs = (self._pfactory.getSource(),))
def __init__(self, config, name): NamedPlugin.__init__(self, config, name) initSandbox = changeInitNeeded('sandbox') self._varCheck = validNoVar(config) # Task requirements jobs_config = config.changeView(viewClass = 'TaggedConfigView', addSections = ['jobs'], addTags = [self]) # Move this into parameter manager? self.wallTime = jobs_config.getTime('wall time', onChange = None) self.cpuTime = jobs_config.getTime('cpu time', self.wallTime, onChange = None) self.cpus = jobs_config.getInt('cpus', 1, onChange = None) self.memory = jobs_config.getInt('memory', -1, onChange = None) self.nodeTimeout = jobs_config.getTime('node timeout', -1, onChange = initSandbox) # Compute / get task ID self.taskID = config.get('task id', 'GC' + md5_hex(str(time()))[:12], persistent = True) self.taskDate = config.get('task date', strftime('%Y-%m-%d'), persistent = True, onChange = initSandbox) self.taskConfigName = config.getConfigName() self._job_name_generator = config.getPlugin('job name generator', 'DefaultJobName', cls = JobNamePlugin, pargs = (self,)) # Storage setup storage_config = config.changeView(viewClass = 'TaggedConfigView', setClasses = None, setNames = None, addSections = ['storage'], addTags = [self]) self.taskVariables = { # Space limits 'SCRATCH_UL': storage_config.getInt('scratch space used', 5000, onChange = initSandbox), 'SCRATCH_LL': storage_config.getInt('scratch space left', 1, onChange = initSandbox), 'LANDINGZONE_UL': storage_config.getInt('landing zone space used', 100, onChange = initSandbox), 'LANDINGZONE_LL': storage_config.getInt('landing zone space left', 1, onChange = initSandbox), } storage_config.set('se output pattern', 'job_@GC_JOB_ID@_@X@') self.seMinSize = storage_config.getInt('se min size', -1, onChange = initSandbox) self.sbInputFiles = config.getPaths('input files', [], onChange = initSandbox) self.sbOutputFiles = config.getList('output files', [], onChange = initSandbox) self.gzipOut = config.getBool('gzip output', True, onChange = initSandbox) self.substFiles = config.getList('subst files', [], onChange = initSandbox) self.dependencies = lmap(str.lower, config.getList('depends', [], onChange = initSandbox)) # Get error messages from gc-run.lib comments self.errorDict = {} self.updateErrorDict(utils.pathShare('gc-run.lib')) # Init parameter source manager self._setupJobParameters(config) self._pfactory = config.getPlugin('internal parameter factory', 'BasicParameterFactory', cls = ParameterFactory, tags = [self], inherit = True) self.source = config.getPlugin('parameter adapter', 'TrackedParameterAdapter', cls = ParameterAdapter, pargs = (self._pfactory.getSource(),))
def __init__(self, config, prefix='', exeDefault=noDefault): initSandbox = changeInitNeeded('sandbox') self._executableSend = config.getBool('%s send executable' % prefix, True, onChange=initSandbox) if self._executableSend: self._executable = config.getPath('%s executable' % prefix, exeDefault, onChange=initSandbox) else: self._executable = config.get('%s executable' % prefix, exeDefault, onChange=initSandbox) self._arguments = config.get('%s arguments' % prefix, '', onChange=initSandbox)
def __init__(self, config, name): NamedPlugin.__init__(self, config, name) initSandbox = changeInitNeeded('sandbox') # Task requirements configJobs = config.changeView(viewClass = TaggedConfigView, addSections = ['jobs'], addTags = [self]) # Move this into parameter manager? self.wallTime = configJobs.getTime('wall time', onChange = None) self.cpuTime = configJobs.getTime('cpu time', self.wallTime, onChange = None) self.cpus = configJobs.getInt('cpus', 1, onChange = None) self.memory = configJobs.getInt('memory', -1, onChange = None) self.nodeTimeout = configJobs.getTime('node timeout', -1, onChange = initSandbox) # Compute / get task ID self.taskID = config.get('task id', 'GC' + md5(str(time())).hexdigest()[:12], persistent = True) self.taskDate = config.get('task date', strftime('%Y-%m-%d'), persistent = True, onChange = initSandbox) self.taskConfigName = config.getConfigName() # Storage setup configStorage = config.changeView(viewClass = TaggedConfigView, setClasses = None, setNames = None, addSections = ['storage'], addTags = [self]) self.taskVariables = { # Space limits 'SCRATCH_UL': configStorage.getInt('scratch space used', 5000, onChange = initSandbox), 'SCRATCH_LL': configStorage.getInt('scratch space left', 1, onChange = initSandbox), 'LANDINGZONE_UL': configStorage.getInt('landing zone space used', 100, onChange = initSandbox), 'LANDINGZONE_LL': configStorage.getInt('landing zone space left', 1, onChange = initSandbox), } configStorage.set('se output pattern', 'job_@GC_JOB_ID@_@X@') self.seMinSize = configStorage.getInt('se min size', -1, onChange = initSandbox) self.sbInputFiles = config.getPaths('input files', [], onChange = initSandbox) self.sbOutputFiles = config.getList('output files', [], onChange = initSandbox) self.gzipOut = config.getBool('gzip output', True, onChange = initSandbox) self.substFiles = config.getList('subst files', [], onChange = initSandbox) self.dependencies = map(str.lower, config.getList('depends', [], onChange = initSandbox)) # Get error messages from gc-run.lib comments self.errorDict = dict(self.updateErrorDict(utils.pathShare('gc-run.lib'))) # Init parameter source manager pm = config.getPlugin('parameter factory', 'SimpleParameterFactory', cls = ParameterFactory, inherit = True).getInstance() configParam = config.changeView(viewClass = TaggedConfigView, addSections = ['parameters'], addTags = [self]) self.setupJobParameters(configParam, pm) self.source = pm.getSource(configParam)
def __init__(self, config, name): # Determine ROOT path from previous settings / environment / config file self._rootpath = config.get('root path', os.environ.get('ROOTSYS', ''), persistent = True, onChange = changeInitNeeded('sandbox')) if not self._rootpath: raise ConfigError('Either set environment variable "ROOTSYS" or set option "root path"!') utils.vprint('Using the following ROOT path: %s' % self._rootpath, -1) # Special handling for executables bundled with ROOT self._executable = config.get('executable', onChange = changeInitNeeded('sandbox')) exeFull = os.path.join(self._rootpath, 'bin', self._executable.lstrip('/')) self.builtIn = os.path.exists(exeFull) if self.builtIn: config.set('send executable', 'False') # store resolved built-in executable path? # Apply default handling from UserTask UserTask.__init__(self, config, name) self.updateErrorDict(utils.pathShare('gc-run.root.sh')) # Collect lib files needed by executable self.libFiles = []