Skip to content

Commit e2e34b2

Browse files
committed
Merge branch 'fix_localhost_platform_matching' of github.com:wxtim/cylc into fix_localhost_platform_matching
* 'fix_localhost_platform_matching' of github.com:wxtim/cylc: Fix a bug preventing `cylc vip --workflow-name=foo` from working. (cylc#5349) fix no rose vars in cylc view (cylc#5367) Cylc lint fixes (cylc#5363) data store: support unsatisfied ext_trigger fix mypy fail caused by python/mypy#13969
2 parents 79b1e3b + befbe3d commit e2e34b2

File tree

8 files changed

+85
-6
lines changed

8 files changed

+85
-6
lines changed

CHANGES.md

+11
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ ones in. -->
1313
-------------------------------------------------------------------------------
1414
## __cylc-8.1.2 (<span actions:bind='release-date'>Coming Soon</span>)__
1515

16+
### Fixes
17+
1618
[#5343](https://github.com/cylc/cylc-flow/pull/5343) - Fix a bug causing
1719
platform names to be checked as if they were hosts.
1820

21+
[#5349](https://github.com/cylc/cylc-flow/pull/5349) - Bugfix: `cylc vip --workflow-name`
22+
only worked when used with a space, not an `=`.
23+
24+
[#5367](https://github.com/cylc/cylc-flow/pull/5367) - Enable using
25+
Rose options (`-O`, `-S` & `-D`) with `cylc view`.
26+
27+
[#5363](https://github.com/cylc/cylc-flow/pull/5363) Improvements and bugfixes
28+
for `cylc lint`.
29+
1930
-------------------------------------------------------------------------------
2031
## __cylc-8.1.1 (<span actions:bind='release-date'>Released 2023-01-31</span>)__
2132

cylc/flow/data_store_mgr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2094,7 +2094,7 @@ def delta_task_ext_trigger(self, itask, trig, message, satisfied):
20942094
tp_delta.stamp = f'{tp_id}@{update_time}'
20952095
ext_trigger = tp_delta.external_triggers[trig]
20962096
ext_trigger.message = message
2097-
ext_trigger.satisfied = True
2097+
ext_trigger.satisfied = satisfied
20982098
ext_trigger.time = update_time
20992099
self.updates_pending = True
21002100

cylc/flow/network/client_factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_runtime_client(
5151
if comms_method == CommsMeth.SSH:
5252
from cylc.flow.network.ssh_client import WorkflowRuntimeClient
5353
else:
54-
from cylc.flow.network.client import ( # type: ignore[no-redef]
54+
from cylc.flow.network.client import ( # type: ignore[assignment]
5555
WorkflowRuntimeClient
5656
)
5757
return WorkflowRuntimeClient(workflow, timeout=timeout)

cylc/flow/option_parsers.py

+4
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ def cleanup_sysargv(
821821
for x in compound_script_opts
822822
}
823823
# Filter out non-cylc-play options.
824+
args = [i.split('=')[0] for i in sys.argv]
824825
for unwanted_opt in (set(options.__dict__)) - set(script_opts_by_dest):
825826
for arg in compound_opts_by_dest[unwanted_opt].args:
826827
if arg in sys.argv:
@@ -831,6 +832,9 @@ def cleanup_sysargv(
831832
not in ['store_true', 'store_false']
832833
):
833834
sys.argv.pop(index)
835+
elif arg in args:
836+
index = args.index(arg)
837+
sys.argv.pop(index)
834838

835839
# replace compound script name:
836840
sys.argv[1] = script_name

cylc/flow/scripts/lint.py

+39-2
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,35 @@
125125
'url': STYLE_GUIDE + 'trailing-whitespace',
126126
'index': 6
127127
},
128-
re.compile(r'inherit\s*=\s*[a-z].*$'): {
128+
# Look for families both from inherit=FAMILY and FAMILY:trigger-all/any
129+
re.compile(r'(inherit\s*=\s*.*[a-z].*)|(\w[a-z]\w:\w+?-a(ll|ny))'): {
129130
'short': 'Family name contains lowercase characters.',
130131
'url': STYLE_GUIDE + 'task-naming-conventions',
131132
'index': 7
132133
},
134+
re.compile(r'{[{%]'): {
135+
'short': JINJA2_FOUND_WITHOUT_SHEBANG,
136+
'url': '',
137+
'index': 8
138+
},
139+
re.compile(r'platform\s*=\s*\$\(.*?\)'): {
140+
'short': 'Host Selection Script may be redundant with platform',
141+
'url': (
142+
'https://cylc.github.io/cylc-doc/stable/html/7-to-8/'
143+
'major-changes/platforms.html'
144+
),
145+
'index': 9
146+
},
147+
re.compile(r'platform\s*=\s*(`.*?`)'): {
148+
'short': 'Using backticks to invoke subshell is deprecated',
149+
'url': 'https://github.com/cylc/cylc-flow/issues/3825',
150+
'index': 10
151+
},
152+
re.compile(r'#.*?{[{%]'): {
153+
'short': 'Cylc will process commented Jinja2!',
154+
'url': '',
155+
'index': 11
156+
}
133157
# re.compile(r'^.{{maxlen},}'): {
134158
# 'short': 'line > {maxlen} characters.',
135159
# 'url': STYLE_GUIDE + 'line-length-and-continuation',
@@ -170,6 +194,10 @@
170194
'``global.cylc[platforms][<platform name>]job runner``'
171195
)
172196
},
197+
re.compile(r'host\s*=\s*(`.*?`)'): {
198+
'short': 'Using backticks to invoke subshell will fail at Cylc 8.',
199+
'url': 'https://github.com/cylc/cylc-flow/issues/3825'
200+
}
173201
}
174202
RULESETS = ['728', 'style', 'all']
175203
EXTRA_TOML_VALIDATION = {
@@ -464,7 +492,16 @@ def check_cylc_file(
464492
):
465493
continue
466494

467-
if check.findall(line) and not line.strip().startswith('#'):
495+
if (
496+
check.findall(line)
497+
and (
498+
not line.strip().startswith('#')
499+
or (
500+
'commented Jinja2!' in message['short']
501+
and check.findall(line)
502+
)
503+
)
504+
):
468505
count += 1
469506
if modify:
470507
if message['url'].startswith('http'):

cylc/flow/scripts/view.py

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def get_option_parser():
9898
parser.add_option(
9999
*AGAINST_SOURCE_OPTION.args, **AGAINST_SOURCE_OPTION.kwargs)
100100

101+
parser.add_cylc_rose_options()
102+
101103
return parser
102104

103105

tests/unit/scripts/test_lint.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@
9292
hold after point = 20220101T0000Z
9393
[[dependencies]]
9494
[[[R1]]]
95-
graph = foo
95+
graph = MyFaM:finish-all => remote
9696
9797
[runtime]
98-
[[MYFAM]]
98+
[[MyFaM]]
9999
extra log files = True
100100
{% from 'cylc.flow' import LOG %}
101101
script = {{HELLOWORLD}}
@@ -127,10 +127,14 @@
127127
128128
# Shouldn't object to a comment, unlike the terrible indents below:
129129
[[bad indent]]
130+
inherit = MyFaM
130131
131132
[[remote]]
132133
133134
[meta]
135+
[[and_another_thing]]
136+
[[[remote]]]
137+
host = `rose host-select thingy`
134138
"""
135139

136140

@@ -141,11 +145,19 @@
141145
142146
[[dependencies]]
143147
148+
{% foo %}
149+
{{foo}}
150+
# {{quix}}
151+
144152
[runtime]
145153
[[foo]]
146154
inherit = hello
147155
[[[job]]]
148156
something\t
157+
[[bar]]
158+
platform = $(some-script foo)
159+
[[baz]]
160+
platform = `no backticks`
149161
"""
150162

151163
LINT_TEST_FILE += (

tests/unit/test_option_parsers.py

+13
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,19 @@ def test_combine_options(inputs, expect):
397397
'play --foo something myworkflow'.split(),
398398
id='no path given'
399399
),
400+
param(
401+
'vip --bar=something'.split(),
402+
{
403+
'script_name': 'play',
404+
'workflow_id': 'myworkflow',
405+
'compound_script_opts': [
406+
OptionSettings(['--bar', '-b'])],
407+
'script_opts': [],
408+
'source': './myworkflow',
409+
},
410+
'play myworkflow'.split(),
411+
id='removes --key=value'
412+
),
400413
]
401414
)
402415
def test_cleanup_sysargv(monkeypatch, argv_before, kwargs, expect):

0 commit comments

Comments
 (0)