示例#1
0
    def __init__(self, parameters=None):
        """Standard constructor"""
        super(StompMQConnector, self).__init__(parameters=parameters)
        self.connection = None

        if "DIRAC_DEBUG_STOMP" in os.environ:
            gLogger.enableLogsFromExternalLibs()
示例#2
0
    def __init__(self, parameters=None):
        """ Standard constructor
    """
        super(StompMQConnector, self).__init__()
        self.log = gLogger.getSubLogger(self.__class__.__name__)
        self.connections = {}

        if 'DIRAC_DEBUG_STOMP' in os.environ:
            gLogger.enableLogsFromExternalLibs()
示例#3
0
def main():
    Script.registerSwitch("N:", "NumberOfProcessors=", "Run n parallel copies of the benchmark")
    Script.registerSwitch("U", "Update", "Update dirac.cfg with the resulting value")
    Script.registerSwitch("R:", "Reconfig=", "Update given configuration file with the resulting value")
    Script.parseCommandLine(ignoreErrors=True)

    update = False
    configFile = None
    numberOfProcessors = 0

    for unprocSw in Script.getUnprocessedSwitches():
        if unprocSw[0] in ("U", "Update"):
            update = True
        elif unprocSw[0] in ("R", "Reconfig"):
            configFile = unprocSw[1]
        elif unprocSw[0] in ("N", "NumberOfProcessors"):
            try:
                numberOfProcessors = int(unprocSw[1])
            except ValueError:
                gLogger.warn("Cannot make benchmark measurements: NumberOfProcessors is not a number")

    # if numberOfProcessors has not been provided, try to get it from the configuration
    if not numberOfProcessors:
        numberOfProcessors = gConfig.getValue("/Resources/Computing/CEDefaults/NumberOfProcessors", 1)

    gLogger.info("Computing benchmark measurements on", "%d processor(s)..." % numberOfProcessors)

    # we want to get the logs coming from db12
    gLogger.enableLogsFromExternalLibs()

    # multiprocessor allocations generally have a CPU Power lower than single core one.
    # in order to avoid having wrong estimations, we run multiple copies of the benchmark simultaneously
    result = multiple_dirac_benchmark(numberOfProcessors)

    if result is None:
        gLogger.error("Cannot make benchmark measurements")
        DIRAC.exit(1)

    # we take a conservative approach and use the minimum value returned as the CPU Power
    db12Result = min(result["raw"])
    # because hardware is continuously evolving, original benchmark scores might need a correction
    corr = Operations().getValue("JobScheduling/CPUNormalizationCorrection", 1.0)

    gLogger.info("Applying a correction on the CPU power:", corr)
    cpuPower = round(db12Result / corr, 1)

    gLogger.notice("Estimated CPU power is %.1f HS06" % cpuPower)

    if update:
        gConfig.setOptionValue("/LocalSite/CPUNormalizationFactor", cpuPower)

        if configFile:
            gConfig.dumpLocalCFGToFile(configFile)
        else:
            gConfig.dumpLocalCFGToFile(gConfig.diracConfigFilePath)

    DIRAC.exit()
示例#4
0
  def __init__(self, parameters={}):
    """ Standard constructor
    """
    super(StompMQConnector, self).__init__()
    self.log = gLogger.getSubLogger(self.__class__.__name__)
    self.parameters = parameters.copy()
    self.connections = {}

    if 'DIRAC_DEBUG_STOMP' in os.environ:
      gLogger.enableLogsFromExternalLibs()
示例#5
0
    def __init__(self, parameters={}):
        """ Standard constructor
    """
        super(StompMQConnector, self).__init__()
        self.log = gLogger.getSubLogger(self.__class__.__name__)
        self.parameters = parameters.copy()
        self.connections = {}

        if self.log.getLevel() == 'DEBUG':
            gLogger.enableLogsFromExternalLibs()
示例#6
0
  def createClient( self ):
    """
    This method only can be called after the initialisation of this class. In this 
    method, it will initial some variables and create a soap client for communication 
    with BOINC server.
    """

    if not self.wsdl:
      self.wsdl = self.ceParameters['projectURL']
    if not self.suffix:
      result = urlparse(self.wsdl)
      self.suffix = result.hostname
    if not self.BOINCClient:
      try:
        from suds.client import Client
        if self.log.getLevel() == 'DEBUG':
          gLogger.enableLogsFromExternalLibs()
        self.BOINCClient = Client(self.wsdl)
      except Exception,x:
        self.log.error( 'Creation of the soap client failed', '%s' % str( x ) )
        pass
示例#7
0
    def createClient(self):
        """
    This method only can be called after the initialisation of this class. In this 
    method, it will initial some variables and create a soap client for communication 
    with BOINC server.
    """

        if not self.wsdl:
            self.wsdl = self.ceParameters['projectURL']
        if not self.suffix:
            result = urlparse(self.wsdl)
            self.suffix = result.hostname
        if not self.BOINCClient:
            try:
                from suds.client import Client
                if self.log.getLevel() == 'DEBUG':
                    gLogger.enableLogsFromExternalLibs()
                self.BOINCClient = Client(self.wsdl)
            except Exception, x:
                self.log.error('Creation of the soap client failed',
                               '%s' % str(x))
                pass