From bc86a9b0c2053702d556b1bc781b57e76a25b1a5 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Thu, 13 May 2021 11:14:31 +0100 Subject: [PATCH 1/3] schema: correct faulty enum --- cylc/flow/network/schema.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cylc/flow/network/schema.py b/cylc/flow/network/schema.py index cfa6986189a..d75c3406b71 100644 --- a/cylc/flow/network/schema.py +++ b/cylc/flow/network/schema.py @@ -1445,10 +1445,10 @@ class WorkflowStopMode(Enum): """The mode used to stop a running workflow.""" # Note: contains only the REQUEST_* values from StopMode - Clean = StopMode.REQUEST_CLEAN - Kill = StopMode.REQUEST_KILL - Now = StopMode.REQUEST_NOW - NowNow = StopMode.REQUEST_NOW_NOW + Clean = StopMode.REQUEST_CLEAN.value + Kill = StopMode.REQUEST_KILL.value + Now = StopMode.REQUEST_NOW.value + NowNow = StopMode.REQUEST_NOW_NOW.value @property def description(self): @@ -1722,7 +1722,7 @@ class Meta: class Arguments: workflows = List(WorkflowID, required=True) mode = WorkflowStopMode( - default_value=StopMode.REQUEST_CLEAN + default_value=WorkflowStopMode.Clean.value # type: ignore ) cycle_point = CyclePoint( description='Stop after the workflow reaches this cycle.' From 851484e2a7c48afd4c3256c0a42e616b942a0083 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Fri, 21 May 2021 14:42:27 +0100 Subject: [PATCH 2/3] cli: remove gui from command blacklist --- cylc/flow/network/schema.py | 4 ++++ cylc/flow/scheduler.py | 5 +++++ cylc/flow/scripts/cylc.py | 2 -- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cylc/flow/network/schema.py b/cylc/flow/network/schema.py index d75c3406b71..19298918cd3 100644 --- a/cylc/flow/network/schema.py +++ b/cylc/flow/network/schema.py @@ -1444,6 +1444,10 @@ class TimePoint(String): class WorkflowStopMode(Enum): """The mode used to stop a running workflow.""" + # NOTE: using a different enum because: + # * Graphene requires special enums. + # * We only want to offer a subset of stop modes. + # Note: contains only the REQUEST_* values from StopMode Clean = StopMode.REQUEST_CLEAN.value Kill = StopMode.REQUEST_KILL.value diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index 19e9ac9cf3b..ba08237943b 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -856,6 +856,11 @@ def command_stop( pass else: # immediate shutdown + try: + mode = StopMode(mode) + except ValueError: + LOG.error(f'Invalid stop mode {mode}') + return self._set_stop(mode) if mode is StopMode.REQUEST_KILL: self.time_next_kill = time() diff --git a/cylc/flow/scripts/cylc.py b/cylc/flow/scripts/cylc.py index 8d8b2007e02..ba4dfe7dddd 100644 --- a/cylc/flow/scripts/cylc.py +++ b/cylc/flow/scripts/cylc.py @@ -137,8 +137,6 @@ def get_version(long=False): ' use cylc graph --diff ', 'gscan': 'cylc gscan has been removed, use the web UI', - 'gui': - 'cylc gui has been removed, use the web UI', 'insert': 'inserting tasks is now done automatically', 'jobscript': From 789dbf5a4292efaa204e5fbb7bf95c6b7e15bbdd Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Tue, 24 Aug 2021 16:51:28 +0100 Subject: [PATCH 3/3] cli: change list_plugins to return a string --- cylc/flow/scripts/cylc.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cylc/flow/scripts/cylc.py b/cylc/flow/scripts/cylc.py index ba4dfe7dddd..036cf4c05a9 100644 --- a/cylc/flow/scripts/cylc.py +++ b/cylc/flow/scripts/cylc.py @@ -327,7 +327,7 @@ def cli_version(long_fmt=False): """Wrapper for get_version.""" print(get_version(long_fmt)) if long_fmt: - list_plugins() + print(list_plugins()) sys.exit(0) @@ -355,23 +355,26 @@ def list_plugins(): for entry_point in entry_points } + lines = [] if dists: - print('\nPlugins:') + lines.append('\nPlugins:') maxlen1 = max(len(dist.project_name) for dist in dists) + 2 maxlen2 = max(len(dist.version) for dist in dists) + 2 for dist in dists: - print( + lines.append( f' {dist.project_name.ljust(maxlen1)}' f' {dist.version.ljust(maxlen2)}' f' {dist.module_path}' ) - print('\nEntry Points:') + lines.append('\nEntry Points:') for entry_point_name, entry_points in entry_point_groups.items(): if entry_points: - print(f' {entry_point_name}:') + lines.append(f' {entry_point_name}:') for entry_point in entry_points: - print(f' {entry_point}') + lines.append(f' {entry_point}') + + return '\n'.join(lines) @contextmanager