@@ -92,8 +92,8 @@ def _generate_coords(self):
9292 decision_dims [k ] = v
9393 for k , v in conf .get ('file_manager' , {}).items ():
9494 manager_dims [k ] = v
95- # for k, v in conf.get('parameters', {}).items():
96- # parameter_dims[k] = v
95+ for k , v in conf .get ('parameters' , {}).items ():
96+ parameter_dims [k ] = v
9797 for k , v in conf .get ('trial_parameters' , {}).items ():
9898 parameter_dims [k ] = v
9999 return {'decisions' : decision_dims ,
@@ -133,13 +133,15 @@ def merge_output(self):
133133
134134 def open_output (self ):
135135 """
136- Open all of the output datasets from the ensembe and
136+ Open all of the output datasets from the ensemble and
137137 return as a dictionary of datasets
138138 """
139139 return {n : s .output for n , s in self .simulations .items ()}
140140
141141
142- def start (self , run_option : str = 'local' , prerun_cmds : list = None ):
142+ def start (self , run_option : str = 'local' , run_suffix : str = '' ,
143+ prerun_cmds : list = None , freq_restart : str = None ,
144+ write_config : bool = True ,write_manager : bool = False ):
143145 """
144146 Start running the ensemble members.
145147
@@ -154,9 +156,13 @@ def start(self, run_option: str='local', prerun_cmds: list=None):
154156 # Sleep calls are to ensure writeout happens
155157 config = self .configuration [n ]
156158 self .submissions .append (self ._client .submit (
157- _submit , s , n , run_option , prerun_cmds , config ))
159+ _submit , s , n , run_option ,
160+ run_suffix , prerun_cmds , freq_restart ,
161+ write_config ,write_manager ,config ))
158162
159- def run (self , run_option : str = 'local' , prerun_cmds = None , monitor : bool = True ):
163+ def run (self , run_option : str = 'local' , run_suffix : str = '' ,
164+ prerun_cmds : list = None , freq_restart : str = None , write_config : bool = True ,
165+ write_manager : bool = False , monitor : bool = True ):
160166 """
161167 Run the ensemble
162168
@@ -169,7 +175,8 @@ def run(self, run_option: str='local', prerun_cmds=None, monitor: bool=True):
169175 monitor:
170176 Whether to halt operation until runs are complete
171177 """
172- self .start (run_option , prerun_cmds )
178+ self .start (run_option , run_suffix , prerun_cmds ,
179+ freq_restart , write_config , write_manager )
173180 if monitor :
174181 return self .monitor ()
175182 else :
@@ -191,11 +198,15 @@ def map(self, fun, args, include_sims=True, monitor=True):
191198
192199 def monitor (self ):
193200 """
194- Halt computation until submitted simulations are complete
201+ Halt computation until submitted simulations are complete.
202+ Update submission name from config.
203+
195204 """
196205 simulations = self ._client .gather (self .submissions )
197- for s in simulations :
198- self .simulations [s .run_suffix ] = s
206+ names = self .simulations .keys ()
207+
208+ for s ,name in zip (simulations ,names ):
209+ self .simulations [name ] = s
199210
200211 def summary (self ):
201212 """
@@ -211,8 +222,9 @@ def summary(self):
211222 other .append (n )
212223 return {'Success' : success , 'Error' : error , 'Other' : other }
213224
214- def rerun_failed (self , run_option : str = 'local' , prerun_cmds = None ,
215- monitor : bool = True ):
225+ def rerun_failed (self , run_option : str = 'local' , run_suffix : str = '' ,
226+ prerun_cmds : list = None , freq_restart : str = None , write_config : bool = True ,
227+ write_manager : bool = False , monitor : bool = True ):
216228 """
217229 Try to re-run failed simulations.
218230
@@ -232,18 +244,27 @@ def rerun_failed(self, run_option: str='local', prerun_cmds=None,
232244 s = self .simulations [n ]
233245 s .reset ()
234246 self .submissions .append (self ._client .submit (
235- _submit , s , n , run_option , prerun_cmds , config ))
247+ _submit , s , n , run_option , run_suffix ,
248+ prerun_cmds , freq_restart ,write_config ,
249+ write_manager , config ))
250+
236251 if monitor :
237252 return self .monitor ()
238253 else :
239254 return True
240255
256+ def _submit (s : Simulation , name : str , run_option : str , run_suffix : str ,
257+ prerun_cmds : list , freq_restart : str ,write_config : bool ,
258+ write_manager : bool ,config : Dict , ** kwargs ):
259+ """
260+ Run simulation objects
261+ """
241262
242- def _submit (s : Simulation , name : str , run_option : str , prerun_cmds : List ,
243- config : Dict , ** kwargs ):
244263 s .initialize ()
245264 s .apply_config (config )
246- s .run (run_option , run_suffix = name , prerun_cmds = prerun_cmds , freq_restart = 'e' )
265+
266+ s .run (run_option , run_suffix = run_suffix , freq_restart = freq_restart ,
267+ write_config = write_config ,write_manager = write_manager )
247268 s .process = None
248269 return s
249270
0 commit comments