class ResourceStats_Command(Command): """ The ResourceStats_Command class is a command class to know about present resources stats """ def doCommand(self): """ Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getResourceStats` :params: :attr:`args`: a tuple - `args[0]` string, a ValidRes. Should be in ('Site', 'Service') - `args[1]` should be the name of the Site or Service :returns: """ super(ResourceStats_Command, self).doCommand() if self.client is None: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient self.client = ResourceStatusClient(timeout=self.timeout) try: res = self.client.getResourceStats(self.args[0], self.args[1]) except: gLogger.exception("Exception when calling ResourceStatusClient for %s %s" % (self.args[0], self.args[1])) return {"Result": "Unknown"} return {"Result": res} doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
class ResourceStats_Command( Command ): """ The ResourceStats_Command class is a command class to know about present resources stats """ def doCommand( self ): """ Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getResourceStats` :params: :attr:`args`: a tuple - `args[0]` string, a ValidRes. Should be in ('Site', 'Service') - `args[1]` should be the name of the Site or Service :returns: """ super( ResourceStats_Command, self ).doCommand() if self.client is None: from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient self.client = ResourceStatusClient( timeout = self.timeout ) try: res = self.client.getResourceStats( self.args[0], self.args[1] )['Value'] except: gLogger.exception( "Exception when calling ResourceStatusClient for %s %s" % ( self.args[0], self.args[1] ) ) return {'Result':'Unknown'} return {'Result':res} doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
class ResourceStatsCommand(Command): """ The ResourceStats_Command class is a command class to know about present resources stats """ def __init__(self, args=None, clients=None): super(ResourceStatsCommand, self).__init__(args, clients) if 'ResourceStatusClient' in self.apis: self.rsClient = self.apis['ResourceStatusClient'] else: self.rsClient = ResourceStatusClient() def doCommand(self): """ Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getResourceStats` :params: :attr:`args`: a tuple - `args[0]` string, a ValidElement. Should be in ('Site', 'Service') - `args[1]` should be the name of the Site or Service :returns: """ # try: res = self.rsClient.getResourceStats(self.args[0], self.args[1], statusType=None) if not res['OK']: return self.returnERROR(res) # except Exception, e: # _msg = '%s (%s): %s' % ( self.__class__.__name__, self.args, e ) # gLogger.exception( _msg ) # return S_ERROR( _msg ) return res
class ResourceStatsCommand( Command ): """ The ResourceStats_Command class is a command class to know about present resources stats """ def __init__( self, args = None, clients = None ): super( ResourceStatsCommand, self ).__init__( args, clients ) if 'ResourceStatusClient' in self.apis: self.rsClient = self.apis[ 'ResourceStatusClient' ] else: self.rsClient = ResourceStatusClient() def doCommand( self ): """ Uses :meth:`DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.getResourceStats` :params: :attr:`args`: a tuple - `args[0]` string, a ValidElement. Should be in ('Site', 'Service') - `args[1]` should be the name of the Site or Service :returns: """ # try: res = self.rsClient.getResourceStats( self.args[0], self.args[1], statusType = None ) if not res[ 'OK' ]: return self.returnERROR( res ) # except Exception, e: # _msg = '%s (%s): %s' % ( self.__class__.__name__, self.args, e ) # gLogger.exception( _msg ) # return S_ERROR( _msg ) return res