@@ -52,7 +52,7 @@ class ModeSettings:
52
52
]
53
53
54
54
def __init__ (self ):
55
- self .simulated_run_length : Optional [ float ] = None
55
+ self .simulated_run_length : float = 0.0
56
56
self .sim_task_fails : bool = False
57
57
58
58
def __repr__ (self ):
@@ -62,7 +62,7 @@ def __repr__(self):
62
62
>>> this = ModeSettings()
63
63
>>> print(this)
64
64
<flow.simulation.ModeSettings object at ...
65
- simulated_run_length : None
65
+ simulated_run_length : 0.0
66
66
sim_task_fails : False
67
67
"""
68
68
repr_ = [super ().__repr__ ()]
@@ -220,21 +220,20 @@ def sim_time_check(
220
220
Returns:
221
221
True if _any_ simulated task state has changed.
222
222
"""
223
- sim_task_state_changed = False
224
- now = time ()
223
+ sim_task_state_changed : bool = False
224
+ now : float = time ()
225
225
for itask in itasks :
226
226
if itask .state .status != TASK_STATUS_RUNNING :
227
227
continue
228
228
# Started time is not set on restart
229
229
if itask .summary ['started_time' ] is None :
230
230
itask .summary ['started_time' ] = now
231
+ started_time = itask .summary ['started_time' ]
232
+ if itask .mode_settings is None :
231
233
itask .mode_settings = ModeSettings ()
232
234
itask .mode_settings .update (
233
235
itask , broadcast_mgr )
234
- timeout = (
235
- itask .summary ['started_time' ] +
236
- itask .mode_settings .simulated_run_length
237
- )
236
+ timeout = started_time + itask .mode_settings .simulated_run_length
238
237
if now > timeout :
239
238
job_d = itask .tokens .duplicate (job = str (itask .submit_num ))
240
239
now_str = get_current_time_string ()
0 commit comments