Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post_configure: ensure asyncio tasks created by plugins are awaited #5868

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions cylc/flow/scripts/validate_install_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ def get_option_parser() -> COP:

@cli_function(get_option_parser)
def main(parser: COP, options: 'Values', workflow_id: Optional[str] = None):
asyncio.run(run(parser, options, workflow_id))


async def run(parser: COP, options: 'Values', workflow_id: Optional[str]):
"""Run Cylc validate - install - play in sequence."""
# NOTE: We call each of the stages in its own event loop because there is a
# strange interaction whereby the cylc.flow.network.scan coroutine pipe can
# cause sys.exit to hang on the original process post-daemonization
Comment on lines +96 to +98
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if not workflow_id:
workflow_id = '.'
orig_source = workflow_id
source = get_source_location(workflow_id)
log_subcommand('validate', source)
await cylc_validate(parser, options, str(source))
asyncio.run(cylc_validate(parser, options, str(source)))

log_subcommand('install', source)
_, workflow_id = await cylc_install(options, workflow_id)
_, workflow_id = asyncio.run(cylc_install(options, workflow_id))

cleanup_sysargv(
'play',
Expand All @@ -121,4 +120,4 @@ async def run(parser: COP, options: 'Values', workflow_id: Optional[str]):

set_timestamps(LOG, options.log_timestamp)
log_subcommand(*sys.argv[1:])
await cylc_play(options, workflow_id)
asyncio.run(cylc_play(options, workflow_id))
Loading