def getMissingEvents(workflow): """ Gets the missing events for the workflow """ inputEvents = reqMgrClient.getInputEvents(url, workflow) dataset = reqMgrClient.outputdatasetsWorkflow(url, workflow).pop() outputEvents = reqMgrClient.getOutputEvents(url, workflow, dataset) return int(inputEvents) - int(outputEvents)
def percentageCompletion(url, workflow, dataset): """ Calculates Percentage of completion for a given workflow taking a particular output dataset """ inputEvents = reqMgrClient.getInputEvents(url, workflow) outputEvents = reqMgrClient.getOutputEvents(url, workflow, dataset) if inputEvents == 0: return 0 if not outputEvents: return 0 percentage = outputEvents/float(inputEvents) return percentage
def percentageCompletion(url, workflow, outputDataset, verbose=False): """ Calculates Percentage of completion for a given workflow taking a particular output dataset """ inputEvents = reqMgrClient.getInputEvents(url, workflow) outputEvents = reqMgrClient.getOutputEvents(url, workflow, outputDataset) if inputEvents==0 or not inputEvents: return 0 if not outputEvents: outputEvents = 0 if verbose: print outputDataset print "Input events:", int(inputEvents) print "Output events:", int(outputEvents) percentage=100.0*outputEvents/float(inputEvents) return percentage
def testGetInputEvents(self): # getInputEvents ev = reqMgr.getInputEvents(url, testwf) if ev is None: self.fail("None input events") ev = float(ev)