Skip to content

Commit 05dc4d5

Browse files
committed
De-queue tasks on forced state change.
1 parent 4a336b9 commit 05dc4d5

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

cylc/flow/scripts/dump.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
2828
For command line monitoring:
2929
* `cylc tui`
30-
* `watch cylc dump WORKFLOW_ID` works for small simple workflows
30+
* `watch cylc dump -t WORKFLOW_ID` works for small simple workflows
3131
3232
Examples:
3333
# Display the state of all active tasks, sorted by cycle point:

cylc/flow/task_pool.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1819,19 +1819,24 @@ def _set_outputs_itask(
18191819
outputs = self._standardise_outputs(
18201820
itask.point, itask.tdef, outputs)
18211821

1822-
changed = False
18231822
outputs = sorted(outputs, key=itask.state.outputs.output_sort_key)
18241823
for output in outputs:
18251824
if itask.state.outputs.is_completed(output):
18261825
LOG.info(f"output {itask.identity}:{output} completed already")
18271826
continue
18281827
self.task_events_mgr.process_message(
18291828
itask, logging.INFO, output, forced=True)
1830-
changed = True
18311829

1832-
if changed and itask.transient:
1833-
self.workflow_db_mgr.put_update_task_state(itask)
1834-
self.workflow_db_mgr.put_update_task_outputs(itask)
1830+
if not itask.state(TASK_STATUS_WAITING):
1831+
# Can't be runahead limited or queued.
1832+
itask.state_reset(is_runahead=False, is_queued=False)
1833+
self.task_queue_mgr.remove_task(itask)
1834+
self.data_store_mgr.delta_task_queued(itask)
1835+
1836+
self.data_store_mgr.delta_task_state(itask)
1837+
self.data_store_mgr.delta_task_outputs(itask)
1838+
self.workflow_db_mgr.put_update_task_state(itask)
1839+
self.workflow_db_mgr.put_update_task_outputs(itask)
18351840

18361841
def _set_prereqs_itask(
18371842
self,

cylc/flow/task_state.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ def reset(
416416
"""
417417
req = status
418418

419+
if forced and req in [TASK_STATUS_SUBMITTED, TASK_STATUS_RUNNING]:
420+
# Forcing can only change completion status (there's no job).
421+
return False
422+
419423
current_status = (
420424
self.status,
421425
self.is_held,
@@ -432,15 +436,7 @@ def reset(
432436
# no change - do nothing
433437
return False
434438

435-
if (
436-
forced and
437-
req in [TASK_STATUS_SUBMITTED, TASK_STATUS_RUNNING]
438-
):
439-
# Forced setting of outputs can cause state change to completed
440-
# but not to submitted or running (there's no real job).
441-
return False
442-
443-
# perform the actual state change
439+
# perform the state change
444440
self.status, self.is_held, self.is_queued, self.is_runahead = (
445441
requested_status
446442
)
@@ -449,8 +445,6 @@ def reset(
449445
self.is_updated = True
450446
self.kill_failed = False
451447

452-
# Set standard outputs in accordance with task state.
453-
454448
if status is None:
455449
# NOTE: status is None if the task is being released
456450
status = self.status

0 commit comments

Comments
 (0)