Skip to content

Commit

Permalink
allow workflow config to unset global events config
Browse files Browse the repository at this point in the history
  • Loading branch information
TomekTrzeciak committed Dec 6, 2024
1 parent 7f63b43 commit 71761af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cylc/flow/workflow_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_events_conf(
glbl_cfg().get(['scheduler', 'mail'])
):
value = getter.get(key)
if value is not None and value != []:
if value is not None:
return value
return default

Expand Down
6 changes: 5 additions & 1 deletion tests/unit/test_workflow_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
('handlers', True, True, ['stall']),
('handlers', False, True, None),
('handlers', False, False, None),
('mail events', True, True, []),
('mail events', False, True, ['abort']),
('mail events', False, False, None),
('from', True, True, 'docklands@railway'),
('from', False, True, 'highway@mixture'),
('from', False, False, None),
Expand All @@ -55,13 +58,14 @@ def test_get_events_handler(
from = highway@mixture
[[events]]
abort on workflow timeout = True
mail events = abort
'''
)

config = SimpleNamespace()
config.cfg = {
'scheduler': {
'events': {'handlers': ['stall']},
'events': {'handlers': ['stall'], 'mail events': []},
'mail': {'from': 'docklands@railway'},
} if workflow_cfg else {'events': {}}
}
Expand Down

0 comments on commit 71761af

Please sign in to comment.