def parseFile(f): doc = minidom.parse(f) query = [name('commandSetRoot'), [name('commandSet'), [name('command')]]] res = execQuery(query, doc) times = [r.childNodes[0].data for r in res if r.localName in ['startTime', 'endTime']] return [parseTime(end) - parseTime(start) for start, end in chunk(times, 2)]
def _pipelineProgress(workflowXML): doc = _try(lambda : minidom.parse(workflowXML)) query = [xmlquery.name('commandSetRoot'), [xmlquery.name('commandSet'), [xmlquery.name('status')]]] res = xmlquery.execQuery(query, doc) total = sum([int(r.childNodes[0].data) for r in res if r.localName == 'total']) complete = sum([int(r.childNodes[0].data) for r in res if r.localName == 'complete']) return (complete, total)
def progress(self): """ Returns a tuple of (number of completed tasks, total tasks) """ doc = minidom.parse(os.path.join(self.config("dirs.pipeline_runtime"), str(self.pid), "pipeline.xml")) query = [name("commandSetRoot"), [name("commandSet"), [name("status")]]] res = execQuery(query, doc) total = sum([int(r.childNodes[0].data) for r in res if r.localName == "total"]) complete = sum([int(r.childNodes[0].data) for r in res if r.localName == "complete"]) return (complete, total)
def parseFile(f): doc = minidom.parse(f) query = [name('commandSetRoot'), [name('commandSet'), [name('command')]]] res = execQuery(query, doc) times = [ r.childNodes[0].data for r in res if r.localName in ['startTime', 'endTime'] ] return [ parseTime(end) - parseTime(start) for start, end in chunk(times, 2) ]
def _pipelineProgress(workflowXML): doc = _try(lambda: minidom.parse(workflowXML)) query = [ xmlquery.name('commandSetRoot'), [xmlquery.name('commandSet'), [xmlquery.name('status')]] ] res = xmlquery.execQuery(query, doc) total = sum( [int(r.childNodes[0].data) for r in res if r.localName == 'total']) complete = sum( [int(r.childNodes[0].data) for r in res if r.localName == 'complete']) return (complete, total)
def progress(self): """ Returns a tuple of (number of completed tasks, total tasks) """ doc = minidom.parse( os.path.join(self.config('dirs.pipeline_runtime'), str(self.pid), 'pipeline.xml')) query = [ name('commandSetRoot'), [name('commandSet'), [name('status')]] ] res = execQuery(query, doc) total = sum( [int(r.childNodes[0].data) for r in res if r.localName == 'total']) complete = sum([ int(r.childNodes[0].data) for r in res if r.localName == 'complete' ]) return (complete, total)