def __init__(self, config, wmsName): WMS.__init__(self, config, wmsName) if self.wmsName != self.__class__.__name__.upper(): utils.vprint('Using batch system: %s (%s)' % (self.__class__.__name__, self.wmsName), -1) else: utils.vprint('Using batch system: %s' % self.wmsName, -1) self.errorLog = config.getWorkPath('error.tar') self._runlib = config.getWorkPath('gc-run.lib') if not os.path.exists(self._runlib): fp = SafeFile(self._runlib, 'w') content = SafeFile(utils.pathShare('gc-run.lib')).read() fp.write(content.replace('__GC_VERSION__', __import__('grid_control').__version__)) fp.close() self._outputPath = config.getWorkPath('output') utils.ensureDirExists(self._outputPath, 'output directory') self._failPath = config.getWorkPath('fail') # Initialise access token, broker and storage manager self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls = AccessToken, inherit = True, tags = [self]) # UI -> SE -> WN self.smSEIn = config.getPlugin('se input manager', 'SEStorageManager', cls = StorageManager, tags = [self], pargs = ('se', 'se input', 'SE_INPUT')) self.smSBIn = config.getPlugin('sb input manager', 'LocalSBStorageManager', cls = StorageManager, tags = [self], pargs = ('sandbox', 'sandbox', 'SB_INPUT')) # UI <- SE <- WN self.smSEOut = config.getPlugin('se output manager', 'SEStorageManager', cls = StorageManager, tags = [self], pargs = ('se', 'se output', 'SE_OUTPUT')) self.smSBOut = None self.fileNamesEnvironment = config.getBool("file names environment", True, onChange = None)
def __init__(self, configFiles): from gcSettings import Settings for configFile in configFiles: fp = SafeFile(configFile) try: utils.execWrapper(fp.read(), {'Settings': Settings}) finally: fp.close() DictConfigFiller.__init__(self, Settings.getConfigDict())
def __init__(self, config, name, checkExecutor, cancelExecutor): WMS.__init__(self, config, name) for executor in [checkExecutor, cancelExecutor]: executor.setup(self._log) (self._check_executor, self._cancel_executor) = (checkExecutor, cancelExecutor) if self._name != self.__class__.__name__.upper(): self._log.info('Using batch system: %s (%s)', self.__class__.__name__, self._name) else: self._log.info('Using batch system: %s', self._name) self.errorLog = config.getWorkPath('error.tar') self._runlib = config.getWorkPath('gc-run.lib') if not os.path.exists(self._runlib): fp = SafeFile(self._runlib, 'w') content = SafeFile(utils.pathShare('gc-run.lib')).read() fp.write( content.replace('__GC_VERSION__', __import__('grid_control').__version__)) fp.close() self._outputPath = config.getWorkPath('output') self._filecachePath = config.getWorkPath('files') utils.ensureDirExists(self._outputPath, 'output directory') self._failPath = config.getWorkPath('fail') # Initialise access token and storage managers # UI -> SE -> WN self.smSEIn = config.getPlugin('se input manager', 'SEStorageManager', cls=StorageManager, tags=[self], pargs=('se', 'se input', 'SE_INPUT')) self.smSBIn = config.getPlugin('sb input manager', 'LocalSBStorageManager', cls=StorageManager, tags=[self], pargs=('sandbox', 'sandbox', 'SB_INPUT')) # UI <- SE <- WN self.smSEOut = config.getPlugin('se output manager', 'SEStorageManager', cls=StorageManager, tags=[self], pargs=('se', 'se output', 'SE_OUTPUT')) self.smSBOut = None self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls=AccessToken, inherit=True, tags=[self])
def _logDisabledJobs(self): disabled = self.jobDB.getJobs(ClassSelector(JobClass.DISABLED)) try: fp = SafeFile(self._disabled_jobs_logfile, 'w') fp.write(str.join('\n', imap(str, disabled))) fp.close() except Exception: raise JobError('Could not write disabled jobs to file %s!' % self._disabled_jobs_logfile) if disabled: self._log_user_time.warning('There are %d disabled jobs in this task!', len(disabled)) self._log_user_time.debug('Please refer to %s for a complete list of disabled jobs.', self._disabled_jobs_logfile)
def __init__(self, config, wmsName): WMS.__init__(self, config, wmsName) if self.wmsName != self.__class__.__name__.upper(): utils.vprint( 'Using batch system: %s (%s)' % (self.__class__.__name__, self.wmsName), -1) else: utils.vprint('Using batch system: %s' % self.wmsName, -1) self.errorLog = config.getWorkPath('error.tar') self._runlib = config.getWorkPath('gc-run.lib') if not os.path.exists(self._runlib): fp = SafeFile(self._runlib, 'w') content = SafeFile(utils.pathShare('gc-run.lib')).read() fp.write( content.replace('__GC_VERSION__', __import__('grid_control').__version__)) fp.close() self._outputPath = config.getWorkPath('output') utils.ensureDirExists(self._outputPath, 'output directory') self._failPath = config.getWorkPath('fail') # Initialise access token, broker and storage manager self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls=AccessToken, inherit=True, tags=[self]) # UI -> SE -> WN self.smSEIn = config.getPlugin('se input manager', 'SEStorageManager', cls=StorageManager, tags=[self], pargs=('se', 'se input', 'SE_INPUT')) self.smSBIn = config.getPlugin('sb input manager', 'LocalSBStorageManager', cls=StorageManager, tags=[self], pargs=('sandbox', 'sandbox', 'SB_INPUT')) # UI <- SE <- WN self.smSEOut = config.getPlugin('se output manager', 'SEStorageManager', cls=StorageManager, tags=[self], pargs=('se', 'se output', 'SE_OUTPUT')) self.smSBOut = None self.fileNamesEnvironment = config.getBool("file names environment", True, onChange=None)
def _logDisabledJobs(self): disabled = self.jobDB.getJobs(ClassSelector(JobClass.DISABLED)) try: fp = SafeFile(self._disabled_jobs_logfile, 'w') fp.write(str.join('\n', imap(str, disabled))) fp.close() except Exception: raise JobError('Could not write disabled jobs to file %s!' % self._disabled_jobs_logfile) if disabled: self._log_user_time.warning( 'There are %d disabled jobs in this task!', len(disabled)) self._log_user_time.debug( 'Please refer to %s for a complete list of disabled jobs.', self._disabled_jobs_logfile)
def __init__(self, config, name, checkExecutor, cancelExecutor): WMS.__init__(self, config, name) for executor in [checkExecutor, cancelExecutor]: executor.setup(self._log) (self._check_executor, self._cancel_executor) = (checkExecutor, cancelExecutor) if self._name != self.__class__.__name__.upper(): self._log.info('Using batch system: %s (%s)', self.__class__.__name__, self._name) else: self._log.info('Using batch system: %s', self._name) self.errorLog = config.getWorkPath('error.tar') self._runlib = config.getWorkPath('gc-run.lib') if not os.path.exists(self._runlib): fp = SafeFile(self._runlib, 'w') content = SafeFile(utils.pathShare('gc-run.lib')).read() fp.write(content.replace('__GC_VERSION__', __import__('grid_control').__version__)) fp.close() self._outputPath = config.getWorkPath('output') self._filecachePath = config.getWorkPath('files') utils.ensureDirExists(self._outputPath, 'output directory') self._failPath = config.getWorkPath('fail') # Initialise access token and storage managers # UI -> SE -> WN self.smSEIn = config.getPlugin('se input manager', 'SEStorageManager', cls = StorageManager, tags = [self], pargs = ('se', 'se input', 'SE_INPUT')) self.smSBIn = config.getPlugin('sb input manager', 'LocalSBStorageManager', cls = StorageManager, tags = [self], pargs = ('sandbox', 'sandbox', 'SB_INPUT')) # UI <- SE <- WN self.smSEOut = config.getPlugin('se output manager', 'SEStorageManager', cls = StorageManager, tags = [self], pargs = ('se', 'se output', 'SE_OUTPUT')) self.smSBOut = None self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls = AccessToken, inherit = True, tags = [self])
def _write_file(self, fn, message = None, **kwargs): fp = SafeFile(fn, 'w') if message is not None: fp.write(message) self._view.write(fp, **kwargs) fp.close()
def _write_file(self, fn, message=None, **kwargs): fp = SafeFile(fn, 'w') if message is not None: fp.write(message) self._view.write(fp, **kwargs) fp.close()
def commit(self, jobNum, jobObj): fp = SafeFile(os.path.join(self._dbPath, 'job_%d.txt' % jobNum), 'w') fp.writelines(self._fmt.format(self._serialize_job_obj(jobObj))) fp.close() self._jobMap[jobNum] = jobObj
def commit(self, jobNum, jobObj): fp = SafeFile(os.path.join(self._dbPath, 'job_%d.txt' % jobNum), 'w') fp.writelines( utils.DictFormat(escapeString=True).format(jobObj.getAll())) fp.close()
def commit(self, jobNum, jobObj): fp = SafeFile(os.path.join(self._dbPath, 'job_%d.txt' % jobNum), 'w') fp.writelines(utils.DictFormat(escapeString = True).format(jobObj.getAll())) fp.close()