Skip to content

Retrying remote-init on failure from restart - #7379

Open
samuel-denton wants to merge 6 commits into
cylc:8.6.xfrom
samuel-denton:remote-init_retry_on_failure
Open

Retrying remote-init on failure from restart#7379
samuel-denton wants to merge 6 commits into
cylc:8.6.xfrom
samuel-denton:remote-init_retry_on_failure

Conversation

@samuel-denton

@samuel-denton samuel-denton commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Closes #7286
Added some re-try logic when remote-init failures are returned following a restart.
Ran isort

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@samuel-denton samuel-denton self-assigned this Jul 10, 2026
@samuel-denton samuel-denton added bug Something is wrong :( small labels Jul 10, 2026
Comment thread cylc/flow/scheduler.py
@samuel-denton
samuel-denton marked this pull request as ready for review July 10, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves restart behavior for remote initialization by retrying remote-init / file installation when the remote step returns an SSH 255 condition, and adds an integration test to cover the new retry behavior.

Changes:

  • Update Scheduler.manage_remote_init to retry remote-init / file install on 255, instead of dropping the install target from restart tracking.
  • Add an integration test that exercises the retry and cleanup behavior across the relevant status transitions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cylc/flow/scheduler.py Adjusts restart-time remote init management to retry on 255 and only remove targets on completion/fatal failure.
tests/integration/test_scheduler.py Adds coverage for the retry-on-255 restart behavior and expected map cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/test_scheduler.py Outdated
Comment thread cylc/flow/scheduler.py
Comment thread cylc/flow/scheduler.py
Comment on lines +933 to +940
elif status == REMOTE_INIT_255:
# Remote init failed due to unreachable host, retry.
del remote_mgr.remote_init_map[install_target]
remote_mgr.remote_init(platform)
elif status == REMOTE_FILE_INSTALL_255:
# File install failed due to unreachable host, retry.
del remote_mgr.remote_init_map[install_target]
remote_mgr.file_install(platform)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have gotta feeling that deleting the remote_init_map entry deletes the state of all prior progress.

I.e, For REMOTE_FILE_INSTALL_255 that would delete the state which indicated successful remote-init.

Do we need to delete the remote_init_map state to force retry, or is it enough to just call the relevant method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure, ill have a play.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both remote_init() and file_install() set the entry in the map almost immediately, so I don't think the del is needed before either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think you are correct. When I tested this I briefly saw some odd behaviour but that might be another bug. It seems to work, but when I clicked on a running task in the GUI, and asked it to show the log, it just gave me an error that it couldn't connect to bad1.
^^ Different issue. we can remove the del lines.

@MetRonnie

Copy link
Copy Markdown
Member

Is there an issue linked to this? If not it would be useful to include some more details on the original post explaining the problem statement

@samuel-denton

Copy link
Copy Markdown
Contributor Author

Is there an issue linked to this? If not it would be useful to include some more details on the original post explaining the problem statement

Yep sorry I forgot to link it. It's #7286, now added to the PR

@MetRonnie MetRonnie linked an issue Jul 22, 2026 that may be closed by this pull request
@MetRonnie

Copy link
Copy Markdown
Member

Note GH doesn't link PRs that are against non-master branch to the issue in the sidebar and it has to be done manually (and in this case the issue wouldn't come up in the search for some reason, so had to go to the issue and link the PR instead)

image

@MetRonnie

This comment was marked as off-topic.

@samuel-denton

This comment was marked as resolved.

@MetRonnie

This comment was marked as resolved.

@MetRonnie MetRonnie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I understand how to repro now and have confirmed this fixes it. The del statements ought to be removed as not needed (and I think the test will need adjusting): https://github.com/cylc/cylc-flow/pull/7379/changes#r3644924502

…atus.

Removed the matching assert lines in the relevant integration test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is wrong :( small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restart: remote-init should retry in the event of failure

4 participants