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

[tune] Optional forcible trial cleanup, return default autofilled metrics even if Trainable doesn't report at least once #19144

Merged
merged 27 commits into from
Oct 8, 2021

Conversation

Yard1
Copy link
Member

@Yard1 Yard1 commented Oct 6, 2021

Why are these changes needed?

This PR adds two features:

  1. An option to forcibly terminate trials scheduled for cleanup after a grace period of 60 seconds. By default this is False (old behavior). This is controlled by a new env var, TUNE_FORCE_TRIAL_CLEANUP.
  2. An assurance that even if the Trainable doesn't get to report results at least once (due to an error or termination), auto-filled metrics will be returned.

Related issue number

Closes #18745

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@xwjiang2010
Copy link
Contributor

Thanks for picking this up. Can you add a screenshot of what the autofilled metrics would look like?

@Yard1 Yard1 requested a review from xwjiang2010 October 6, 2021 23:48
Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

Looks good so far!

doc/source/tune/user-guide.rst Outdated Show resolved Hide resolved
python/ray/tune/ray_trial_executor.py Show resolved Hide resolved
@@ -123,15 +130,27 @@ def cleanup(self, partial: bool = True):
If partial=False, all futures are expected to return. If a future
does not return within the timeout period, the cleanup terminates.
"""
# At this point, self._cleanup_map holds the last references
Copy link
Contributor

Choose a reason for hiding this comment

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

@krfricke Do you know why we return_pg before calling trainable.stop()?
If pg is gone, it doesn't make sense to stop the actor anymore?

Also if we can rely on GC to always clean up remote actor, why do we bother with self._cleanup_map anyways?

Copy link
Member Author

@Yard1 Yard1 Oct 7, 2021

Choose a reason for hiding this comment

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

Also if we can rely on GC to always clean up remote actor, why do we bother with self._cleanup_map anyways?

We want to have a way to keep a reference for the actor during graceful termination so that the cleanup method may finish

@xwjiang2010
Copy link
Contributor

LGTM. Just some questions for my own understanding.

Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@krfricke krfricke merged commit c7d6f83 into ray-project:master Oct 8, 2021
@Yard1 Yard1 deleted the force_trial_cleanup branch October 8, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Tune trials terminated with ERROR have no "loc"
3 participants