예제 #1
0
def initializeResourceManagementHandler(serviceInfo):
  """
    Handler initialization, where we:
      dynamically load ResourceManagement database plugin module, as advised by the config,
      (assumes that the module name and a class name are the same)
      set the ResourceManagementDB as global db.

      :param _serviceInfo: service info dictionary
      :return: standard Dirac return object
  """

  gLogger.debug("ServiceInfo", serviceInfo)
  gLogger.debug("Initializing ResourceManagement Service with the following DB component:")
  defaultOption, defaultClass = 'ResourceManagementDB', 'ResourceManagementDB'
  configValue = getServiceOption(serviceInfo, defaultOption, defaultClass)
  gLogger.debug("Option:%-20s Class:%-20s" % (str(defaultOption), str(configValue)))
  result = loadResourceStatusComponent(configValue, configValue)

  if not result['OK']:
    return result

  global db

  db = result['Value']
  syncObject = Synchronizer.Synchronizer()
  gConfig.addListenerToNewVersionEvent(syncObject.sync)

  return S_OK()
예제 #2
0
def initializeResourceStatusHandler( _serviceInfo ):
  '''
    Handler initialization, where we set the ResourceStatusDB as global db, and
    we instantiate the synchronizer.
  '''
  global db
  db = ResourceStatusDB()

# Publisher is on boxes right now
#
#  rmDB = ResourceStatusDB()
#  cc = CommandCaller()
#  global VOExtension
#  VOExtension = getExt()
#  ig = InfoGetter( VOExtension )
#  WMSAdmin = RPCClient( "WorkloadStatus/WMSAdministrator" )
#  global publisher
#  publisher = Publisher( VOExtension, dbIn = db, commandCallerIn = cc,
#                         infoGetterIn = ig, WMSAdminIn = WMSAdmin )

  syncModule = Utils.voimport( 'DIRAC.ResourceStatusSystem.Utilities.Synchronizer' )
  syncObject = syncModule.Synchronizer()
  gConfig.addListenerToNewVersionEvent( syncObject.sync )
  
  return S_OK()
예제 #3
0
def initializeResourceManagementHandler(_serviceInfo):

    global rsDB
    rsDB = ResourceStatusDB()
    global rmDB
    rmDB = ResourceManagementDB()

    cc = CommandCaller()

    global VOExtension
    VOExtension = getExt()

    ig = InfoGetter(VOExtension)

    WMSAdmin = RPCClient("WorkloadManagement/WMSAdministrator")

    global publisher
    publisher = Publisher(VOExtension,
                          rsDBIn=rsDB,
                          commandCallerIn=cc,
                          infoGetterIn=ig,
                          WMSAdminIn=WMSAdmin)

    sync_O = Synchronizer(rsDBin=rsDB, rmDBin=rmDB)
    gConfig.addListenerToNewVersionEvent(sync_O.sync)

    return S_OK()
예제 #4
0
def initializeResourceStatusHandler(_serviceInfo):
    '''
    Handler initialization, where we set the ResourceStatusDB as global db, and
    we instantiate the synchronizer.
  '''
    global db
    db = ResourceStatusDB()

    # Publisher is on boxes right now
    #
    #  rmDB = ResourceStatusDB()
    #  cc = CommandCaller()
    #  global VOExtension
    #  VOExtension = getExt()
    #  ig = InfoGetter( VOExtension )
    #  WMSAdmin = RPCClient( "WorkloadStatus/WMSAdministrator" )
    #  global publisher
    #  publisher = Publisher( VOExtension, dbIn = db, commandCallerIn = cc,
    #                         infoGetterIn = ig, WMSAdminIn = WMSAdmin )

    syncModule = Utils.voimport(
        'DIRAC.ResourceStatusSystem.Utilities.Synchronizer')
    syncObject = syncModule.Synchronizer()
    gConfig.addListenerToNewVersionEvent(syncObject.sync)

    return S_OK()
예제 #5
0
def initializeResourceManagementHandler(_serviceInfo):
    '''
    Handler initialization, where we set the ResourceManagementDB as global db.
  '''

    global db
    db = ResourceManagementDB()

    syncObject = Synchronizer.Synchronizer()
    gConfig.addListenerToNewVersionEvent(syncObject.sync)

    return S_OK()
예제 #6
0
def initializeResourceManagementHandler( _serviceInfo ):
  '''
    Handler initialization, where we set the ResourceManagementDB as global db.
  '''
  
  global db
  db = ResourceManagementDB()

  syncObject = Synchronizer.Synchronizer()
  gConfig.addListenerToNewVersionEvent( syncObject.sync )

  return S_OK()
예제 #7
0
def initializeResourceManagementHandler(_serviceInfo):
    """
    Handler initialization, where we set the ResourceManagementDB as global db.
  """

    global db
    db = ResourceManagementDB()
    # Regenerates DB tables if needed
    db._checkTable()

    syncObject = Synchronizer.Synchronizer()
    gConfig.addListenerToNewVersionEvent(syncObject.sync)

    return S_OK()
예제 #8
0
def initializeResourceManagementIHEPHandler(_serviceInfo):
    '''
    Handler initialization, where we set the ResourceManagementDB as global db.
  '''

    global db
    db = ResourceManagementIHEPDB()
    # Regenerates DB tables if needed
    db._checkTable()

    syncObject = Synchronizer.Synchronizer()
    gConfig.addListenerToNewVersionEvent(syncObject.sync)

    return S_OK()
예제 #9
0
def initializeResourceStatusHandler( _serviceInfo ):
  '''
    Handler initialization, where we set the ResourceStatusDB as global db, and
    we instantiate the synchronizer.
  '''
  
  global db
  db = ResourceStatusDB()

  syncModule = Utils.voimport( 'DIRAC.ResourceStatusSystem.Utilities.Synchronizer' )
  syncObject = syncModule.Synchronizer()
  gConfig.addListenerToNewVersionEvent( syncObject.sync )
  
  return S_OK()
예제 #10
0
    def initializeHandler(cls, serviceInfoDict):
        """ Dynamically loads ResourceManagement database plugin module, as advised by the config,
       (assumes that the module name and a class name are the same)

       :param serviceInfoDict: service info dictionary
       :return: standard Dirac return object
    """
        defaultOption, defaultClass = 'ResourceManagementDB', 'ResourceManagementDB'
        configValue = getServiceOption(serviceInfoDict, defaultOption,
                                       defaultClass)
        result = loadResourceStatusComponent(configValue, configValue)

        if not result['OK']:
            return result

        cls.db = result['Value']
        syncObject = Synchronizer.Synchronizer()
        gConfig.addListenerToNewVersionEvent(syncObject.sync)

        return S_OK()
def initializeResourceManagementHandler( _serviceInfo ):

  global rsDB
  rsDB = ResourceStatusDB()
  global rmDB
  rmDB = ResourceManagementDB()

  cc = CommandCaller()

  global VOExtension
  VOExtension = getExt()

  ig = InfoGetter( VOExtension )

  WMSAdmin = RPCClient( "WorkloadManagement/WMSAdministrator" )

  global publisher
  publisher = Publisher( VOExtension, rsDBIn = rsDB, commandCallerIn = cc,
                         infoGetterIn = ig, WMSAdminIn = WMSAdmin )

  sync_O = Synchronizer(rsDBin=rsDB, rmDBin=rmDB)
  gConfig.addListenerToNewVersionEvent( sync_O.sync )

  return S_OK()
예제 #12
0
 def initializeHandler(cls, _serviceInfo):
     """Handler initialization"""
     syncObject = RabbitMQSynchronizer.RabbitMQSynchronizer()
     gConfig.addListenerToNewVersionEvent(syncObject.sync)
     return S_OK()
예제 #13
0
 def initializeHandler( cls ):
   """ Handler initialization
   """
   syncObject = RabbitMQSynchronizer.RabbitMQSynchronizer()
   gConfig.addListenerToNewVersionEvent( syncObject.sync )
   return S_OK()