Example #1
0
    def export_deletePilots(cls, pilotIDs):

        if isinstance(pilotIDs, basestring):
            return PilotAgentsDB().deletePilot(pilotIDs)

        if isinstance(pilotIDs, (int, long)):
            pilotIDs = [
                pilotIDs,
            ]

        result = PilotAgentsDB().deletePilots(pilotIDs)
        if not result['OK']:
            return result
        if enablePilotsLogging:
            pilotIDs = result['Value']
            pilots = PilotAgentsDB().getPilotInfo(pilotID=pilotIDs)
            if not pilots['OK']:
                return pilots
            pilotRefs = []
            for pilot in pilots:
                pilotRefs.append(pilot['PilotJobReference'])
            result = PilotsLoggingDB().deletePilotsLogging(pilotRefs)
            if not result['OK']:
                return result

        return S_OK()
Example #2
0
    def initializeHandler(cls, serviceInfoDict):
        """ Initialization of DB objects
    """

        cls.pilotAgentsDB = PilotAgentsDB()

        cls.gPilotsLoggingDB = None
        enablePilotsLogging = Operations().getValue(
            '/Services/JobMonitoring/usePilotsLoggingFlag', False)
        if enablePilotsLogging:
            cls.gPilotsLoggingDB = PilotsLoggingDB()

        return S_OK()
Example #3
0
 def initializeHandler(cls, serviceInfoDict):
   """Initialization of Pilots Logging service
   """
   cls.consumersSet = set()
   cls.pilotsLoggingDB = PilotsLoggingDB()
   queue = cls.srv_getCSOption("PilotsLoggingQueue")
   # This is pretty awful hack. Somehow, for uknown reason, I cannot access CS with srv_getCSOption.
   # The only way is using full CS path, so I'm using it as a backup solution.
   if not queue:
     queue = gConfig.getValue(serviceInfoDict['serviceSectionPath'] + "/PilotsLoggingQueue")
   result = createConsumer(queue, callback=cls.consumingCallback)
   if result['OK']:
     cls.consumersSet.add(result['Value'])
   else:
     return result
   return S_OK()
Example #4
0
def initializeJobManagerHandler(serviceInfo):

    global gJobDB, gJobLoggingDB, gtaskQueueDB, enablePilotsLogging, gPilotAgentsDB, gPilotsLoggingDB
    gJobDB = JobDB()
    gJobLoggingDB = JobLoggingDB()
    gtaskQueueDB = TaskQueueDB()
    gPilotAgentsDB = PilotAgentsDB()

    # there is a problem with accessing CS with shorter paths, so full path is extracted from serviceInfo dict
    enablePilotsLogging = gConfig.getValue(
        serviceInfo['serviceSectionPath'].replace('JobManager',
                                                  'PilotsLogging') + '/Enable',
        'False').lower() in ('yes', 'true')

    if enablePilotsLogging:
        gPilotsLoggingDB = PilotsLoggingDB()
    return S_OK()
Example #5
0
def initializePilotManagerHandler(serviceInfo):
    """  PilotManagerHandler initialization
  """

    global pilotDB
    global pilotsLoggingDB
    global enablePilotsLogging

    # there is a problem with accessing CS with shorter paths, so full path is extracted from serviceInfo dict
    enablePilotsLogging = gConfig.getValue(
        serviceInfo['serviceSectionPath'].replace('Pilots', 'PilotsLogging') +
        '/Enable', 'False').lower() in ('yes', 'true')

    pilotDB = PilotAgentsDB()
    if enablePilotsLogging:
        pilotsLoggingDB = PilotsLoggingDB()
    return S_OK()
Example #6
0
    def initializeHandler(cls, serviceInfoDict):
        """ Initialization of DB objects and OptimizationMind
    """
        cls.jobDB = JobDB()
        cls.jobLoggingDB = JobLoggingDB()
        cls.taskQueueDB = TaskQueueDB()
        cls.pilotAgentsDB = PilotAgentsDB()

        cls.pilotsLoggingDB = None
        enablePilotsLogging = Operations().getValue(
            '/Services/JobMonitoring/usePilotsLoggingFlag', False)
        if enablePilotsLogging:
            cls.pilotsLoggingDB = PilotsLoggingDB()

        cls.msgClient = MessageClient("WorkloadManagement/OptimizationMind")
        cls.__connectToOptMind()
        gThreadScheduler.addPeriodicTask(60, cls.__connectToOptMind)
        return S_OK()
Example #7
0
    def export_clearPilots(cls, interval=30, aborted_interval=7):

        result = PilotAgentsDB().clearPilots(interval, aborted_interval)
        if not result['OK']:
            return result
        if enablePilotsLogging:
            pilotIDs = result['Value']
            pilots = PilotAgentsDB().getPilotInfo(pilotID=pilotIDs)
            if not pilots['OK']:
                return pilots
            pilotRefs = []
            for pilot in pilots:
                pilotRefs.append(pilot['PilotJobReference'])
            result = PilotsLoggingDB().deletePilotsLogging(pilotRefs)
            if not result['OK']:
                return result

        return S_OK()
Example #8
0
def initializeWMSAdministratorHandler(serviceInfo):
  """  WMS AdministratorService initialization
  """

  global jobDB
  global pilotDB
  global taskQueueDB
  global enablePilotsLogging

  # there is a problem with accessing CS with shorter paths, so full path is extracted from serviceInfo dict
  enablePilotsLogging = gConfig.getValue(
      serviceInfo['serviceSectionPath'].replace(
          'WMSAdministrator',
          'PilotsLogging') + '/Enable',
      'False').lower() in (
      'yes',
      'true')

  jobDB = JobDB()
  pilotDB = PilotAgentsDB()
  taskQueueDB = TaskQueueDB()
  if enablePilotsLogging:
    pilotsLoggingDB = PilotsLoggingDB()
  return S_OK()