Example #1
0
    def export_requestJob(self, resourceDescription):
        """Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
        """

        resourceDescription["Setup"] = self.serviceInfoDict["clientSetup"]
        credDict = self.getRemoteCredentials()
        pilotRef = resourceDescription.get("PilotReference", "Unknown")

        try:
            opsHelper = Operations(group=credDict["group"])
            matcher = Matcher(
                pilotAgentsDB=self.pilotAgentsDB,
                jobDB=self.jobDB,
                tqDB=self.taskQueueDB,
                jlDB=self.jobLoggingDB,
                opsHelper=opsHelper,
                pilotRef=pilotRef,
            )
            result = matcher.selectJob(resourceDescription, credDict)
        except RuntimeError as rte:
            self.log.error("Error requesting job for pilot",
                           "[%s] %s" % (pilotRef, rte))
            return S_ERROR("Error requesting job")
        except PilotVersionError as pve:
            self.log.warn("Pilot version error for pilot",
                          "[%s] %s" % (pilotRef, pve))
            return S_ERROR(DErrno.EWMSPLTVER, callStack=[])

        # result can be empty, meaning that no job matched
        if result:
            return S_OK(result)
        return S_ERROR(DErrno.EWMSNOMATCH, callStack=[])
Example #2
0
    def export_requestJob(self, resourceDescription):
        """ Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
    """

        resourceDescription['Setup'] = self.serviceInfoDict['clientSetup']
        credDict = self.getRemoteCredentials()

        try:
            opsHelper = Operations(group=credDict['group'])
            matcher = Matcher(pilotAgentsDB=pilotAgentsDB,
                              jobDB=gJobDB,
                              tqDB=gTaskQueueDB,
                              jlDB=jlDB,
                              opsHelper=opsHelper)
            result = matcher.selectJob(resourceDescription, credDict)
        except RuntimeError as rte:
            self.log.error("Error requesting job: ", rte)
            return S_ERROR("Error requesting job")

        # result can be empty, meaning that no job matched
        if result:
            gMonitor.addMark("matchesDone")
            gMonitor.addMark("matchesOK")
            return S_OK(result)
        # FIXME: This is correctly interpreted by the JobAgent, but DErrno should be used instead
        return S_ERROR("No match found")
Example #3
0
  def export_requestJob(self, resourceDescription):
    """ Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
    """

    resourceDescription['Setup'] = self.serviceInfoDict['clientSetup']
    credDict = self.getRemoteCredentials()

    try:
      opsHelper = Operations(group=credDict['group'])
      matcher = Matcher(pilotAgentsDB=pilotAgentsDB,
                        jobDB=gJobDB,
                        tqDB=gTaskQueueDB,
                        jlDB=jlDB,
                        opsHelper=opsHelper)
      result = matcher.selectJob(resourceDescription, credDict)
    except RuntimeError as rte:
      self.log.error("Error requesting job: ", rte)
      return S_ERROR("Error requesting job")

    # result can be empty, meaning that no job matched
    if result:
      gMonitor.addMark("matchesDone")
      gMonitor.addMark("matchesOK")
      return S_OK(result)
    # FIXME: This is correctly interpreted by the JobAgent, but DErrno should be used instead
    return S_ERROR("No match found")
Example #4
0
    def export_requestJob(self, resourceDescription):
        """ Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
    """

        resourceDescription['Setup'] = self.serviceInfoDict['clientSetup']
        credDict = self.getRemoteCredentials()

        try:
            opsHelper = Operations(group=credDict['group'])
            matcher = Matcher(pilotAgentsDB=pilotAgentsDB,
                              jobDB=gJobDB,
                              tqDB=gTaskQueueDB,
                              jlDB=jlDB,
                              opsHelper=opsHelper)
            result = matcher.selectJob(resourceDescription, credDict)
        except RuntimeError, rte:
            self.log.error("Error requesting job: ", rte)
            return S_ERROR("Error requesting job")
Example #5
0
  def export_requestJob( self, resourceDescription ):
    """ Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
    """

    resourceDescription['Setup'] = self.serviceInfoDict['clientSetup']
    credDict = self.getRemoteCredentials()

    try:
      opsHelper = Operations( group = credDict['group'] )
      matcher = Matcher( pilotAgentsDB = pilotAgentsDB,
                         jobDB = gJobDB,
                         tqDB = gTaskQueueDB,
                         jlDB = jlDB,
                         opsHelper = opsHelper )
      result = matcher.selectJob( resourceDescription, credDict )
    except RuntimeError, rte:
      self.log.error( "Error requesting job: ", rte )
      return S_ERROR( "Error requesting job" )
Example #6
0
class MatcherHandler( RequestHandler ):

  def initialize( self ):
    self.matcher = Matcher( pilotAgentsDB = pilotAgentsDB, jobDB = gJobDB, tqDB = gTaskQueueDB, jlDB = jlDB, )
    self.limiter = Limiter( jobDB = gJobDB )

##############################################################################
  types_requestJob = [ [StringType, DictType] ]
  def export_requestJob( self, resourceDescription ):
    """ Serve a job to the request of an agent which is the highest priority
        one matching the agent's site capacity
    """

    resourceDescription['Setup'] = self.serviceInfoDict['clientSetup']
    credDict = self.getRemoteCredentials()

    try:
      result = self.matcher.selectJob( resourceDescription, credDict )
    except RuntimeError, rte:
      self.log.error( "Error requesting job: ", rte )
      return S_ERROR( "Error requesting job" )
    gMonitor.addMark( "matchesDone" )
    gMonitor.addMark( "matchesOK" )
    return S_OK( result )