Beispiel #1
0
class JobsStats_Command(Command):
    def doCommand(self):
        """ 
    Return getJobStats from Jobs Client  
    
   :attr:`args`: 
     - args[0]: string: should be a ValidRes

     - args[1]: string: should be the name of the ValidRes

  returns:
    {
      'MeanProcessedJobs': X
    }
    """
        super(JobsStats_Command, self).doCommand()

        if self.client is None:
            from DIRAC.ResourceStatusSystem.Client.JobsClient import JobsClient
            self.client = JobsClient()

        try:
            res = self.client.getJobsStats(self.args[0], self.args[1],
                                           self.args[2])
        except:
            gLogger.exception("Exception when calling JobsClient for %s %s" %
                              (self.args[0], self.args[1]))
            return {'Result': 'Unknown'}

        return {'Result': res}

    doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__
Beispiel #2
0
class JobsStats_Command(Command):
  
  def doCommand(self):
    """ 
    Return getJobStats from Jobs Client  
    
   :attr:`args`: 
     - args[0]: string: should be a ValidRes

     - args[1]: string: should be the name of the ValidRes

  returns:
    {
      'MeanProcessedJobs': X
    }
    """
    super(JobsStats_Command, self).doCommand()
    
    if self.client is None:
      from DIRAC.ResourceStatusSystem.Client.JobsClient import JobsClient   
      self.client = JobsClient()
      
    try:
      res = self.client.getJobsStats(self.args[0], self.args[1], self.args[2])
    except:
      gLogger.exception("Exception when calling JobsClient for %s %s" %(self.args[0], self.args[1]))
      return {'Result':'Unknown'}
    
    return {'Result':res}

  doCommand.__doc__ = Command.doCommand.__doc__ + doCommand.__doc__