-
Notifications
You must be signed in to change notification settings - Fork 74
Rename and reorganize some Scheduler methods #975
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
Rename and reorganize some Scheduler methods #975
Conversation
…r some reuse by ParallelTrialScheduler
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
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 refactors the Scheduler methods to improve clarity and support the upcoming ParallelScheduler changes. Key changes include renaming methods (e.g., schedule_trial to add_trial_to_queue), moving common functionality into the base class, and subtly updating trial filtering logic in pending_trials.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
mlos_bench/tests/storage/trial_schedule_test.py | Added tests for the new trial_runner_assigned parameter in pending_trials |
mlos_bench/storage/sql/experiment.py | Updated pending_trials to support optional filtering based on trial runner status |
mlos_bench/storage/base_storage.py | Revised interface of pending_trials with new optional trial_runner_assigned flag |
mlos_bench/schedulers/trial_runner.py | Modified run_trial to return a tuple containing status, timestamp, and results |
mlos_bench/schedulers/sync_scheduler.py | Removed redundant start method implementation |
mlos_bench/schedulers/base_scheduler.py | Renamed methods and restructured the scheduling loop |
.vscode/settings.json | Adjusted VS Code settings for import organization |
Comments suppressed due to low confidence (2)
mlos_bench/mlos_bench/schedulers/trial_runner.py:171
- The docstring for run_trial does not reflect its updated return type. Please update the documentation to specify that the function returns a tuple with (Status, datetime, dict[str, TunableValue] | None).
def run_trial(self, trial: Storage.Trial, global_config: dict[str, Any] | None = None) -> tuple[Status, datetime, dict[str, TunableValue] | None]:
mlos_bench/mlos_bench/schedulers/base_scheduler.py:523
- Since pending_trials is filtered using trial_runner_assigned=True, the following check for trial.trial_runner_id being None might be redundant. Please verify that this extra safeguard is intended and necessary.
if trial.trial_runner_id is None:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice and clean! Thanks!
Pull Request
Title
Rename and reorganize some Scheduler methods
Description
In preparation for ParallelScheduler PR (#971) this PR
schedule_trial
-->add_trial_to_queue
) so that the role of other methods (e.g.,assign_trial_runners
) is more clear and readily overridable.This is done based on an observation that some of the methods (e.g., the main
start
loop) are largely reusable across both SyncScheduler and ParallelScheduler if the method separation is done a little bit more fine grained such that each can override the only the parts they need to.Additionall, it also
pending_trials
method in order to filter based on whether or not the trial already has a runner assigned or not.TrialRunner.run_trial
to return the results of the Trial.This isn't really used anywhere, but it is helpful to check that TrialRunners run in a child process finished successfully by using that result as a check in the return value, even though for Optimizer bulk_registering it actually pulls the results back off of Storage in the MainProcess.
Type of Change
Testing
pending_trials
Additional Notes (optional)