Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcasting to a truncated cycle point can bring down a workflow #6407

Closed
MetRonnie opened this issue Oct 14, 2024 · 1 comment
Closed

Broadcasting to a truncated cycle point can bring down a workflow #6407

MetRonnie opened this issue Oct 14, 2024 · 1 comment
Assignees
Labels
bug Something is wrong :(
Milestone

Comments

@MetRonnie
Copy link
Member

Description

cylc broadcast is not performing sufficient validation of inputted cycle points.

Reproducible Example

Take any datetime cycling workflow, and broadcast using a cycle point that is truncated, e.g. using only the year of decade 05 instead of the full year 2005:

$ cylc broadcast datetime -p 050101T0000Z -s '[environment]FOO=1'
Broadcast set:
+ [05-01-01T00:00Z/root] [environment]FOO=1

Scheduler log:

INFO - Command "broadcast" received.
    broadcast(cycle_points=['050101T0000Z'], mode=put_broadcast, namespaces=['root'], settings=[{'environment': {'FOO': '1'}}])
INFO - Broadcast set:
    + [05-01-01T00:00Z/root] [environment]FOO=1
...
ERROR - Cannot compare truncated to non-truncated TimePoint: 05-01-01T00:00Z, 20050101T0000Z
    Traceback (most recent call last):
      File "~/cylc-flow/cylc/flow/scheduler_cli.py", line 689, in cylc_play
        asyncio.get_running_loop()
    RuntimeError: no running event loop
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "~/cylc-flow/cylc/flow/scheduler.py", line 652, in run_scheduler
        await self._main_loop()
      File "~/cylc-flow/cylc/flow/scheduler.py", line 1534, in _main_loop
        self.broadcast_mgr.expire_broadcast(self.pool.get_min_point())
      File "~/cylc-flow/cylc/flow/broadcast_mgr.py", line 158, in expire_broadcast
        get_point(point_string) < cutoff_point):
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "~/cylc-flow/cylc/flow/cycling/__init__.py", line 137, in __lt__
        return self.__cmp__(other) == -1
               ^^^^^^^^^^^^^^^^^^^
      File "~/cylc-flow/cylc/flow/cycling/__init__.py", line 129, in __cmp__
        return self._cmp(other)
               ^^^^^^^^^^^^^^^^
      File "~/cylc-flow/cylc/flow/cycling/iso8601.py", line 127, in _cmp
        return self._iso_point_cmp(self.value, other.value, CALENDAR.mode)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "~/cylc-flow/cylc/flow/cycling/iso8601.py", line 135, in _iso_point_cmp
        return cmp(point, other_point)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "~/cylc-flow/cylc/flow/cycling/__init__.py", line 478, in cmp
        if self == other:
           ^^^^^^^^^^^^^
      File "~/micromamba/envs/cylc8/lib/python3.12/site-packages/metomi/isodatetime/data.py", line 1684, in __eq__
        return self._cmp(other, "eq")
               ^^^^^^^^^^^^^^^^^^^^^^
      File "~/micromamba/envs/cylc8/lib/python3.12/site-packages/metomi/isodatetime/data.py", line 1659, in _cmp
        raise ValueError(
    ValueError: Cannot compare truncated to non-truncated TimePoint: 05-01-01T00:00Z, 20050101T0000Z
CRITICAL - Workflow shutting down - Cannot compare truncated to non-truncated TimePoint: 05-01-01T00:00Z, 20050101T0000Z

This results in the scheduler crashing immediately on startup if you try to restart the workflow.

Expected Behaviour

cylc broadcast should fail if you pass it a truncated cycle point? It certainly shouldn't crash the scheduler.

@MetRonnie MetRonnie added the bug Something is wrong :( label Oct 14, 2024
@MetRonnie MetRonnie added this to the 8.3.6 milestone Oct 14, 2024
@oliver-sanders oliver-sanders self-assigned this Oct 15, 2024
oliver-sanders added a commit to oliver-sanders/cylc-flow that referenced this issue Oct 15, 2024
@oliver-sanders
Copy link
Member

Closed by #6414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

No branches or pull requests

2 participants