本文整理汇总了Python中DIRAC.ResourceStatusSystem.Client.ResourceManagementClient.ResourceManagementClient类的典型用法代码示例。如果您正苦于以下问题:Python ResourceManagementClient类的具体用法?Python ResourceManagementClient怎么用?Python ResourceManagementClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResourceManagementClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PilotsEffSimpleCached_Command
class PilotsEffSimpleCached_Command(Command):
def doCommand(self):
"""
Returns simple pilots efficiency
:attr:`args`:
- args[0]: string: should be a ValidRes
- args[1]: string should be the name of the ValidRes
returns:
{
'Result': 'Good'|'Fair'|'Poor'|'Idle'|'Bad'
}
"""
super(PilotsEffSimpleCached_Command, self).doCommand()
client = self.client
if client is None:
from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
self.client = ResourceStatusClient(timeout = self.timeout)
if self.args[0] in ('Service', 'Services'):
try:
name = self.client.getGeneralName(self.args[0], self.args[1], 'Site')[0]
except:
gLogger.error("PilotsEffSimpleCached_Command: can't get a general name for %s %s" %(self.args[0], self.args[1]))
return {'Result':'Unknown'}
granularity = 'Site'
elif self.args[0] in ('Site', 'Sites'):
name = self.args[1]
granularity = self.args[0]
else:
raise InvalidRes, where(self, self.doCommand)
try:
if client is None:
from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
self.client = ResourceManagementClient(timeout = self.timeout)
res = self.client.getCachedResult(name, 'PilotsEffSimpleEverySites', 'PE_S', 'NULL')
if res == None:
return {'Result':'Idle'}
if res == []:
return {'Result':'Idle'}
except:
gLogger.exception("Exception when calling ResourceManagementClient for %s %s" %(granularity, name))
return {'Result':'Unknown'}
return {'Result':res[0]}
doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
示例2: doCommand
def doCommand(self):
"""
Returns transfer quality as it is cached
:attr:`args`:
- args[0]: string: should be a ValidRes
- args[1]: string should be the name of the ValidRes
:returns:
{'Result': None | a float between 0.0 and 100.0}
"""
super(TransferQualityCached_Command, self).doCommand()
if self.client is None:
from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
self.client = ResourceManagementClient(timeout = self.timeout)
name = self.args[1]
try:
res = self.client.getCachedResult(name, 'TransferQualityEverySEs', 'TQ', 'NULL')
if res == []:
return {'Result':None}
except:
gLogger.exception("Exception when calling ResourceManagementClient for %s" %(name))
return {'Result':'Unknown'}
return {'Result':float(res[0])}
示例3: __init__
def __init__(self, granularity, name, status_type, pdp_decision, **kw):
ActionBase.__init__( self, granularity, name, status_type, pdp_decision, **kw )
try: self.rsClient = self.kw["Clients"][ 'ResourceStatusClient' ]
except KeyError: self.rsClient = ResourceStatusClient()
try: self.rmClient = self.kw["Clients"][ 'ResourceManagementClient' ]
except KeyError: self.rmClient = ResourceManagementClient()
示例4: TransferQualityFromCachedPlotCommand
class TransferQualityFromCachedPlotCommand(Command):
def __init__(self, args=None, clients=None):
super(TransferQualityFromCachedPlotCommand, self).__init__(args, clients)
if "ResourceManagementClient" in self.apis:
self.rmClient = self.apis["ResourceManagementClient"]
else:
self.rmClient = ResourceManagementClient()
def doCommand(self):
"""
Returns transfer quality from the plot cached in the accounting cache.
:attr:`args`:
- args[0]: string: should be a ValidElement
- args[1]: string should be the name of the ValidElement
:returns:
{'Result': None | a float between 0.0 and 100.0}
"""
if "name" not in self.args:
return S_ERROR("Name no specified")
name = self.args["name"]
if "plotType" not in self.args:
return S_ERROR("plotType no specified")
plotType = self.args["plotType"]
if "plotName" not in self.args:
return S_ERROR("plotName no specified")
plotName = self.args["plotName"]
meta = {"columns": "Result"}
results = self.rmClient.selectAccountingCache(name=name, plotType=plotType, plotName=plotName, meta=meta)
if not results["OK"]:
return results
results = results["Value"]
if results == []:
results = None
else:
# FIXME: remove the eval from here !!
results = eval(results[0][0])
num, den = 0, 0
se = results["data"].keys()[0]
num = num + len(results["data"][se])
den = den + sum(results["data"][se].values())
meanQuality = den / num
results = meanQuality
return S_OK(results)
示例5: __init__
def __init__( self, rsClient = None, rmClient = None ):
self.GOCDBClient = GOCDBClient()
self.rsClient = ResourceStatusClient() if rsClient == None else rsClient
self.rmClient = ResourceManagementClient() if rmClient == None else rmClient
self.synclist = [ 'Sites', 'Resources', 'StorageElements', 'Services', 'RegistryUsers' ]
示例6: __init__
def __init__( self, args = None, clients = None ):
super( SpaceTokenOccupancyCommand, self ).__init__( args, clients )
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例7: __init__
def __init__( self, args = None, clients = None ):
super( TransferQualityFromCachedPlotCommand, self ).__init__( args, clients )
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例8: __init__
def __init__(self, args=None, clients=None):
super(CachedPlotCommand, self).__init__(args, clients)
if "ResourceManagementClient" in self.apis:
self.rmClient = self.apis["ResourceManagementClient"]
else:
self.rmClient = ResourceManagementClient()
示例9: __init__
def __init__( self, name, decissionParams, enforcementResult, singlePolicyResults,
clients = None ):
super( LogPolicyResultAction, self ).__init__( name, decissionParams, enforcementResult,
singlePolicyResults, clients )
if clients is not None and 'ResourceManagementClient' in clients:
self.rmClient = clients[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例10: TransferQualityFromCachedPlot_Command
class TransferQualityFromCachedPlot_Command(Command):
def doCommand(self):
"""
Returns transfer quality from the plot cached in the accounting cache.
:attr:`args`:
- args[0]: string: should be a ValidRes
- args[1]: string should be the name of the ValidRes
:returns:
{'Result': None | a float between 0.0 and 100.0}
"""
super(TransferQualityFromCachedPlot_Command, self).doCommand()
if self.client is None:
from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
self.client = ResourceManagementClient(timeout = self.timeout)
granularity = self.args[0]
name = self.args[1]
plotType = self.args[2]
plotName = self.args[3]
try:
res = self.client.getCachedAccountingResult(name, plotType, plotName)
res = res[ 'Value' ]
if res == []:
return {'Result':None}
res = eval(res[0])
s = 0
n = 0
try:
SE = res['data'].keys()[0]
except IndexError:
return {'Result':None}
n = n + len(res['data'][SE])
s = s + sum(res['data'][SE].values())
meanQuality = s/n
except:
gLogger.exception("Exception when calling ResourcePolicyClient for %s" %(name))
return {'Result':'Unknown'}
return {'Result':meanQuality}
doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
示例11: __init__
def __init__(self, args=None, clients=None):
super(GGUSTicketsCommand, self).__init__(args, clients)
if "GGUSTicketsClient" in self.apis:
self.gClient = self.apis["GGUSTicketsClient"]
else:
self.gClient = GGUSTicketsClient()
if "ResourceManagementClient" in self.apis:
self.rmClient = self.apis["ResourceManagementClient"]
else:
self.rmClient = ResourceManagementClient()
示例12: __init__
def __init__( self, args = None, clients = None ):
super( DowntimeCommand, self ).__init__( args, clients )
if 'GOCDBClient' in self.apis:
self.gClient = self.apis[ 'GOCDBClient' ]
else:
self.gClient = GOCDBClient()
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例13: __init__
def __init__( self, args = None, clients = None ):
super( PilotCommand, self ).__init__( args, clients )
if 'WMSAdministrator' in self.apis:
self.wmsAdmin = self.apis[ 'WMSAdministrator' ]
else:
self.wmsAdmin = RPCClient( 'WorkloadManagement/WMSAdministrator' )
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例14: __init__
def __init__( self, args = None, clients = None ):
super( JobCommand, self ).__init__( args, clients )
if 'JobDB' in self.apis:
self.jobDB = self.apis[ 'JobDB' ]
else:
self.jobDB = JobDB()
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis[ 'ResourceManagementClient' ]
else:
self.rmClient = ResourceManagementClient()
示例15: __init__
def __init__(self, args=None, clients=None):
super(GOCDBSyncCommand, self).__init__(args, clients)
if 'GOCDBClient' in self.apis:
self.gClient = self.apis['GOCDBClient']
else:
self.gClient = GOCDBClient()
if 'ResourceManagementClient' in self.apis:
self.rmClient = self.apis['ResourceManagementClient']
else:
self.rmClient = ResourceManagementClient()
self.seenHostnames = set()