# -*-Python-*-
# Created by bgrierson at 16 Oct 2017 15:30
"""
This script shows an example of a parallel execution
"""
# Pre-allocate the location of the output for the parallel execution
root['OUTPUTS'].setdefault('PRUN', OMFITcollection())
# Make four code runs
nruns = 4
# Each code run has one processor
nproc = 1
# Execute the run in parallel, returning a dictionary contianing each run.
results_dict = root['SCRIPTS']['PRUN']['ex'].prun(nruns, nproc, 'results', postrun="results = root['OUTPUTS']['PRUN']['pwd']")
# Update the output collection with these results
root['OUTPUTS']['PRUN'].update(results_dict)