File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
1
+ Prevent validation accepting two xtriggers with an | between them
Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ class GraphParser:
186
186
187
187
# Match @xtriggers.
188
188
REC_XTRIG = re .compile (r'@[\w\-+%]+' )
189
+ REC_XTRIG_OR = re .compile (r'@.*\s*\|\s*@.*' )
189
190
190
191
# Match fully qualified parameterized single nodes.
191
192
REC_NODE_FULL = re .compile (
@@ -577,11 +578,14 @@ def _proc_dep_pair(
577
578
if '' in lefts or left and not all (lefts ):
578
579
raise GraphParseError (
579
580
f"Null task name in graph: { left } => { right } " )
580
-
581
581
_rights .update (* ([rights ] or []))
582
582
583
583
for left in lefts :
584
584
# Extract information about all nodes on the left.
585
+ if left and self .REC_XTRIG_OR .match (left ):
586
+ raise GraphParseError (
587
+ "'|' operator is not supported between xtriggers." )
588
+
585
589
if left :
586
590
info = self .__class__ .REC_NODES .findall (left )
587
591
expr = left
Original file line number Diff line number Diff line change 30
30
WorkflowConfigError ,
31
31
XtriggerConfigError ,
32
32
)
33
+ from cylc .flow .graph_parser import GraphParseError
33
34
from cylc .flow .parsec .exceptions import ListValueError
34
35
from cylc .flow .pathutil import get_workflow_run_pub_db_path
35
36
@@ -488,6 +489,32 @@ def test_xtrig_signature_validation(
488
489
validate (id_ )
489
490
490
491
492
+ def test_xtrig_or_fails_validation (
493
+ flow : "Fixture" ,
494
+ validate : "Fixture" ,
495
+ ):
496
+ """Xtriggers cannot be chained with the 'or'
497
+
498
+ https://github.com/cylc/cylc-flow/issues/6771
499
+ https://github.com/cylc/cylc-flow/issues/2712
500
+ """
501
+ id_ = flow (
502
+ {
503
+ "scheduling" : {
504
+ "initial cycle point" : "2024" ,
505
+ "xtriggers" : {
506
+ "xrandom" : "xrandom(100)" ,
507
+ "echo" : "echo(succeed=True)"
508
+ },
509
+ "graph" : {"R1" : "@xrandom | @echo => foo" },
510
+ }
511
+ }
512
+ )
513
+ expected_msg = "'|' operator is not supported between xtriggers."
514
+ with pytest .raises (GraphParseError , match = expected_msg ):
515
+ validate (id_ )
516
+
517
+
491
518
def test_special_task_non_word_names (flow : Fixture , validate : Fixture ):
492
519
"""Test validation of special tasks names with non-word characters"""
493
520
wid = flow ({
You can’t perform that action at this time.
0 commit comments