Skip to content

Commit

Permalink
response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Oct 16, 2024
1 parent 30d50bf commit 047c76f
Show file tree
Hide file tree
Showing 63 changed files with 797 additions and 447 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/2_auto_publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: cylc/release-actions/build-python-package@v1

- name: Publish distribution to PyPI
uses: pypa/[email protected].2
uses: pypa/[email protected].3
with:
user: __token__ # uses the API token feature of PyPI - least permissions possible
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
python: ['3.8', '3.9', '3.10', '3.11']
include:
- os: 'ubuntu-22.04'
python: '3.7'
- os: 'macos-latest'
python: '3.8'
steps:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
fail-fast: false # don't stop on first failure
matrix:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.10', '3.11', '3']
python-version: ['3.8', '3.10', '3.11', '3']
include:
# mac os test
- os: 'ubuntu-22.04'
python-version: '3.7'
- os: 'macos-latest'
python-version: '3.9' # oldest supported version
# non-utc timezone test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
os: ['ubuntu-22.04']
python-version: ['3.7']
test-base: ['tests/f']
chunk: ['1/4', '2/4', '3/4', '4/4']
Expand All @@ -56,20 +56,20 @@ jobs:
platform: '_local_background*'
# tests/k
- name: 'flaky'
os: 'ubuntu-latest'
os: 'ubuntu-22.04'
python-version: '3.7'
test-base: 'tests/k'
chunk: '1/1'
platform: '_local_background* _local_at*'
# remote platforms
- name: '_remote_background_indep_poll'
os: 'ubuntu-latest'
os: 'ubuntu-22.04'
python-version: '3.7'
test-base: 'tests/f tests/k'
chunk: '1/1'
platform: '_remote_background_indep_poll _remote_at_indep_poll'
- name: '_remote_background_indep_tcp'
os: 'ubuntu-latest'
os: 'ubuntu-22.04'
test-base: 'tests/f tests/k'
python-version: '3.7'
chunk: '1/1'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test_tutorial_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ jobs:
test:
strategy:
matrix:
python-version: ['3.7', '3']
runs-on: ubuntu-latest
include:
- os: 'ubuntu-latest'
python-version: '3'
- os: 'ubuntu-22.04'
python-version: '3.7'
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: configure python
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ $ towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"

<!-- towncrier release notes start -->

## __cylc-8.3.5 (Released 2024-10-15)__

### 🔧 Fixes

[#6316](https://github.com/cylc/cylc-flow/pull/6316) - Fixed bug in `cylc vr` where an initial cycle point of `now`/`next()`/`previous()` would result in an error.

[#6362](https://github.com/cylc/cylc-flow/pull/6362) - Fixed simulation mode bug where the task submit number would not increment

[#6367](https://github.com/cylc/cylc-flow/pull/6367) - Fix bug where `cylc trigger` and `cylc set` would assign active flows to existing tasks by default.

[#6397](https://github.com/cylc/cylc-flow/pull/6397) - Fix "dictionary changed size during iteration error" which could occur with broadcasts.

## __cylc-8.3.4 (Released 2024-09-12)__

### 🚀 Enhancements
Expand Down
2 changes: 1 addition & 1 deletion changes.d/6039.feat.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add a new mode task run mode "skip" which overrides workflow live mode task submission.
Added a new task run mode "skip", which allows skipping of tasks in a running workflow as well as creation of dummy tasks as part of workflow design.
1 change: 0 additions & 1 deletion changes.d/6362.fix.md

This file was deleted.

1 change: 1 addition & 0 deletions changes.d/6414.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Broadcast will now reject truncated cycle points to aviod runtime errors.
3 changes: 1 addition & 2 deletions cylc/flow/cfgspec/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,8 +1342,7 @@ def get_script_common_text(this: str, example: Optional[str] = None):
options=list(TASK_CONFIG_RUN_MODES),
default=RunMode.LIVE.value,
desc=f'''
For a workflow run in live mode run this task in skip
mode.
Run the task in one of the following modes:
{RunMode.LIVE.value}:
{RunMode.LIVE.describe()}
Expand Down
25 changes: 16 additions & 9 deletions cylc/flow/command_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


ERR_OPT_FLOW_VAL = "Flow values must be an integer, or 'all', 'new', or 'none'"
ERR_OPT_FLOW_INT = "Multiple flow options must all be integer valued"
ERR_OPT_FLOW_COMBINE = "Cannot combine --flow={0} with other flow values"
ERR_OPT_FLOW_WAIT = (
f"--wait is not compatible with --flow={FLOW_NEW} or --flow={FLOW_NONE}"
)
Expand All @@ -39,40 +39,47 @@
def flow_opts(flows: List[str], flow_wait: bool) -> None:
"""Check validity of flow-related CLI options.
Note the schema defaults flows to ["all"].
Note the schema defaults flows to [].
Examples:
Good:
>>> flow_opts([], False)
>>> flow_opts(["new"], False)
>>> flow_opts(["1", "2"], False)
>>> flow_opts(["1", "2"], True)
Bad:
>>> flow_opts(["none", "1"], False)
Traceback (most recent call last):
cylc.flow.exceptions.InputError: ... must all be integer valued
cylc.flow.exceptions.InputError: Cannot combine --flow=none with other
flow values
>>> flow_opts(["cheese", "2"], True)
Traceback (most recent call last):
cylc.flow.exceptions.InputError: ... or 'all', 'new', or 'none'
>>> flow_opts(["new"], True)
Traceback (most recent call last):
cylc.flow.exceptions.InputError: ...
cylc.flow.exceptions.InputError: --wait is not compatible with
--flow=new or --flow=none
"""
if not flows:
return

flows = [val.strip() for val in flows]

for val in flows:
val = val.strip()
if val in [FLOW_NONE, FLOW_NEW, FLOW_ALL]:
if val in {FLOW_NONE, FLOW_NEW, FLOW_ALL}:
if len(flows) != 1:
raise InputError(ERR_OPT_FLOW_INT)
raise InputError(ERR_OPT_FLOW_COMBINE.format(val))
else:
try:
int(val)
except ValueError:
raise InputError(ERR_OPT_FLOW_VAL.format(val)) from None
raise InputError(ERR_OPT_FLOW_VAL) from None

if flow_wait and flows[0] in [FLOW_NEW, FLOW_NONE]:
if flow_wait and flows[0] in {FLOW_NEW, FLOW_NONE}:
raise InputError(ERR_OPT_FLOW_WAIT)


Expand Down
11 changes: 6 additions & 5 deletions cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
)
from cylc.flow.print_tree import print_tree
from cylc.flow.task_qualifiers import ALT_QUALIFIERS
from cylc.flow.run_modes.nonlive import run_mode_validate_checks
from cylc.flow.run_modes.skip import skip_mode_validate
from cylc.flow.subprocctx import SubFuncContext
from cylc.flow.task_events_mgr import (
EventData,
Expand Down Expand Up @@ -563,7 +563,7 @@ def __init__(

self.mem_log("config.py: end init config")

run_mode_validate_checks(self.taskdefs)
skip_mode_validate(self.taskdefs)

@staticmethod
def _warn_if_queues_have_implicit_tasks(
Expand Down Expand Up @@ -688,7 +688,7 @@ def process_initial_cycle_point(self) -> None:
Sets:
self.initial_point
self.cfg['scheduling']['initial cycle point']
self.options.icp
self.evaluated_icp
Raises:
WorkflowConfigError - if it fails to validate
"""
Expand All @@ -708,10 +708,11 @@ def process_initial_cycle_point(self) -> None:
icp = ingest_time(orig_icp, get_current_time_string())
except IsodatetimeError as exc:
raise WorkflowConfigError(str(exc)) from None
if orig_icp != icp:
self.evaluated_icp = None
if icp != orig_icp:
# now/next()/previous() was used, need to store
# evaluated point in DB
self.options.icp = icp
self.evaluated_icp = icp
self.initial_point = get_point(icp).standardise()
self.cfg['scheduling']['initial cycle point'] = str(self.initial_point)

Expand Down
11 changes: 9 additions & 2 deletions cylc/flow/cycling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ def _cmp(self, other) -> int:
"""Compare self to other point, returning a 'cmp'-like result."""
pass

def standardise(self) -> 'PointBase':
"""Format self.value into a standard representation and check it."""
def standardise(self, allow_truncated: bool = True) -> 'PointBase':
"""Format self.value into a standard representation and check it.
Args:
allow_truncated:
If True, then truncated points (i.e. any point with context
missing off the front) will be tollerated, if False, truncated
points will cause an exception to be raised.
"""
return self

@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/cycling/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def sub(self, other):
return IntegerInterval.from_integer(int(self) - int(other))
return IntegerPoint(int(self) - int(other))

def standardise(self):
def standardise(self, allow_truncated=True):
"""Format self.value into a standard representation and check it."""
try:
self.value = str(int(self))
Expand Down
9 changes: 8 additions & 1 deletion cylc/flow/cycling/iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,16 @@ def add(self, other):
self.value, other.value, CALENDAR.mode
))

def standardise(self):
def standardise(self, allow_truncated=True):
"""Reformat self.value into a standard representation."""
try:
point = point_parse(self.value)
if not allow_truncated and point.truncated:
raise PointParsingError(
type(self),
self.value,
'Truncated ISO8601 dates are not permitted',
)
self.value = str(point_parse(self.value))
except IsodatetimeError as exc:
if self.value.startswith("+") or self.value.startswith("-"):
Expand Down
4 changes: 2 additions & 2 deletions cylc/flow/cycling/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ def standardise_point_string(


def standardise_point_string(
point_string: Optional[str], cycling_type: Optional[str] = None
point_string: Optional[str], cycling_type: Optional[str] = None,
) -> Optional[str]:
"""Return a standardised version of point_string."""
if point_string is None:
return None
point = get_point(point_string, cycling_type=cycling_type)
if point is not None:
point.standardise()
point.standardise(allow_truncated=False)
point_string = str(point)
return point_string
10 changes: 6 additions & 4 deletions cylc/flow/data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def increment_graph_window(
)
for items in graph_children.values():
for child_name, child_point, _ in items:
if child_point > final_point:
if final_point and child_point > final_point:
continue
child_tokens = self.id_.duplicate(
cycle=str(child_point),
Expand Down Expand Up @@ -979,7 +979,7 @@ def increment_graph_window(
taskdefs
).values():
for parent_name, parent_point, _ in items:
if parent_point > final_point:
if final_point and parent_point > final_point:
continue
parent_tokens = self.id_.duplicate(
cycle=str(parent_point),
Expand Down Expand Up @@ -1420,7 +1420,7 @@ def apply_task_proxy_db_history(self):
itask, is_parent = self.db_load_task_proxies[relative_id]
itask.submit_num = submit_num
flow_nums = deserialise_set(flow_nums_str)
# Do not set states and outputs for future tasks in flow.
# Do not set states and outputs for inactive tasks in flow.
if (
itask.flow_nums and
flow_nums != itask.flow_nums and
Expand Down Expand Up @@ -2251,7 +2251,9 @@ def delta_broadcast(self):

def _generate_broadcast_node_deltas(self, node_data, node_type):
cfg = self.schd.config.cfg
for node_id, node in node_data.items():
# NOTE: node_data may change during operation so make a copy
# see https://github.com/cylc/cylc-flow/pull/6397
for node_id, node in list(node_data.items()):
tokens = Tokens(node_id)
new_runtime = runtime_from_config(
self._apply_broadcasts_to_runtime(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,18 @@ def __call__(self, grid_x, grid_y):
return z_val


def parse_domain(domain):
bbox = list(map(float, domain.split(',')))
def parse_domain(domain: str):
lng1, lat1, lng2, lat2 = list(map(float, domain.split(',')))
msg = "Invalid domain '{}' ({} {} >= {})"
if lng1 >= lng2:
raise ValueError(msg.format(domain, 'longitude', lng1, lng2))
if lat1 >= lat2:
raise ValueError(msg.format(domain, 'latitude', lat1, lat2))
return {
'lng1': bbox[0],
'lat1': bbox[1],
'lng2': bbox[2],
'lat2': bbox[3]
'lng1': lng1,
'lat1': lat1,
'lng2': lng2,
'lat2': lat2,
}


Expand Down
30 changes: 13 additions & 17 deletions cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,6 @@ class Meta:
string_extended = String()


def describe_run_mode(run_mode: Optional['Enum']) -> str:
"""Returns description for a workflow/task run mode."""
if not run_mode:
return ""
return getattr(RunMode, run_mode.value.upper()).__doc__


# The run mode for the workflow.
WorkflowRunMode = graphene.Enum(
'WorkflowRunMode',
Expand Down Expand Up @@ -2029,17 +2022,20 @@ class Arguments:
class FlowMutationArguments:
flow = graphene.List(
graphene.NonNull(Flow),
default_value=[FLOW_ALL],
default_value=[],
description=sstrip(f'''
The flow(s) to trigger these tasks in.
This should be a list of flow numbers OR a single-item list
containing one of the following three strings:
* {FLOW_ALL} - Triggered tasks belong to all active flows
(default).
* {FLOW_NEW} - Triggered tasks are assigned to a new flow.
* {FLOW_NONE} - Triggered tasks do not belong to any flow.
The flow(s) to trigger/set these tasks in.
By default:
* active tasks (n=0) keep their existing flow assignment
* inactive tasks (n>0) get assigned all active flows
Otherwise you can assign (inactive tasks) or add to (active tasks):
* a list of integer flow numbers
or one of the following strings:
* {FLOW_ALL} - all active flows
* {FLOW_NEW} - an automatically generated new flow number
* {FLOW_NONE} - (ignored for active tasks): no flow
''')
)
flow_wait = Boolean(
Expand Down
Loading

0 comments on commit 047c76f

Please sign in to comment.