def getAcquiredAvailableWork():
    """
    Get jobs from already split elements that are not yet
    in WMBS (i.e. no jobs created)
    """
    workStatistics = {}
    queueConfig = queueConfigFromConfigObject(workqueueConfig(couchdb = externalCouchDb))
    workqueue = queueFromConfig(queueConfig)
    acquiredAvailableElements = workqueue.backend.getElements(status = 'Acquired')
    acquiredAvailableElements.extend(workqueue.backend.getElements(status = 'Available'))
    
    for element in acquiredAvailableElements:
        workflow = element['ParentQueueId']
        if workflow not in workStatistics:
            workStatistics[workflow] = 0
        workStatistics[workflow] += element['Jobs']
        
    return workStatistics
def getAssignedApprovedWork():
    """
    Split the un-split. Use a local couch for it.
    """
    workStatistics = {}
    wmstatsReader = WMStatsReader(wmstatsEndpoint)
    unAssignedRequests = wmstatsReader.workflowsByStatus(['assignment-approved'], stale = False)

    queueConfig = queueConfigFromConfigObject(workqueueConfig())
    workqueue = queueFromConfig(queueConfig)

    for requestName in unAssignedRequests:
        if 'TEST' in requestName:
            continue
        workqueue.queueWork('%s/reqmgr_workload_cache/%s/spec' % (externalCouchDb, requestName), requestName, 'notreallyateam')

    for requestName in unAssignedRequests:
        workStatistics[requestName] = 0
        workElements = workqueue.backend.getElementsForWorkflow(requestName)
        for element in workElements:
            jobs = element['Jobs']
            workStatistics[requestName] += jobs
        
    return workStatistics
Example #3
0
 def __init__(self, config):
     # call the base class
     Harness.__init__(self, config)
     self.config = queueConfigFromConfigObject(config)
Example #4
0
 def __init__(self, config):
     # call the base class
     Harness.__init__(self, config)
     self.config = queueConfigFromConfigObject(config)