예제 #1
0
def synchronize():
    '''
    Given the element switch, adds rows to the <element>Status tables with Status
    `Unknown` and Reason `Synchronized`.
  '''
    global DEFAULT_STATUS
    synchronizer = Synchronizer.Synchronizer(defaultStatus=DEFAULT_STATUS)

    if switchDict['element'] in ('Site', 'all'):
        subLogger.info('Synchronizing Sites')
        res = synchronizer._syncSites()
        if not res['OK']:
            return res

    if switchDict['element'] in ('Resource', 'all'):
        subLogger.info('Synchronizing Resource')
        res = synchronizer._syncResources()
        if not res['OK']:
            return res

    if switchDict['element'] in ('Node', 'all'):
        subLogger.info('Synchronizing Nodes')
        res = synchronizer._syncNodes()
        if not res['OK']:
            return res

    return S_OK()
예제 #2
0
def synchronize():
    """
    Given the element switch, adds rows to the <element>Status tables with Status
    `Unknown` and Reason `Synchronized`.
    """
    global DEFAULT_STATUS

    from DIRAC.ResourceStatusSystem.Utilities import Synchronizer

    synchronizer = Synchronizer.Synchronizer(defaultStatus=DEFAULT_STATUS)

    if switchDict["element"] in ("Site", "all"):
        subLogger.info("Synchronizing Sites")
        res = synchronizer._syncSites()
        if not res["OK"]:
            return res

    if switchDict["element"] in ("Resource", "all"):
        subLogger.info("Synchronizing Resource")
        res = synchronizer._syncResources()
        if not res["OK"]:
            return res

    if switchDict["element"] in ("Node", "all"):
        subLogger.info("Synchronizing Nodes")
        res = synchronizer._syncNodes()
        if not res["OK"]:
            return res

    return S_OK()
예제 #3
0
def synchronize():
    '''
    Given the element switch, adds rows to the <element>Status tables with Status
    `Unknown` and Reason `Synchronized`.
  '''
    from DIRAC.ResourceStatusSystem.Utilities import Synchronizer

    synchronizer = Synchronizer.Synchronizer()

    if switchDict['element'] in ('Site', 'all'):
        subLogger.info('Synchronizing Sites')
        res = synchronizer._syncSites()
        if not res['OK']:
            return res

    if switchDict['element'] in ('Resource', 'all'):
        subLogger.info('Synchronizing Resource')
        res = synchronizer._syncResources()
        if not res['OK']:
            return res

    if switchDict['element'] in ('Node', 'all'):
        subLogger.info('Synchronizing Nodes')
        res = synchronizer._syncNodes()
        if not res['OK']:
            return res

    return S_OK()
예제 #4
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()
예제 #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 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()
예제 #7
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()