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

Experiment Can Stop Launched Jobs #677

Merged
merged 12 commits into from
Aug 30, 2024

Conversation

MattToast
Copy link
Member

Add an Experiment.stop method to stop jobs prematurely. Teach launchers how to stop the jobs that they manage.

launchers how to stop the jobs that they manage.
@MattToast MattToast added type: feature Issues that include feature request or feature idea area: launcher Issues related to any of the launchers within SmartSim area: api Issues related to API changes ignore-for-release labels Aug 27, 2024
@MattToast MattToast self-assigned this Aug 27, 2024
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 91.89189% with 3 lines in your changes missing coverage. Please review.

Project coverage is 43.59%. Comparing base (cce16e6) to head (24a170f).
Report is 19 commits behind head on smartsim-refactor.

Files with missing lines Patch % Lines
smartsim/_core/shell/shellLauncher.py 92.00% 2 Missing ⚠️
smartsim/_core/launcher/dragon/dragonLauncher.py 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##           smartsim-refactor     #677      +/-   ##
=====================================================
+ Coverage              40.45%   43.59%   +3.13%     
=====================================================
  Files                    110      110              
  Lines                   7326     7076     -250     
=====================================================
+ Hits                    2964     3085     +121     
+ Misses                  4362     3991     -371     
Files with missing lines Coverage Δ
smartsim/_core/utils/launcher.py 95.65% <100.00%> (ø)
smartsim/experiment.py 86.33% <100.00%> (+4.77%) ⬆️
smartsim/_core/launcher/dragon/dragonLauncher.py 27.52% <50.00%> (+0.82%) ⬆️
smartsim/_core/shell/shellLauncher.py 95.06% <92.00%> (+34.19%) ⬆️

... and 4 files with indirect coverage changes

Copy link
Contributor

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

Just a couple of questons/comments

raise ValueError("No job ids provided")
by_launcher = self._launch_history.group_by_launcher(set(ids), unknown_ok=True)
id_to_stop_stat = (
launcher.stop_jobs(*launched).items()
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I am thinking about here is stop_jobs may raise a smartsim.error.errors.LauncherJobNotFound, and if it does, it seems like the process only partially completes. Should we complete all of the ones that can complete and then (re)raise the error?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory this cannot happen if the _launch_history is never corrupted (e.g. an id is never mapped to a launcher that never issued it), but I do agree that this could become a problem, especially if users start to make their own launchers.

I moved this to a new issue where it can be discussed further because I think this may be a problem with other methods (e.g. get_status, wait) as well as potentially other errors that can arise when stopping over a collection of ids.

@MattToast MattToast requested a review from mellis13 August 30, 2024 18:13
Copy link
Contributor

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@MattToast MattToast merged commit c1faadd into CrayLabs:smartsim-refactor Aug 30, 2024
34 of 35 checks passed
@MattToast MattToast deleted the kill-job branch August 30, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API changes area: launcher Issues related to any of the launchers within SmartSim ignore-for-release type: feature Issues that include feature request or feature idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants