cylc-flow icon indicating copy to clipboard operation
cylc-flow copied to clipboard

Jinja2 set value where script exits nonzero but doesn't raise

Open wxtim opened this issue 2 months ago • 1 comments

Description

If Jinja2 tries to set a value equal to a script and the script exits non-zero but does not raise an exception the non-daemonized fork of the scheduler remains active and difficult to kill (requires -9).

Reproducible Example

#!jinja2
# flow.cylc
{% from "sys" import exit %}
{% set KEY = exit() %}
cylc install
cylc play <workflow>

Will leave you with at least one workflow process requring kill -9 to kill.

Expected Behaviour

Failure of this sort should kill both forks.

wxtim avatar Oct 22 '25 10:10 wxtim

The Jinja2 template.render() operation seems to hang for cylc play -N but not for cylc validate. Not sure why!

Easy to workaround, use raise Exception not sys.exit in your Jinja2 codes!

Unlikely to crop up again, so a reasonably low priority.

oliver-sanders avatar Oct 22 '25 13:10 oliver-sanders