@@ -1579,8 +1579,10 @@ def spawn_task(
1579
1579
def force_spawn_children (
1580
1580
self ,
1581
1581
items : Iterable [str ],
1582
- outputs : Optional [List [str ]] = None ,
1583
- flow_num : Optional [int ] = None
1582
+ outputs : List [str ],
1583
+ flow : List [str ],
1584
+ flow_wait : bool = False ,
1585
+ flow_descr : str = "" ,
1584
1586
):
1585
1587
"""Spawn downstream children of given outputs, on user command.
1586
1588
@@ -1591,14 +1593,13 @@ def force_spawn_children(
1591
1593
items: Identifiers for matching task definitions, each with the
1592
1594
form "point/name".
1593
1595
outputs: List of outputs to spawn on
1594
- flow_num : Flow number to attribute the outputs
1596
+ flow : Flow number to attribute the outputs
1595
1597
1596
1598
"""
1597
1599
outputs = outputs or [TASK_OUTPUT_SUCCEEDED ]
1598
- if flow_num is None :
1599
- flow_nums = None
1600
- else :
1601
- flow_nums = {flow_num }
1600
+ flow_nums = self ._flow_cmd_helper (flow )
1601
+ if flow_nums is None :
1602
+ return
1602
1603
1603
1604
n_warnings , task_items = self .match_taskdefs (items )
1604
1605
for (_ , point ), taskdef in sorted (task_items .items ()):
@@ -1638,27 +1639,15 @@ def remove_tasks(self, items):
1638
1639
self .release_runahead_tasks ()
1639
1640
return len (bad_items )
1640
1641
1641
- def force_trigger_tasks (
1642
- self , items : Iterable [str ],
1643
- flow : List [str ],
1644
- flow_wait : bool = False ,
1645
- flow_descr : Optional [str ] = None
1646
- ) -> int :
1647
- """Manual task triggering.
1648
-
1649
- Don't get a new flow number for existing n=0 tasks (e.g. incomplete
1650
- tasks). These can carry on in the original flow if retriggered.
1651
-
1652
- Queue the task if not queued, otherwise release it to run.
1653
-
1654
- """
1642
+ def _flow_cmd_helper (self , flow ):
1643
+ # TODO type hints
1655
1644
if set (flow ).intersection ({FLOW_ALL , FLOW_NEW , FLOW_NONE }):
1656
1645
if len (flow ) != 1 :
1657
1646
LOG .warning (
1658
1647
f'The "flow" values { FLOW_ALL } , { FLOW_NEW } & { FLOW_NONE } '
1659
1648
' cannot be used in combination with integer flow numbers.'
1660
1649
)
1661
- return 0
1650
+ return None
1662
1651
if flow [0 ] == FLOW_ALL :
1663
1652
flow_nums = self ._get_active_flow_nums ()
1664
1653
elif flow [0 ] == FLOW_NEW :
@@ -1670,9 +1659,28 @@ def force_trigger_tasks(
1670
1659
flow_nums = {int (n ) for n in flow }
1671
1660
except ValueError :
1672
1661
LOG .warning (
1673
- f"Trigger ignored, illegal flow values { flow } "
1662
+ f"Ignoring command: illegal flow values { flow } "
1674
1663
)
1675
- return 0
1664
+ return None
1665
+ return flow_nums
1666
+
1667
+ def force_trigger_tasks (
1668
+ self , items : Iterable [str ],
1669
+ flow : List [str ],
1670
+ flow_wait : bool = False ,
1671
+ flow_descr : Optional [str ] = None
1672
+ ) -> int :
1673
+ """Manual task triggering.
1674
+
1675
+ Don't get a new flow number for existing n=0 tasks (e.g. incomplete
1676
+ tasks). These can carry on in the original flow if retriggered.
1677
+
1678
+ Queue the task if not queued, otherwise release it to run.
1679
+
1680
+ """
1681
+ flow_nums = self ._flow_cmd_helper (flow )
1682
+ if flow_nums is None :
1683
+ return
1676
1684
1677
1685
# n_warnings, task_items = self.match_taskdefs(items)
1678
1686
itasks , future_tasks , unmatched = self .filter_task_proxies (
0 commit comments