Cylc daemonization on macOS

Thought I’d ask a question for a change… Does anyone out there run Cylc on Apple MacOS?

I recently acquired a MacBook and found that Cylc runs fine in --no-detach mode, but
aborts drops a traceback in detaching mode during the double-fork daemonization process:

INFO - Extracting job.sh to /Users/oliver/cylc-run/bug/run10/.service/etc/job.sh
Traceback (most recent call last):
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/oliver/cylc/cylc-flow/cylc/flow/scheduler_cli.py", line 420, in scheduler_cli
    daemonize(scheduler)
  File "/Users/oliver/cylc/cylc-flow/cylc/flow/daemonize.py", line 122, in daemonize
    sys.exit(0)
SystemExit: 0

I get exactly the same result with the system-installed Python 3.9, homebrew-installed Python 3.12, and conda-installed Python 3.10.

Hi.
I never had this issue. Which version of MacOS are you using? Which version of Cylc?

macOS Sonoma 14.5

cylc-8.3.3 - same result for various Python versions

Ah-ha, I’ve just discovered it doesn’t happen for cylc-8.2.0. I’ll try to narrow it down now…

[UPDATE 1]

  • cylc-8.2.7 with Python 3.11.9 :white_check_mark:
  • cylc-8.3.0 & cylc-8.3.3 with Python 3.11.9 :negative_squared_cross_mark:

So it appears to be due to a change in Cylc for version 8.3.

[UPDATE 2]

  • for 8.3.x the traceback above appears in the terminal, but actually the workflow runs fine (not sure how I missed this earlier!) … so maybe it’s to do with a change in how we raise exceptions from the scheduler …
  • a similar traceback appears in the scheduler log upon ordering a shutdown
2024-08-08T11:42:36+12:00 INFO - DONE
Traceback (most recent call last):
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/Users/oliver/miniforge3/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/oliver/cylc/cylc-flow/cylc/flow/scheduler_cli.py", line 445, in scheduler_cli
    sys.exit(ret)
SystemExit: 0

[UPDATE 3]

Update: This issue is now fixed, for the next Cylc release.

(And for anyone who hits this with the current release note that it isn’t a functional problem, it just looks bad).