Esempio n. 1
0
    def checkJobs( self, jobIds, errors ):
        """
        check a list of provided job id
        """
        
        for jobId in jobIds:

            try:
                
                wrapStatus = Status(jobId, 0)
                # Check for Errors
                err , apiMsg = wrapStatus.get_error ()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                # Retrieve the number of status (in this case is always 1)
                # statusNumber = wrapStatus.getStatusNumber()
 
                # Retrieve the list of attributes for the current UNIQUE event
                statusAttribute = wrapStatus.getStatusAttributes(0)
                
                # Check for Errors
                err , apiMsg = wrapStatus.get_error ()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                jobInfo = statusAttribute

                # retrieve scheduler Id
                jobSchedId = str(jobInfo[self.jobId])

                # update just loaded jobs
                try:
                    job = jobIds[jobSchedId]
                except :
                    continue
                    
                 # update runningJob
                self.getJobInfo(jobInfo, job )
                if job['statusScheduler'] == 'Aborted' :
                    self.getAbortReason(job)
                
                jobIds[jobSchedId] = job
                
            except Exception, err :
                errors.append(
                    "skipping " + jobId + " : " +  str(err) )
Esempio n. 2
0
    def checkJobs(self, jobIds, errors):
        """
        check a list of provided job id
        """

        for jobId in jobIds:

            try:

                wrapStatus = Status(jobId, 0)
                # Check for Errors
                err, apiMsg = wrapStatus.get_error()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                # Retrieve the number of status (in this case is always 1)
                # statusNumber = wrapStatus.getStatusNumber()

                # Retrieve the list of attributes for the current UNIQUE event
                statusAttribute = wrapStatus.getStatusAttributes(0)

                # Check for Errors
                err, apiMsg = wrapStatus.get_error()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                jobInfo = statusAttribute

                # retrieve scheduler Id
                jobSchedId = str(jobInfo[self.jobId])

                # update just loaded jobs
                try:
                    job = jobIds[jobSchedId]
                except:
                    continue

                # update runningJob
                self.getJobInfo(jobInfo, job)

                jobIds[jobSchedId] = job

            except Exception as err:
                errors.append("skipping " + jobId + " : " + str(err))
Esempio n. 3
0
    def checkJobsBulk(self, jobIds, parentIds, errors):
        """
        check a list of provided job parent ids
        """

        if self.attrNumber == 0:
            # raise an exception here? What kind of exception?
            raise

        self.st = 0

        # convert to string
        # lbJobs = wmsui_api.getJobIdfromList ( parentIds )

        for bulkId in parentIds:

            try:

                wrapStatus = Status(bulkId, 0)
                # Check for Errors
                err, apiMsg = wrapStatus.get_error()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                # Retrieve the number of status
                statesNumber = wrapStatus.getStatusNumber()

                # Retrieve the list of attributes for each logged event
                for statusNumber in range(statesNumber):

                    # Retrieve the list of attributes for the current event
                    statusAttribute = \
                        wrapStatus.getStatusAttributes(statusNumber)

                    # Check for Errors
                    err, apiMsg = wrapStatus.get_error()
                    if err:
                        # Print the error and terminate
                        raise Exception(apiMsg)

                bulkInfo = statusAttribute

                # how many jobs in the bulk?
                intervals = int(len(bulkInfo) / self.attrNumber)

                # look if the parent is aborted
                if str(bulkInfo[self.status]) == 'Aborted':
                    # warnings.append('Parent Job Failed')
                    forceAborted = True
                else:
                    forceAborted = False

                # loop over retrieved jobs
                for off in range(1, intervals):

                    # adjust list ofset
                    offset = off * self.attrNumber

                    # focus over specific job related info
                    jobInfo = bulkInfo[offset:offset + self.attrNumber]

                    # retrieve scheduler Id
                    jobSchedId = str(jobInfo[self.jobId])

                    # update just loaded jobs
                    #job = None
                    try:
                        job = jobIds[jobSchedId]
                    except:
                        continue

                    # update runningJob
                    self.getJobInfo(jobInfo, job, forceAborted)
                    jobIds[jobSchedId] = job

                self.st = self.st + 1

            except Exception as err:
                errors.append("skipping " + bulkId + " : " + str(err))
    def checkJobsBulk( self, jobIds, parentIds, errors ):
        """
        check a list of provided job parent ids
        """

        if self.attrNumber == 0 :
            # raise an exception here? What kind of exception?
            raise

        self.st = 0

        # convert to string
        # lbJobs = wmsui_api.getJobIdfromList ( parentIds )

        for bulkId in parentIds:

            try:

                wrapStatus = Status(bulkId, 0)
                # Check for Errors
                err , apiMsg = wrapStatus.get_error ()
                if err:
                    # Print the error and terminate
                    raise Exception(apiMsg)

                # Retrieve the number of status
                statesNumber = wrapStatus.getStatusNumber()

                # Retrieve the list of attributes for each logged event
                for statusNumber in range(statesNumber):

                    # Retrieve the list of attributes for the current event
                    statusAttribute = \
                        wrapStatus.getStatusAttributes(statusNumber)

                    # Check for Errors
                    err , apiMsg = wrapStatus.get_error ()
                    if err:
                        # Print the error and terminate
                        raise Exception(apiMsg)

                bulkInfo = statusAttribute

                # how many jobs in the bulk?
                intervals = int ( len(bulkInfo) / self.attrNumber )

                # look if the parent is aborted
                if str(bulkInfo[self.status]) == 'Aborted' :
                    # warnings.append('Parent Job Failed')
                    forceAborted = True
                else :
                    forceAborted = False

                # loop over retrieved jobs
                for off in range ( 1, intervals ):

                    # adjust list ofset
                    offset = off * self.attrNumber

                    # focus over specific job related info
                    jobInfo = bulkInfo[ offset : offset + self.attrNumber ]

                    # retrieve scheduler Id
                    jobSchedId = str(jobInfo[self.jobId])

                    # update just loaded jobs
                    #job = None
                    try:
                        job = jobIds[jobSchedId]
                    except :
                        continue

                    # update runningJob
                    self.getJobInfo( jobInfo, job, forceAborted)
                    jobIds[jobSchedId] = job


                self.st = self.st + 1

            except Exception as err :
                errors.append("skipping " + bulkId + " : " +  str(err))