Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Jun 27, 2024
1 parent 4e15840 commit b541ee0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
17 changes: 9 additions & 8 deletions cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from cylc.flow.workflow_status import StopMode

if TYPE_CHECKING:
from enum import Enum
from graphql import ResolveInfo
from graphql.type.definition import (
GraphQLNamedType,
Expand Down Expand Up @@ -1541,9 +1542,9 @@ class RuntimeConfiguration(String):


class BroadcastMode(graphene.Enum):
Set = 'put_broadcast'
Clear = 'clear_broadcast'
Expire = 'expire_broadcast'
Set = cast('Enum', 'put_broadcast')
Clear = cast('Enum', 'clear_broadcast')
Expire = cast('Enum', 'expire_broadcast')

@property
def description(self):
Expand Down Expand Up @@ -1668,10 +1669,10 @@ class WorkflowStopMode(graphene.Enum):
# * Graphene requires special enums.
# * We only want to offer a subset of stop modes (REQUEST_* only).

Clean = StopMode.REQUEST_CLEAN.value # type: graphene.Enum
Kill = StopMode.REQUEST_KILL.value # type: graphene.Enum
Now = StopMode.REQUEST_NOW.value # type: graphene.Enum
NowNow = StopMode.REQUEST_NOW_NOW.value # type: graphene.Enum
Clean = cast('Enum', StopMode.REQUEST_CLEAN.value)
Kill = cast('Enum', StopMode.REQUEST_KILL.value)
Now = cast('Enum', StopMode.REQUEST_NOW.value)
NowNow = cast('Enum', StopMode.REQUEST_NOW_NOW.value)

@property
def description(self):
Expand Down Expand Up @@ -1728,7 +1729,7 @@ class Arguments:
mode = BroadcastMode(
# use the enum name as the default value
# https://github.com/graphql-python/graphql-core-legacy/issues/166
default_value=BroadcastMode.Set.name, # type: ignore
default_value=BroadcastMode.Set.name,
description='What type of broadcast is this?',
required=True
)
Expand Down
13 changes: 6 additions & 7 deletions cylc/flow/task_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,24 +173,23 @@ class RunMode:
WORKFLOW = 'workflow'
"""Default to workflow run mode"""

MODES = {LIVE, SIMULATION, DUMMY, SKIP, WORKFLOW}
MODES = frozenset({LIVE, SIMULATION, DUMMY, SKIP, WORKFLOW})

WORKFLOW_MODES = [LIVE, DUMMY, SIMULATION, SKIP]
WORKFLOW_MODES = (LIVE, DUMMY, SIMULATION, SKIP)
"""Workflow mode not sensible mode for workflow.
n.b. converted to a list to ensure ordering doesn't change in
CLI
n.b. not using a set to ensure ordering in CLI
"""

JOB_MODES = {LIVE, DUMMY}
JOB_MODES = frozenset({LIVE, DUMMY})
"""Modes which need to have real jobs submitted."""

JOBLESS_MODES = {SKIP, SIMULATION}
JOBLESS_MODES = frozenset({SKIP, SIMULATION})
"""Modes which completely ignore the standard submission path."""

@staticmethod
def get(options: 'Values') -> str:
"""Return the run mode from the options."""
"""Return the workflow run mode from the options."""
return getattr(options, 'run_mode', None) or RunMode.LIVE

@staticmethod
Expand Down

0 comments on commit b541ee0

Please sign in to comment.