def __init__(self, config, name): WMS.__init__(self, config, name) self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls='AccessToken', inherit=True, tags=[self])
def __init__(self, config, name): WMS.__init__(self, config, name) self._token = config.get_composited_plugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls='AccessToken', bind_kwargs={ 'inherit': True, 'tags': [self] })
def _format_reqs(self, req_list, result): req_string_list = ['other.GlueHostNetworkAdapterOutboundIP'] for req_type, arg in req_list: if req_type == WMS.SOFTWARE: req_string_list.append( 'Member(%s, other.GlueHostApplicationSoftwareRunTimeEnvironment)' % self._escape(arg)) elif req_type == WMS.WALLTIME: if arg > 0: req_string_list.append( '(other.GlueCEPolicyMaxWallClockTime >= %d)' % int( (arg + 59) / 60)) elif req_type == WMS.CPUTIME: if arg > 0: req_string_list.append( '(other.GlueCEPolicyMaxCPUTime >= %d)' % int( (arg + 59) / 60)) elif req_type == WMS.MEMORY: if arg > 0: req_string_list.append( '(other.GlueHostMainMemoryRAMSize >= %d)' % arg) elif req_type == WMS.STORAGE: req_string_list.append(self._format_reqs_storage(arg)) elif req_type == WMS.SITES: req_string_list.append(self._format_reqs_sites(arg)) elif req_type == WMS.CPUS: pass # Handle number of cpus in makeJDL else: raise APIError('Unknown requirement type %r or argument %r' % (WMS.enum2str(req_type), arg)) result['Requirements'] = str.join(' && ', ifilter(identity, req_string_list))
def backend_list(finder_name): finder = Plugin.get_class('BackendDiscovery').create_instance(finder_name, gc_create_config()) item_dict_list = [] item_key_set = set() for item_dict in finder.discover(): nice_item_dict = {} for (key, value) in item_dict.items(): if isinstance(key, int): key = WMS.enum2str(key) nice_item_dict[key] = value item_key_set.add(key) item_dict_list.append(nice_item_dict) item_key_set.remove('name') item_key_list = sorted(item_key_set) ConsoleTable.create([('name', 'Name')] + lzip(item_key_list, item_key_list), item_dict_list)
def backend_list(finder_name): finder = Plugin.get_class('BackendDiscovery').create_instance( finder_name, gc_create_config()) item_dict_list = [] item_key_set = set() for item_dict in finder.discover(): nice_item_dict = {} for (key, value) in item_dict.items(): if isinstance(key, int): key = WMS.enum2str(key) nice_item_dict[key] = value item_key_set.add(key) item_dict_list.append(nice_item_dict) item_key_set.remove('name') item_key_list = sorted(item_key_set) ConsoleTable.create([('name', 'Name')] + lzip(item_key_list, item_key_list), item_dict_list)
def _format_reqs(self, req_list, result): req_string_list = ['other.GlueHostNetworkAdapterOutboundIP'] for req_type, arg in req_list: if req_type == WMS.SOFTWARE: req_string_list.append('Member(%s, other.GlueHostApplicationSoftwareRunTimeEnvironment)' % self._escape(arg)) elif req_type == WMS.WALLTIME: if arg > 0: req_string_list.append('(other.GlueCEPolicyMaxWallClockTime >= %d)' % int((arg + 59) / 60)) elif req_type == WMS.CPUTIME: if arg > 0: req_string_list.append('(other.GlueCEPolicyMaxCPUTime >= %d)' % int((arg + 59) / 60)) elif req_type == WMS.MEMORY: if arg > 0: req_string_list.append('(other.GlueHostMainMemoryRAMSize >= %d)' % arg) elif req_type == WMS.STORAGE: req_string_list.append(self._format_reqs_storage(arg)) elif req_type == WMS.SITES: req_string_list.append(self._format_reqs_sites(arg)) elif req_type == WMS.CPUS: pass # Handle number of cpus in makeJDL else: raise APIError('Unknown requirement type %r or argument %r' % (WMS.enum2str(req_type), arg)) result['Requirements'] = str.join(' && ', ifilter(identity, req_string_list))
def _format_reqs(self, req_list, result): req_string_list = ['other.GlueHostNetworkAdapterOutboundIP'] for req_type, arg in req_list: if req_type == WMS.SOFTWARE: software_template_str = 'Member(%s, other.GlueHostApplicationSoftwareRunTimeEnvironment)' req_string_list.append(software_template_str % self._escape(arg)) elif req_type == WMS.WALLTIME: if arg > 0: req_string_list.append('(other.GlueCEPolicyMaxWallClockTime >= %d)' % int((arg + 59) / 60)) elif req_type == WMS.CPUTIME: if arg > 0: req_string_list.append('(other.GlueCEPolicyMaxCPUTime >= %d)' % int((arg + 59) / 60)) elif req_type == WMS.MEMORY: if arg > 0: req_string_list.append('(other.GlueHostMainMemoryRAMSize >= %d)' % arg) elif req_type == WMS.STORAGE: req_string_list.append(self._format_reqs_storage(arg)) elif req_type == WMS.SITES: req_string_list.append(self._format_reqs_sites(arg)) elif req_type in (WMS.CPUS, WMS.DISKSPACE): pass # Handled outside of "requirement" directive or GlueCE attribute not available else: raise APIError('Unknown requirement type %r or argument %r' % (WMS.enum2str(req_type), arg)) result['Requirements'] = str.join(' && ', iidfilter(req_string_list))
def process(self, dn): return WMS.parseJobInfo(os.path.join(dn, 'job.info'))
def __init__(self, config, name): WMS.__init__(self, config, name) self._token = config.getCompositePlugin(['proxy', 'access token'], 'TrivialAccessToken', 'MultiAccessToken', cls = 'AccessToken', inherit = True, tags = [self])