当前位置: 首页>>代码示例>>Python>>正文


Python CSGlobals.getVO方法代码示例

本文整理汇总了Python中DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals.getVO方法的典型用法代码示例。如果您正苦于以下问题:Python CSGlobals.getVO方法的具体用法?Python CSGlobals.getVO怎么用?Python CSGlobals.getVO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals的用法示例。


在下文中一共展示了CSGlobals.getVO方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getSearchPaths

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def __getSearchPaths( self ):
   paths = [ "/Operations/Defaults", "/Operations/%s" % self.__setup ]
   if not self.__vo:
     globalVO = CSGlobals.getVO()
     if not globalVO:
       return paths
     self.__vo = CSGlobals.getVO()
   paths.append( "/Operations/%s/Defaults" % self.__vo )
   paths.append( "/Operations/%s/%s" % ( self.__vo, self.__setup ) )
   return paths
开发者ID:SimonBidwell,项目名称:DIRAC,代码行数:12,代码来源:Operations.py

示例2: getOpsSection

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
    def getOpsSection():
      """
      Where is the shifters section?
      """
      vo = CSGlobals.getVO()
      setup = CSGlobals.getSetup()

      if vo:
        res = gConfig.getSections( '/Operations/%s/%s/Shifter' % (vo, setup) )
        if res['OK']:
          return S_OK( '/Operations/%s/%s/Shifter' % ( vo, setup ) )

        res = gConfig.getSections( '/Operations/%s/Defaults/Shifter' % vo )
        if res['OK']:
          return S_OK( '/Operations/%s/Defaults/Shifter' % vo )

      else:
        res = gConfig.getSections( '/Operations/%s/Shifter' % setup )
        if res['OK']:
          return S_OK( '/Operations/%s/Shifter' % setup )

        res = gConfig.getSections( '/Operations/Defaults/Shifter' )
        if res['OK']:
          return S_OK( '/Operations/Defaults/Shifter' )

      return S_ERROR( "No shifter section" )
开发者ID:JanEbbing,项目名称:DIRAC,代码行数:28,代码来源:CSAPI.py

示例3: __discoverSettings

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def __discoverSettings( self ):
   #Set the VO
   globalVO = CSGlobals.getVO()
   if globalVO:
     self.__vo = globalVO
   elif self.__uVO:
     self.__vo = self.__uVO
   else:
     self.__vo = Registry.getVOForGroup( self.__uGroup )
     if not self.__vo:
       self.__vo = None
开发者ID:graciani,项目名称:DIRAC,代码行数:13,代码来源:Resources.py

示例4: __discoverSettings

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def __discoverSettings( self ):
   #Set the VO
   globalVO = CSGlobals.getVO()
   if globalVO:
     self.__vo = globalVO
   elif self.__uVO:
     self.__vo = self.__uVO
   else:
     self.__vo = Registry.getVOForGroup( self.__uGroup )
     if not self.__vo:
       self.__vo = False
   #Set the setup
   self.__setup = False
   if self.__uSetup:
     self.__setup = self.__uSetup
   else:
     self.__setup = CSGlobals.getSetup()
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:19,代码来源:Operations.py

示例5: __discoverSettings

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def __discoverSettings( self ):
   #Set the VO
   globalVO = CSGlobals.getVO()
   if globalVO:
     self.__vo = globalVO
   elif self.__uVO:
     self.__vo = self.__uVO
   elif self.__uGroup:
     self.__vo = Registry.getVOForGroup( self.__uGroup )
     if not self.__vo:
       self.__vo = False
   else:
     result = getVOfromProxyGroup()
     if result['OK']:
       self.__vo = result['Value']    
   #Set the setup
   self.__setup = False
   if self.__uSetup:
     self.__setup = self.__uSetup
   else:
     self.__setup = CSGlobals.getSetup()
开发者ID:SimonBidwell,项目名称:DIRAC,代码行数:23,代码来源:Operations.py

示例6: generatePath

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def generatePath( self, option, vo = False, setup = False ):
   """
   Generate the CS path for an option
   if vo is not defined, the helper's vo will be used for multi VO installations
   if setup evaluates False (except None) -> The helpers setup will  be used
   if setup is defined -> whatever is defined will be used as setup
   if setup is None -> Defaults will be used
   """
   path = "/Operations"
   if not CSGlobals.getVO():
     if not vo:
       vo = self.__vo
     if vo:
       path += "/%s" % vo
   if not setup and setup != None:
     if not setup:
       setup = self.__setup
   if setup:
     path += "/%s" % setup
   else:
     path += "/Defaults" 
   return "%s/%s" % ( path, option )
开发者ID:SimonBidwell,项目名称:DIRAC,代码行数:24,代码来源:Operations.py

示例7: beginExecution

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
  def beginExecution( self ):

    self.gridEnv = self.am_getOption( "GridEnv", getGridEnv() )
    # The SiteDirector is for a particular user community
    self.vo = self.am_getOption( "VO", '' )
    if not self.vo:
      self.vo = self.am_getOption( "Community", '' )
    if not self.vo:
      self.vo = CSGlobals.getVO()
    # The SiteDirector is for a particular user group
    self.group = self.am_getOption( "Group", '' )
    # self.voGroups contain all the eligible user groups for pilots submutted by this SiteDirector
    self.voGroups = []

    # Choose the group for which pilots will be submitted. This is a hack until
    # we will be able to match pilots to VOs.
    if not self.group:
      if self.vo:
        result = Registry.getGroupsForVO( self.vo )
        if not result['OK']:
          return result
        for group in result['Value']:
          if 'NormalUser' in Registry.getPropertiesForGroup( group ):
            self.voGroups.append( group )
    else:
      self.voGroups = [ self.group ]

    result = findGenericPilotCredentials( vo = self.vo )
    if not result[ 'OK' ]:
      return result
    self.pilotDN, self.pilotGroup = result[ 'Value' ]
    self.pilotDN = self.am_getOption( "PilotDN", self.pilotDN )
    self.pilotGroup = self.am_getOption( "PilotGroup", self.pilotGroup )

    self.platforms = []
    self.sites = []
    self.defaultSubmitPools = ''
    if self.group:
      self.defaultSubmitPools = Registry.getGroupOption( self.group, 'SubmitPools', '' )
    elif self.vo:
      self.defaultSubmitPools = Registry.getVOOption( self.vo, 'SubmitPools', '' )

    self.pilot = self.am_getOption( 'PilotScript', DIRAC_PILOT )
    self.install = DIRAC_INSTALL
    self.extraModules = self.am_getOption( 'ExtraPilotModules', [] ) + DIRAC_MODULES
    self.workingDirectory = self.am_getOption( 'WorkDirectory' )
    self.maxQueueLength = self.am_getOption( 'MaxQueueLength', 86400 * 3 )
    self.pilotLogLevel = self.am_getOption( 'PilotLogLevel', 'INFO' )
    self.maxJobsInFillMode = self.am_getOption( 'MaxJobsInFillMode', self.maxJobsInFillMode )
    self.maxPilotsToSubmit = self.am_getOption( 'MaxPilotsToSubmit', self.maxPilotsToSubmit )
    self.pilotWaitingFlag = self.am_getOption( 'PilotWaitingFlag', True )
    self.pilotWaitingTime = self.am_getOption( 'MaxPilotWaitingTime', 3600 )
    self.failedQueueCycleFactor = self.am_getOption( 'FailedQueueCycleFactor', 10 )
    self.pilotStatusUpdateCycleFactor = self.am_getOption( 'PilotStatusUpdateCycleFactor', 10 ) 

    # Flags
    self.updateStatus = self.am_getOption( 'UpdatePilotStatus', True )
    self.getOutput = self.am_getOption( 'GetPilotOutput', True )
    self.sendAccounting = self.am_getOption( 'SendPilotAccounting', True )

    # Get the site description dictionary
    siteNames = None
    if not self.am_getOption( 'Site', 'Any' ).lower() == "any":
      siteNames = self.am_getOption( 'Site', [] )
      if not siteNames:
        siteNames = None
    ceTypes = None
    if not self.am_getOption( 'CETypes', 'Any' ).lower() == "any":
      ceTypes = self.am_getOption( 'CETypes', [] )
    ces = None
    if not self.am_getOption( 'CEs', 'Any' ).lower() == "any":
      ces = self.am_getOption( 'CEs', [] )
      if not ces:
        ces = None
    result = Resources.getQueues( community = self.vo,
                                  siteList = siteNames,
                                  ceList = ces,
                                  ceTypeList = ceTypes,
                                  mode = 'Direct' )
    if not result['OK']:
      return result
    resourceDict = result['Value']
    result = self.getQueues( resourceDict )
    if not result['OK']:
      return result

    #if not siteNames:
    #  siteName = gConfig.getValue( '/DIRAC/Site', 'Unknown' )
    #  if siteName == 'Unknown':
    #    return S_OK( 'No site specified for the SiteDirector' )
    #  else:
    #    siteNames = [siteName]
    #self.siteNames = siteNames

    if self.updateStatus:
      self.log.always( 'Pilot status update requested' )
    if self.getOutput:
      self.log.always( 'Pilot output retrieval requested' )
    if self.sendAccounting:
      self.log.always( 'Pilot accounting sending requested' )
#.........这里部分代码省略.........
开发者ID:Kiyoshi-Hayasaka,项目名称:DIRAC,代码行数:103,代码来源:SiteDirector.py

示例8: addShifter

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
  def addShifter( self, shifters = None ):
    """
    Adds or modify one or more shifters. Also, adds the shifter section in case this is not present.
    Shifter identities are used in several places, mostly for running agents

    shifters should be in the form {'ShifterRole':{'User':'aUserName', 'Group':'aDIRACGroup'}}

    :return: S_OK/S_ERROR
    """

    def getOpsSection():
      """
      Where is the shifters section?
      """
      vo = CSGlobals.getVO()
      setup = CSGlobals.getSetup()

      if vo:
        res = gConfig.getSections( '/Operations/%s/%s/Shifter' % (vo, setup) )
        if res['OK']:
          return S_OK( '/Operations/%s/%s/Shifter' % ( vo, setup ) )

        res = gConfig.getSections( '/Operations/%s/Defaults/Shifter' % vo )
        if res['OK']:
          return S_OK( '/Operations/%s/Defaults/Shifter' % vo )

      else:
        res = gConfig.getSections( '/Operations/%s/Shifter' % setup )
        if res['OK']:
          return S_OK( '/Operations/%s/Shifter' % setup )

        res = gConfig.getSections( '/Operations/Defaults/Shifter' )
        if res['OK']:
          return S_OK( '/Operations/Defaults/Shifter' )

      return S_ERROR( "No shifter section" )

    if shifters is None: shifters = {}
    if not self.__initialized['OK']:
      return self.__initialized

    # get current shifters
    opsH = Operations( )
    currentShifterRoles = opsH.getSections( 'Shifter' )
    if not currentShifterRoles['OK']:
      # we assume the shifter section is not present
      currentShifterRoles = []
    else:
      currentShifterRoles = currentShifterRoles['Value']
    currentShiftersDict = {}
    for currentShifterRole in currentShifterRoles:
      currentShifter = opsH.getOptionsDict( 'Shifter/%s' % currentShifterRole )
      if not currentShifter['OK']:
        return currentShifter
      currentShifter = currentShifter['Value']
      currentShiftersDict[currentShifterRole] = currentShifter

    # Removing from shifters what does not need to be changed
    for sRole in shifters:
      if sRole in currentShiftersDict:
        if currentShiftersDict[sRole] == shifters[sRole]:
          shifters.pop( sRole )

    # get shifters section to modify
    section = getOpsSection()

    # Is this section present?
    if not section['OK']:
      if section['Message'] == "No shifter section":
        gLogger.warn( section['Message'] )
        gLogger.info( "Adding shifter section" )
        vo = CSGlobals.getVO()
        if vo:
          section = '/Operations/%s/Defaults/Shifter' % vo
        else:
          section = '/Operations/Defaults/Shifter'
        res = self.__csMod.createSection( section )
        if not res:
          gLogger.error( "Section %s not created" % section )
          return S_ERROR( "Section %s not created" % section )
      else:
        gLogger.error( section['Message'] )
        return section
    else:
      section = section['Value']


    #add or modify shifters
    for shifter in shifters:
      self.__csMod.removeSection( section + '/' + shifter )
      self.__csMod.createSection( section + '/' + shifter )
      self.__csMod.createSection( section + '/' + shifter + '/' + 'User' )
      self.__csMod.createSection( section + '/' + shifter + '/' + 'Group' )
      self.__csMod.setOptionValue( section + '/' + shifter + '/' + 'User', shifters[shifter]['User'] )
      self.__csMod.setOptionValue( section + '/' + shifter + '/' + 'Group', shifters[shifter]['Group'] )

    self.__csModified = True
    return S_OK( True )
开发者ID:JanEbbing,项目名称:DIRAC,代码行数:100,代码来源:CSAPI.py

示例9: beginExecution

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
    def beginExecution(self):

        self.gridEnv = self.am_getOption("GridEnv", getGridEnv())
        # The SiteDirector is for a particular user community
        self.vo = self.am_getOption("Community", "")
        if not self.vo:
            self.vo = CSGlobals.getVO()
        # The SiteDirector is for a particular user group
        self.group = self.am_getOption("Group", "")
        # self.voGroups contain all the eligible user groups for pilots submutted by this SiteDirector
        self.voGroups = []

        # Choose the group for which pilots will be submitted. This is a hack until
        # we will be able to match pilots to VOs.
        if not self.group:
            if self.vo:
                result = Registry.getGroupsForVO(self.vo)
                if not result["OK"]:
                    return result
                for group in result["Value"]:
                    if "NormalUser" in Registry.getPropertiesForGroup(group):
                        self.voGroups.append(group)
        else:
            self.voGroups = [self.group]

        result = findGenericPilotCredentials(vo=self.vo)
        if not result["OK"]:
            return result
        self.pilotDN, self.pilotGroup = result["Value"]
        self.pilotDN = self.am_getOption("PilotDN", self.pilotDN)
        self.pilotGroup = self.am_getOption("PilotGroup", self.pilotGroup)

        self.platforms = []
        self.sites = []
        self.defaultSubmitPools = ""
        if self.group:
            self.defaultSubmitPools = Registry.getGroupOption(self.group, "SubmitPools", "")
        elif self.vo:
            self.defaultSubmitPools = Registry.getVOOption(self.vo, "SubmitPools", "")

        self.pilot = self.am_getOption("PilotScript", DIRAC_PILOT)
        self.install = DIRAC_INSTALL
        self.workingDirectory = self.am_getOption("WorkDirectory")
        self.maxQueueLength = self.am_getOption("MaxQueueLength", 86400 * 3)
        self.pilotLogLevel = self.am_getOption("PilotLogLevel", "INFO")
        self.maxJobsInFillMode = self.am_getOption("MaxJobsInFillMode", self.maxJobsInFillMode)
        self.maxPilotsToSubmit = self.am_getOption("MaxPilotsToSubmit", self.maxPilotsToSubmit)
        self.pilotWaitingFlag = self.am_getOption("PilotWaitingFlag", True)
        self.pilotWaitingTime = self.am_getOption("MaxPilotWaitingTime", 7200)

        # Flags
        self.updateStatus = self.am_getOption("UpdatePilotStatus", True)
        self.getOutput = self.am_getOption("GetPilotOutput", True)
        self.sendAccounting = self.am_getOption("SendPilotAccounting", True)

        # Get the site description dictionary
        siteNames = None
        if not self.am_getOption("Site", "Any").lower() == "any":
            siteNames = self.am_getOption("Site", [])
        ceTypes = None
        if not self.am_getOption("CETypes", "Any").lower() == "any":
            ceTypes = self.am_getOption("CETypes", [])
        ces = None
        if not self.am_getOption("CEs", "Any").lower() == "any":
            ces = self.am_getOption("CEs", [])
        result = Resources.getQueues(
            community=self.vo, siteList=siteNames, ceList=ces, ceTypeList=ceTypes, mode="Direct"
        )
        if not result["OK"]:
            return result
        resourceDict = result["Value"]
        result = self.getQueues(resourceDict)
        if not result["OK"]:
            return result

        # if not siteNames:
        #  siteName = gConfig.getValue( '/DIRAC/Site', 'Unknown' )
        #  if siteName == 'Unknown':
        #    return S_OK( 'No site specified for the SiteDirector' )
        #  else:
        #    siteNames = [siteName]
        # self.siteNames = siteNames

        if self.updateStatus:
            self.log.always("Pilot status update requested")
        if self.getOutput:
            self.log.always("Pilot output retrieval requested")
        if self.sendAccounting:
            self.log.always("Pilot accounting sending requested")

        self.log.always("Sites:", siteNames)
        self.log.always("CETypes:", ceTypes)
        self.log.always("CEs:", ces)
        self.log.always("PilotDN:", self.pilotDN)
        self.log.always("PilotGroup:", self.pilotGroup)
        self.log.always("MaxPilotsToSubmit:", self.maxPilotsToSubmit)
        self.log.always("MaxJobsInFillMode:", self.maxJobsInFillMode)

        self.localhost = socket.getfqdn()
        self.proxy = ""
#.........这里部分代码省略.........
开发者ID:sbel,项目名称:bes3-jinr,代码行数:103,代码来源:SiteDirector.py

示例10: __getVOPath

# 需要导入模块: from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals import getVO [as 别名]
 def __getVOPath( self ):
   if CSGlobals.getVO():
     return "/Operations"
   return "/Operations/%s" % self.__threadData.vo
开发者ID:caitriana,项目名称:DIRAC,代码行数:6,代码来源:Operations.py


注:本文中的DIRAC.ConfigurationSystem.Client.Helpers.CSGlobals.getVO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。