Skip to content

Commit b4ee741

Browse files
committed
graphene/graphql-core v3 upgrade
1 parent 4686f5f commit b4ee741

File tree

9 files changed

+231
-299
lines changed

9 files changed

+231
-299
lines changed

conda-environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- ansimarkup >=1.0.0
66
- async-timeout>=3.0.0
77
- colorama >=0.4,<1.0
8-
- graphene >=2.1,<3
8+
- graphene >=3.4.3,<4
99
- graphviz # for static graphing
1010
# Note: can't pin jinja2 any higher than this until we give up on Cylc 7 back-compat
1111
- jinja2 >=3.0,<3.1

cylc/flow/commands.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@
7474
)
7575
import cylc.flow.flags
7676
from cylc.flow.log_level import log_level_to_verbosity
77-
from cylc.flow.network.schema import WorkflowStopMode
7877
from cylc.flow.parsec.exceptions import ParsecError
7978
from cylc.flow.task_id import TaskID
8079
from cylc.flow.workflow_status import RunMode, StopMode
8180

8281
from metomi.isodatetime.parsers import TimePointParser
8382

8483
if TYPE_CHECKING:
84+
from enum import Enum
8585
from cylc.flow.scheduler import Scheduler
8686

8787
# define a type for command implementations
@@ -165,7 +165,7 @@ async def set_prereqs_and_outputs(
165165
@_command('stop')
166166
async def stop(
167167
schd: 'Scheduler',
168-
mode: Union[str, 'StopMode'],
168+
mode: Union[str, 'Enum'],
169169
cycle_point: Optional[str] = None,
170170
# NOTE clock_time YYYY/MM/DD-HH:mm back-compat removed
171171
clock_time: Optional[str] = None,
@@ -203,10 +203,10 @@ async def stop(
203203
schd._update_workflow_state()
204204
else:
205205
# immediate shutdown
206-
with suppress(KeyError):
207-
# By default, mode from mutation is a name from the
208-
# WorkflowStopMode graphene.Enum, but we need the value
209-
mode = WorkflowStopMode[mode] # type: ignore[misc]
206+
with suppress(AttributeError):
207+
# By default, mode from mutation is a WorkflowStopMode
208+
# graphene.Enum, but we need the value
209+
mode = mode.value # type: ignore
210210
try:
211211
mode = StopMode(mode)
212212
except ValueError:
@@ -298,10 +298,10 @@ async def pause(schd: 'Scheduler'):
298298

299299

300300
@_command('set_verbosity')
301-
async def set_verbosity(schd: 'Scheduler', level: Union[int, str]):
301+
async def set_verbosity(schd: 'Scheduler', level: 'Enum'):
302302
"""Set workflow verbosity."""
303303
try:
304-
lvl = int(level)
304+
lvl = int(level.value)
305305
LOG.setLevel(lvl)
306306
except (TypeError, ValueError) as exc:
307307
raise CommandFailedError(exc) from None

0 commit comments

Comments
 (0)