Skip to content

Commit

Permalink
Add BroadcastCyclePoint type to schema (#5007)
Browse files Browse the repository at this point in the history
* Broadcast mutation schema: add BroadcastCyclePoint type

* Consistent lowercase for workflow status

* Update changelog [skip ci]
  • Loading branch information
MetRonnie authored Aug 3, 2022
1 parent c0360fc commit 7d2189e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ creating a new release entry be sure to copy & paste the span tag with the
`actions:bind` attribute, which is used by a regex to find the text to be
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->
-------------------------------------------------------------------------------
## __cylc-8.0.1 (<span actions:bind='release-date'>Upcoming</span>)__

Maintenance release.

### Fixes

[#5007](https://github.com/cylc/cylc-flow/pull/5007) - Fix for `cylc broadcast`
cycle point validation in the UI.

-------------------------------------------------------------------------------
## __cylc-8.0.0 (<span actions:bind='release-date'>Released 2022-07-28</span>)__

Expand Down
7 changes: 6 additions & 1 deletion cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,11 @@ class BroadcastSetting(GenericScalar):
"""


class BroadcastCyclePoint(graphene.String):
"""A cycle point or `*`."""
# (broadcast supports either of those two but not cycle point globs)


class TaskStatus(graphene.Enum):
"""The status of a task in a workflow."""

Expand Down Expand Up @@ -1450,7 +1455,7 @@ class Arguments:
required=True
)
cycle_points = graphene.List(
CyclePoint,
BroadcastCyclePoint,
description=sstrip('''
List of cycle points to target (or `*` to cancel all all-cycle
broadcasts without canceling all specific-cycle broadcasts).
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/scripts/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
mutation (
$wFlows: [WorkflowID]!,
$bMode: BroadcastMode!,
$cPoints: [CyclePoint],
$cPoints: [BroadcastCyclePoint],
$nSpaces: [NamespaceName],
$bSettings: [BroadcastSetting],
$bCutoff: CyclePoint
Expand Down
16 changes: 8 additions & 8 deletions cylc/flow/workflow_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ def explain(self) -> str:
to clarify what the scheduler is doing.
"""
if self in (self.AUTO, self.REQUEST_CLEAN): # type: ignore
return 'Waiting for active jobs to complete'
return 'waiting for active jobs to complete'
if self == self.REQUEST_KILL: # type: ignore
return 'Killing active jobs'
return 'killing active jobs'
if self in ( # type: ignore
self.AUTO_ON_TASK_FAILURE, # type: ignore
self.REQUEST_NOW,
self.REQUEST_NOW_NOW,
):
return 'Shutting down'
return 'shutting down'
return ''

def describe(self) -> str:
Expand Down Expand Up @@ -142,7 +142,7 @@ class AutoRestartMode(Enum):
"""Workflow will stop immediately but *not* attempt to restart."""


def get_workflow_status(schd: 'Scheduler') -> Tuple[WorkflowStatus, str]:
def get_workflow_status(schd: 'Scheduler') -> Tuple[str, str]:
"""Return the status of the provided workflow.
This should be a short, concise description of the workflow state.
Expand All @@ -164,10 +164,10 @@ def get_workflow_status(schd: 'Scheduler') -> Tuple[WorkflowStatus, str]:

if schd.is_paused:
status = WorkflowStatus.PAUSED
status_msg = 'Paused'
status_msg = 'paused'
elif schd.stop_mode is not None:
status = WorkflowStatus.STOPPING
status_msg = f'Stopping: {schd.stop_mode.explain()}'
status_msg = f'stopping: {schd.stop_mode.explain()}'
elif schd.pool.hold_point:
status_msg = (
WORKFLOW_STATUS_RUNNING_TO_HOLD %
Expand All @@ -190,6 +190,6 @@ def get_workflow_status(schd: 'Scheduler') -> Tuple[WorkflowStatus, str]:
schd.config.final_point)
else:
# fallback - running indefinitely
status_msg = 'Running'
status_msg = 'running'

return (status.value, status_msg) # type: ignore
return (status.value, status_msg)
2 changes: 1 addition & 1 deletion tests/functional/graphql/01-workflow.t
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cmp_json "${TEST_NAME}-out" "${TEST_NAME_BASE}-workflows.stdout" << __HERE__
{
"name": "${WORKFLOW_NAME}",
"status": "paused",
"statusMsg": "Paused",
"statusMsg": "paused",
"host": "${HOST}",
"port": ${PORT},
"owner": "${USER}",
Expand Down

0 comments on commit 7d2189e

Please sign in to comment.