Skip to content

Commit 4fb8ba4

Browse files
committed
Auto-erase flow-history by default, for trigger.
1 parent a8a6d8c commit 4fb8ba4

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

cylc/flow/commands.py

+7
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,13 @@ async def force_trigger_tasks(
457457
"at Cylc 8.5."
458458
)
459459
yield
460+
461+
if not flow:
462+
# default case: erase flow history before trigger
463+
flow_nums = get_flow_nums_set(flow)
464+
schd.remove_tasks(tasks, flow_nums)
465+
schd.workflow_db_mgr.process_queued_ops()
466+
460467
yield schd.pool.force_trigger_tasks(
461468
tasks, flow, flow_wait, flow_descr, on_resume
462469
)

cylc/flow/scheduler.py

+1
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,7 @@ def remove_tasks(
11181118

11191119
if flow_nums is None:
11201120
flow_nums = set()
1121+
11211122
# Mapping of *relative* task IDs to removed flow numbers:
11221123
removed: Dict[Tokens, FlowNums] = {}
11231124
not_removed: Set[Tokens] = set()

cylc/flow/scripts/trigger.py

+21-8
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,26 @@
1717

1818
"""cylc trigger [OPTIONS] ARGS
1919
20-
Force task(s) to run regardless of prerequisites, even in a paused workflow.
20+
Force task(s) to run, even in a paused workflow.
2121
22-
Triggering a task that is not yet queued will queue it.
22+
Triggering a task that is not yet queued will queue it; triggering a queued
23+
task will run it (so un-queued tasks may need to be triggered twice).
2324
24-
Triggering a queued task runs it immediately.
25+
Tasks can't be triggered if already active (preparing, submitted, running).
2526
26-
Cylc queues restrict the number of jobs that can be active (submitted or
27-
running) at once. They release tasks to run when their active task count
28-
drops below the queue limit.
27+
Triggering a group of tasks at once:
28+
Off-group prerequisites will be force-satisfied; in-group prerequisites
29+
will be respected - i.e. left to be satisfied by the triggered flow.
2930
30-
Attempts to trigger active (preparing, submitted, running)
31-
tasks will be ignored.
31+
Triggering past tasks:
32+
By default the flow-history of target tasks will be erased so that you
33+
can re-traverse the past graph without starting a new flow.
34+
35+
Triggering a sub-graph:
36+
* Recommended approach: trigger all sub-graph tasks as a group. The forced
37+
satisfaction of off-group prerequisites will automatically avoid a stall.
38+
* Alternative approach: trigger the initial tasks of the sub-graph to start
39+
the flow, and manually set off-flow prerequisites to prevent a stall.
3240
3341
Examples:
3442
# trigger task foo in cycle 1234 in test
@@ -40,6 +48,11 @@
4048
# start a new flow by triggering 1234/foo in test
4149
$ cylc trigger --flow=new test//1234/foo
4250
51+
Cylc queues:
52+
Queues limit how many tasks can be active (preparing, submitted, running) at
53+
once. Tasks that are ready to run will remained queued until the active task
54+
count drops below the queue limit.
55+
4356
Flows:
4457
Waiting tasks in the active window (n=0) already belong to a flow.
4558
* by default, if triggered, they run in the same flow

cylc/flow/task_pool.py

+3
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,9 @@ def force_trigger_tasks(
22682268
- just spawn (if not already spawned in this flow)
22692269
unless flow-wait is set.
22702270
2271+
flow: [] - default
2272+
['none'] - no-flow
2273+
22712274
"""
22722275
# Get matching tasks proxies, and matching inactive task IDs.
22732276
existing_tasks, inactive, unmatched = self.filter_task_proxies(

0 commit comments

Comments
 (0)