Exemple #1
0
def __configurePilot(basepath, vo):
    """
    Configures the pilot.
    This method was created specifically for LHCb pilots, more info
    about othe VOs is needed to make it more general.
    """

    from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO, getSetup
    from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData

    vo = getVO()
    currentSetup = getSetup()
    masterCS = gConfigurationData.getMasterServer()

    os.system(
        "python " + basepath +
        "dirac-pilot.py -S %s -l %s -C %s -N ce.debug.ch -Q default -n DIRAC.JobDebugger.ch --pythonVersion=3 -dd"
        % (currentSetup, vo, masterCS))

    diracdir = os.path.expanduser("~") + os.path.sep
    try:
        os.rename(diracdir + ".dirac.cfg", diracdir + ".dirac.cfg.old")
    except OSError:
        pass
    shutil.copyfile(diracdir + "pilot.cfg", diracdir + ".dirac.cfg")
def __configurePilot(basepath, vo):
  """
  Configures the pilot.
  This method was created specifically for LHCb pilots, more info
  about othe VOs is needed to make it more general.
  """

  from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals    import getVO, getSetup
  from DIRAC.ConfigurationSystem.Client.ConfigurationData    import gConfigurationData
  

  
  vo = getVO()
  currentSetup = getSetup()
  masterCS = gConfigurationData.getMasterServer()

  os.system("python " + basepath + "dirac-pilot.py -S %s -l %s -C %s -N ce.debug.ch -Q default -n DIRAC.JobDebugger.ch -dd" %(currentSetup, vo, masterCS))
  
  dir = os.path.expanduser('~') + os.path.sep
  try:
    os.rename(dir + '.dirac.cfg', dir + '.dirac.cfg.old')
  except OSError:
    pass
  shutil.copyfile(dir + 'pilot.cfg', dir + '.dirac.cfg')
            module = \
                  str( rDict[ compType ][ system ][ component ][ 'Module' ] )
            record[ 'Component' ][ 'System' ] = system
            record[ 'Component' ][ 'Module' ] = module
            # Transform 'Services' into 'service', 'Agents' into 'agent' ...
            record[ 'Component' ][ 'Type' ] = compType.lower()[ :-1 ]
            record[ 'Host' ][ 'HostName' ] = host
            record[ 'Host' ][ 'CPU' ] = cpu
            record[ 'Installation' ][ 'Instance' ] = component
            record[ 'Installation' ][ 'InstallationTime' ] = datetime.utcnow()
            records.append( record )

  # Databases
  csClient = CSAPI()
  cfg = csClient.getCurrentCFG()[ 'Value' ]
  setup = getSetup()

  allDB = allDBResult[ 'Value' ]
  availableDB = availableDBResult[ 'Value' ]

  for db in allDB:
    # Check for DIRAC only databases
    if db in availableDB.keys() and db != 'InstalledComponentsDB':
      # Check for 'installed' databases
      isSection = cfg.isSection \
                    ( 'Systems/' + availableDB[ db ][ 'System' ] + '/' +
                      cfg.getOption( 'DIRAC/Setups/' + setup + '/' +
                      availableDB[ db ][ 'System' ] ) + '/Databases/' + db +
                     '/' )
      if isSection:
        record = { 'Installation': {}, 'Component': {}, 'Host': {} }