diff --git a/cylc/flow/scripts/install.py b/cylc/flow/scripts/install.py index be9583137e9..1fafa2375fe 100755 --- a/cylc/flow/scripts/install.py +++ b/cylc/flow/scripts/install.py @@ -343,6 +343,20 @@ def install( exc ) from None + for entry_point in iter_entry_points( + 'cylc.xtriggers' + ): + try: + entry_point.resolve()() + except Exception as exc: + # NOTE: except Exception (purposefully vague) + # this is to separate plugin from core Cylc errors + raise PluginError( + 'cylc.xtriggers', + entry_point.name, + exc + ) from None + print(f'INSTALLED {workflow_id} from {source_dir}') return workflow_name, workflow_id diff --git a/cylc/flow/subprocpool.py b/cylc/flow/subprocpool.py index c380bdaa3e8..dfacd664832 100644 --- a/cylc/flow/subprocpool.py +++ b/cylc/flow/subprocpool.py @@ -28,7 +28,7 @@ from subprocess import DEVNULL, run # nosec from typing import Any, Callable, List, Optional -from cylc.flow import LOG +from cylc.flow import LOG, iter_entry_points from cylc.flow.cfgspec.glbl_cfg import glbl_cfg from cylc.flow.cylc_subproc import procopen from cylc.flow.exceptions import PlatformLookupError @@ -43,6 +43,12 @@ _XTRIG_FUNCS: dict = {} +# Add in xtriggers from entry_points for external sources +for entry_point in iter_entry_points('cylc.xtriggers'): + entry = entry_point.resolve()() + for func_name, func in entry.items(): + _XTRIG_FUNCS[func_name] = func + def _killpg(proc, signal): """Kill a process group."""