Skip to content

Commit c07392d

Browse files
Merge pull request #5913 from cylc/8.2.x-sync
🤖 Merge 8.2.x-sync into master
2 parents a7cf51b + 22f41e2 commit c07392d

22 files changed

+341
-174
lines changed

CHANGES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,35 @@ $ towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"
1111

1212
<!-- towncrier release notes start -->
1313

14+
## __cylc-8.2.4 (Released 2024-01-11)__
15+
16+
### 🚀 Enhancements
17+
18+
[#5772](https://github.com/cylc/cylc-flow/pull/5772) - `cylc lint`: added a check for indentation being 4N spaces.
19+
20+
[#5838](https://github.com/cylc/cylc-flow/pull/5838) - `cylc lint`: added rule to check for `rose date` usage (should be replaced with `isodatetime`).
21+
22+
### 🔧 Fixes
23+
24+
[#5789](https://github.com/cylc/cylc-flow/pull/5789) - Prevent the run mode from being changed on restart.
25+
26+
[#5801](https://github.com/cylc/cylc-flow/pull/5801) - Fix traceback when using parentheses on right hand side of graph trigger.
27+
28+
[#5821](https://github.com/cylc/cylc-flow/pull/5821) - Fixed issue where large uncommitted changes could cause `cylc install` to hang.
29+
30+
[#5841](https://github.com/cylc/cylc-flow/pull/5841) - `cylc lint`: improved handling of S011 to not warn if the `#` is `#$` (e.g. shell base arithmetic).
31+
32+
[#5885](https://github.com/cylc/cylc-flow/pull/5885) - Fixed bug in using a final cycle point with chained offsets e.g. 'final cycle point = +PT6H+PT1S'.
33+
34+
[#5893](https://github.com/cylc/cylc-flow/pull/5893) - Fixed bug in computing a time interval-based runahead limit when future triggers are present.
35+
36+
[#5902](https://github.com/cylc/cylc-flow/pull/5902) - Fixed a bug that prevented unsetting `execution time limit` by broadcast or reload.
37+
38+
[#5908](https://github.com/cylc/cylc-flow/pull/5908) - Fixed bug causing redundant DB updates when many tasks depend on the same xtrigger.
39+
40+
[#5909](https://github.com/cylc/cylc-flow/pull/5909) - Fix a bug where Cylc VIP did not remove --workflow-name=<name> from
41+
Cylc play arguments.
42+
1443
## __cylc-8.2.3 (Released 2023-11-02)__
1544

1645
### 🔧 Fixes

changes.d/5772.feat.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5789.fix.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5801.fix.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5821.fix.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5838.feat.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5841.fix.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5885.fix.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changes.d/5893.fix

Lines changed: 0 additions & 1 deletion
This file was deleted.

cylc/flow/option_parsers.py

Lines changed: 80 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
import sys
3535
from textwrap import dedent
36-
from typing import Any, Dict, Optional, List, Tuple
36+
from typing import Any, Dict, Iterable, Optional, List, Tuple
3737

3838
from cylc.flow import LOG
3939
from cylc.flow.terminal import supports_color, DIM
@@ -732,17 +732,33 @@ def combine_options(*args, modify=None):
732732

733733

734734
def cleanup_sysargv(
735-
script_name,
736-
workflow_id,
737-
options,
738-
compound_script_opts,
739-
script_opts,
740-
source,
741-
):
735+
script_name: str,
736+
workflow_id: str,
737+
options: 'Values',
738+
compound_script_opts: Iterable['OptionSettings'],
739+
script_opts: Iterable['OptionSettings'],
740+
source: str,
741+
) -> None:
742742
"""Remove unwanted options from sys.argv
743743
744744
Some cylc scripts (notably Cylc Play when it is re-invoked on a scheduler
745-
server) require the correct content in sys.argv.
745+
server) require the correct content in sys.argv: This function
746+
subtracts the unwanted options from sys.argv.
747+
748+
Args:
749+
script_name:
750+
Name of the target script. For example if we are
751+
using this for the play step of cylc vip then this
752+
will be "play".
753+
workflow_id:
754+
options:
755+
Actual options provided to the compound script.
756+
compound_script_options:
757+
Options available in compound script.
758+
script_options:
759+
Options available in target script.
760+
source:
761+
Source directory.
746762
"""
747763
# Organize Options by dest.
748764
script_opts_by_dest = {
@@ -753,30 +769,67 @@ def cleanup_sysargv(
753769
x.kwargs.get('dest', x.args[0].strip(DOUBLEDASH)): x
754770
for x in compound_script_opts
755771
}
756-
# Filter out non-cylc-play options.
757-
args = [i.split('=')[0] for i in sys.argv]
758-
for unwanted_opt in (set(options.__dict__)) - set(script_opts_by_dest):
759-
for arg in compound_opts_by_dest[unwanted_opt].args:
760-
if arg in sys.argv:
761-
index = sys.argv.index(arg)
762-
sys.argv.pop(index)
763-
if (
764-
compound_opts_by_dest[unwanted_opt].kwargs['action']
765-
not in ['store_true', 'store_false']
766-
):
767-
sys.argv.pop(index)
768-
elif arg in args:
769-
index = args.index(arg)
770-
sys.argv.pop(index)
772+
773+
# Get a list of unwanted args:
774+
unwanted_compound: List[str] = []
775+
unwanted_simple: List[str] = []
776+
for unwanted_dest in (set(options.__dict__)) - set(script_opts_by_dest):
777+
for unwanted_arg in compound_opts_by_dest[unwanted_dest].args:
778+
if (
779+
compound_opts_by_dest[unwanted_dest].kwargs.get('action', None)
780+
in ['store_true', 'store_false']
781+
):
782+
unwanted_simple.append(unwanted_arg)
783+
else:
784+
unwanted_compound.append(unwanted_arg)
785+
786+
new_args = filter_sysargv(sys.argv, unwanted_simple, unwanted_compound)
771787

772788
# replace compound script name:
773-
sys.argv[1] = script_name
789+
new_args[1] = script_name
774790

775791
# replace source path with workflow ID.
776792
if str(source) in sys.argv:
777-
sys.argv.remove(str(source))
793+
new_args.remove(str(source))
778794
if workflow_id not in sys.argv:
779-
sys.argv.append(workflow_id)
795+
new_args.append(workflow_id)
796+
797+
sys.argv = new_args
798+
799+
800+
def filter_sysargv(
801+
sysargs, unwanted_simple: List, unwanted_compound: List
802+
) -> List:
803+
"""Create a copy of sys.argv without unwanted arguments:
804+
805+
Cases:
806+
>>> this = filter_sysargv
807+
>>> this(['--foo', 'expects-a-value', '--bar'], [], ['--foo'])
808+
['--bar']
809+
>>> this(['--foo=expects-a-value', '--bar'], [], ['--foo'])
810+
['--bar']
811+
>>> this(['--foo', '--bar'], ['--foo'], [])
812+
['--bar']
813+
"""
814+
pop_next: bool = False
815+
new_args: List = []
816+
for this_arg in sysargs:
817+
parts = this_arg.split('=', 1)
818+
if pop_next:
819+
pop_next = False
820+
continue
821+
elif parts[0] in unwanted_compound:
822+
# Case --foo=value or --foo value
823+
if len(parts) == 1:
824+
# --foo value
825+
pop_next = True
826+
continue
827+
elif parts[0] in unwanted_simple:
828+
# Case --foo does not expect a value:
829+
continue
830+
else:
831+
new_args.append(this_arg)
832+
return new_args
780833

781834

782835
def log_subcommand(*args):

0 commit comments

Comments
 (0)