dump results to XML after each run

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-03-21 14:53:48 +01:00
parent 894009b414
commit ec6ed7c1e8
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 6 additions and 7 deletions

View File

@ -22,7 +22,7 @@ def initLogger(config):
logger.addHandler(ch)
return logger
def runOnce(config, shape):
def runOnce(config, shape, execID):
if config.deterministic:
shape.setSeed(config.randomSeed+"-"+str(shape))
@ -34,6 +34,10 @@ def runOnce(config, shape):
sim.initNetwork()
result = sim.run()
sim.logger.info("Shape: %s ... Block Available: %d in %d steps" % (str(sim.shape.__dict__), result.blockAvailable, len(result.missingVector)), extra=sim.format)
if config.dumpXML:
result.dump(execID)
return result
def study():
@ -61,15 +65,10 @@ def study():
logger.info("Starting simulations:", extra=format)
start = time.time()
results = Parallel(config.numJobs)(delayed(runOnce)(config, shape) for shape in config.nextShape())
results = Parallel(config.numJobs)(delayed(runOnce)(config, shape ,execID) for shape in config.nextShape())
end = time.time()
logger.info("A total of %d simulations ran in %d seconds" % (len(results), end-start), extra=format)
if config.dumpXML:
for res in results:
res.dump(execID)
logger.info("Results dumped into results/%s/" % (execID), extra=format)
if config.visualization:
vis = Visualizer(execID)
vis.plotHeatmaps()