Skip to content

Commit

Permalink
Add flag to command
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWales committed Dec 3, 2024
1 parent 3e9e9a6 commit 656c275
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cylc/flow/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async def remove_tasks(


@_command('reload_workflow')
async def reload_workflow(schd: 'Scheduler', reload_global: bool):
async def reload_workflow(schd: 'Scheduler', reload_global: bool = False):
"""Reload workflow configuration."""
yield
# pause the workflow if not already
Expand Down
4 changes: 4 additions & 0 deletions cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,10 @@ class Meta:
class Arguments:
workflows = graphene.List(WorkflowID, required=True)

reload_global = Boolean(
default_value=False,
description="Also reload global config")

result = GenericScalar()


Expand Down
11 changes: 10 additions & 1 deletion cylc/flow/scripts/reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@

MUTATION = '''
mutation (
$wFlows: [WorkflowID]!
$wFlows: [WorkflowID]!,
$reloadGlobal: Boolean,
) {
reload (
workflows: $wFlows
reloadGlobal: $reloadGlobal
) {
result
}
Expand All @@ -87,6 +89,12 @@ def get_option_parser():
multiworkflow=True,
argdoc=[WORKFLOW_ID_MULTI_ARG_DOC],
)

parser.add_option(
"-g", "--global",
help="also reload global configuration.",
action="store_true", default=False, dest="reload_global")

return parser


Expand All @@ -97,6 +105,7 @@ async def run(options: 'Values', workflow_id: str):
'request_string': MUTATION,
'variables': {
'wFlows': [workflow_id],
'reloadGlobal': options.reload_global,
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async def test_reload_global(
[[[meta]]]
x = 1
""")
assert glbl_cfg().get(['platforms','localhost','meta','x']) == '1'
assert glbl_cfg(reload=True).get(['platforms','localhost','meta','x']) == '1'

# Modify the global config file
global_config_path.write_text("""
Expand Down

0 comments on commit 656c275

Please sign in to comment.