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 b4ee741
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 299 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
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: 'Enum'):
"""Set workflow verbosity."""
try:
lvl = int(level)
lvl = int(level.value)
LOG.setLevel(lvl)
except (TypeError, ValueError) as exc:
raise CommandFailedError(exc) from None
Expand Down
Loading

0 comments on commit b4ee741

Please sign in to comment.