Skip to content

Commit

Permalink
graphene/graphql-core v3 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsutherland committed Nov 14, 2024
1 parent 4686f5f commit 6258587
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 293 deletions.
2 changes: 1 addition & 1 deletion conda-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- ansimarkup >=1.0.0
- async-timeout>=3.0.0
- colorama >=0.4,<1.0
- graphene >=2.1,<3
- graphene >=3.4.3,<4
- graphviz # for static graphing
# Note: can't pin jinja2 any higher than this until we give up on Cylc 7 back-compat
- jinja2 >=3.0,<3.1
Expand Down
16 changes: 8 additions & 8 deletions cylc/flow/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
)
import cylc.flow.flags
from cylc.flow.log_level import log_level_to_verbosity
from cylc.flow.network.schema import WorkflowStopMode
from cylc.flow.parsec.exceptions import ParsecError
from cylc.flow.task_id import TaskID
from cylc.flow.workflow_status import RunMode, StopMode

from metomi.isodatetime.parsers import TimePointParser

if TYPE_CHECKING:
from enum import Enum
from cylc.flow.scheduler import Scheduler

# define a type for command implementations
Expand Down Expand Up @@ -165,7 +165,7 @@ async def set_prereqs_and_outputs(
@_command('stop')
async def stop(
schd: 'Scheduler',
mode: Union[str, 'StopMode'],
mode: Union[str, 'Enum'],
cycle_point: Optional[str] = None,
# NOTE clock_time YYYY/MM/DD-HH:mm back-compat removed
clock_time: Optional[str] = None,
Expand Down Expand Up @@ -203,10 +203,10 @@ async def stop(
schd._update_workflow_state()
else:
# immediate shutdown
with suppress(KeyError):
# By default, mode from mutation is a name from the
# WorkflowStopMode graphene.Enum, but we need the value
mode = WorkflowStopMode[mode] # type: ignore[misc]
with suppress(AttributeError):
# By default, mode from mutation is a WorkflowStopMode
# graphene.Enum, but we need the value
mode = mode.value # type: ignore

Check warning on line 209 in cylc/flow/commands.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/commands.py#L209

Added line #L209 was not covered by tests
try:
mode = StopMode(mode)
except ValueError:
Expand Down Expand Up @@ -298,10 +298,10 @@ async def pause(schd: 'Scheduler'):


@_command('set_verbosity')
async def set_verbosity(schd: 'Scheduler', level: Union[int, str]):
async def set_verbosity(schd: 'Scheduler', level: Union[int, str, 'Enum']):
"""Set workflow verbosity."""
try:
lvl = int(level)
lvl = int(level.value)

Check warning on line 304 in cylc/flow/commands.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/commands.py#L304

Added line #L304 was not covered by tests
LOG.setLevel(lvl)
except (TypeError, ValueError) as exc:
raise CommandFailedError(exc) from None
Expand Down
Loading

0 comments on commit 6258587

Please sign in to comment.