Skip to content

Commit 0dcfc96

Browse files
committed
Fix parentless spawning.
1 parent d1a1508 commit 0dcfc96

15 files changed

Lines changed: 145 additions & 240 deletions

cylc/flow/clean.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ def remote_clean(
446446
f"Remote clean failed for {id_} - could not clean on these "
447447
"install target(s):"
448448
)
449-
for target, exc in failed_targets.items():
450-
msg += f"\n[{target}]\n{exc}"
449+
for target, excep in failed_targets.items():
450+
msg += f"\n[{target}]\n{excep}"
451451
raise CylcError(msg)
452452

453453

cylc/flow/commands.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,6 @@ def _remove_matched_tasks(
180180
continue
181181
removed[itask.tokens.task] = fnums_to_remove
182182
if fnums_to_remove == itask.flow_nums:
183-
# Need to remove the task from the pool.
184-
# Spawn next occurrence of xtrigger sequential task (otherwise
185-
# this would not happen after removing this occurrence):
186-
schd.pool.check_spawn_psx_task(itask)
187183
schd.pool.remove(itask, 'request')
188184
to_kill.append(itask)
189185
itask.removed = True

cylc/flow/scheduler.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,8 @@ def _load_pool_from_tasks(self):
844844
flow=[FLOW_NEW],
845845
flow_descr=f"original flow from {self.options.starttask}"
846846
)
847+
self.pool.spawn_to_runahead_limit()
848+
self.pool.queue_if_ready()
847849

848850
def _load_pool_from_point(self):
849851
"""Load task pool for a cycle point, for a new run.
@@ -881,13 +883,6 @@ def _load_pool_from_db(self):
881883
self.workflow_db_mgr.pri_dao.select_abs_outputs_for_restart(
882884
self.pool.load_abs_outputs_for_restart)
883885

884-
# Compute and release runahead tasks once after loading all tasks from
885-
# the DB. This also causes spawning of parentless tasks out to the
886-
# runahead limit, which may be necessary here if the stop point or
887-
# runahead limit was changed for the restart.
888-
self.pool.compute_runahead()
889-
self.pool.release_runahead_tasks()
890-
891886
self.pool.load_db_tasks_to_hold()
892887
self.pool.update_flow_mgr()
893888

@@ -1622,8 +1617,13 @@ def update_profiler_logs(self, tinit):
16221617

16231618
async def _main_loop(self) -> None:
16241619
"""A single iteration of the main loop."""
1620+
16251621
tinit = time()
16261622

1623+
self.pool.compute_runahead()
1624+
self.pool.release_runahead_tasks()
1625+
await self.workflow_shutdown()
1626+
16271627
# Useful for debugging core scheduler issues:
16281628
# import logging
16291629
# self.pool.log_task_pool(logging.CRITICAL)
@@ -1657,10 +1657,13 @@ async def _main_loop(self) -> None:
16571657
itask, self.ext_trigger_queue)
16581658

16591659
if itask.is_ready_to_run() and not itask.is_manual_submit:
1660+
if itask.is_xtrigger_sequential:
1661+
self.pool.spawn_next_parentless(itask)
16601662
self.pool.queue_task(itask)
16611663

16621664
if self.xtrigger_mgr.do_housekeeping:
16631665
self.xtrigger_mgr.housekeep(self.pool.get_tasks())
1666+
16641667
self.pool.clock_expire_tasks()
16651668
self.release_tasks_to_run()
16661669

@@ -1717,11 +1720,10 @@ async def _main_loop(self) -> None:
17171720
await self.update_data_structure()
17181721

17191722
if has_updated:
1720-
if not self.is_reloaded:
1723+
if not self.is_reloaded and self.is_stalled:
17211724
# (A reload cannot un-stall workflow by itself)
1722-
if self.is_stalled:
1723-
self.is_stalled = False
1724-
self.update_data_store()
1725+
self.is_stalled = False
1726+
self.update_data_store()
17251727
self.is_reloaded = False
17261728

17271729
# Reset workflow and task updated flags.
@@ -1743,8 +1745,9 @@ async def _main_loop(self) -> None:
17431745
# Shutdown workflow if timeouts have occurred
17441746
self.timeout_check()
17451747

1746-
# Does the workflow need to shutdown on task failure?
1747-
await self.workflow_shutdown()
1748+
# # Does the workflow need to shutdown on task failure?
1749+
# move up to top
1750+
# await self.workflow_shutdown()
17481751

17491752
if self.options.profile_mode:
17501753
self.update_profiler_logs(tinit)

0 commit comments

Comments
 (0)