Commit 169306a9 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Include progress indicator in resultStorage

parent a9c82d47
......@@ -170,12 +170,14 @@ def MakeStorage(instanceParameters, getInstanceFile, getPlatformFile, commandArg
else:
groupedByInstances[i] = [a]
results = sum( (self.runOne(i, algs) for (i, algs) in groupedByInstances.items()), [])
nbInstances = len(groupedByInstances)
results = sum( (self.runOne(i, algs, progress = (1+index)/nbInstances)
for (index, (i, algs)) in enumerate(groupedByInstances.items())), [])
return results
def runOne(self, instance, algs):
def runOne(self, instance, algs, progress=None):
with open(self.filename, 'a') as output:
writer = csv.DictWriter(output, fieldnames = self.recordFields)
......@@ -188,7 +190,7 @@ def MakeStorage(instanceParameters, getInstanceFile, getPlatformFile, commandArg
args.append(filename)
args.extend(sum([[("-b" if a.isBound else "-a"),
a.alg+(":"+a.params if a.params else "")] for a in algs], []))
print("Running: " + " ".join(args))
print("Running: " + (" [%.1f%%] " % (progress*100) if progress else "") + " ".join(args))
with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) as child:
reader = csv.reader(child.stdout, delimiter=' ')
result = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment