-
Notifications
You must be signed in to change notification settings - Fork 74
Introduce mock_trial_data for MockEnv and add some basic Scheduler tests #980
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
Draft
bpkroth
wants to merge
84
commits into
microsoft:main
Choose a base branch
from
bpkroth:refactor/mock-scheduler-and-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
cd8b88f
Start introducing MockScheduler for better Scheduler testing
2c9c968
fixup scheduler schemas refactor
2f4a82e
reorg optimizer fixtures for reuse
24ccf5a
reorg files based storage fixture
bdfd9b0
adding basic scheduler config example loader test
b66e17a
Refactor Scheduler schema definitions to make it easier to add new ones.
30191c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bc8dc8f
Refactor some test fixtures for better reuse so we can test loading S…
ea7b3ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7563b8a
fixup
b03e31c
lint
8eb14c0
apply suggestions
8ad4c3d
revert
d4d5153
load test configs too
1eb1acb
format
947b759
Merge branch 'refactor/tests' into refactor/mock-scheduler-and-tests
0c3c805
Merge branch 'refactor/scheduler-schemas' into refactor/mock-schedule…
1112af4
list in __all__ so we load it as a part of tests schemas checking
973ad2b
Merge branch 'main' into refactor/mock-scheduler-and-tests
7a0d087
new mock scheduler schema and test configs
dded243
refactor to split steps for easier hooking
c305196
Merge remote-tracking branch 'upstream/main' into refactor/mock-sched…
b16db23
Merge branch 'main' into refactor/mock-scheduler-and-tests
bpkroth f1fe022
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 83ff70f
Update mlos_bench/mlos_bench/tests/config/schedulers/test_load_schedu…
bpkroth 71420e6
fixup
70130ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0a440a1
ignore the build tree in vscode
efafc6f
adding more accessors
842d393
wip: enable mock env to report arbitrary data
19cec78
spelling
175f315
refactor status parsing a little bit again
7904716
extra test too
54a96e8
more links
2e1c4db
start adding a mock trial runner
626554d
Revert "start adding a mock trial runner"
b87c02a
schema work on mock trial data
b4e5640
remove mock scheduler
80cf2fa
allow mock trial data to be in the global config as well
8426621
comments as prompts in preparation to run a trial
cdc614f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b3f49e9
fixups
a41e85f
revert
63e0f88
remove
44bdde2
refactor status parsing a little bit again
607fffd
extra test too
aaf0842
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8f472bb
revert
8a4aac2
comments
50ffde4
add accessor for the mock_trial_data property
b1e2a52
make it a property
f0f7c4c
add some basic fixtures to get started with
c27b3c2
add a method for creating schedulers, intended to be used with pytest…
9813268
stubbing out a very basic test to get started
3b92017
wip: testing
341564e
wip
5c06814
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 836dcd9
comments
0072141
fixups
5400bd6
more checks
e62a378
Add more checks
206bb77
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] abe412b
linting
f5cb468
doc tweaks
c047bc2
Merge branch 'refactor/parse-status' into refactor/mock-scheduler-and…
dc7a7b2
fixup
76e94ed
fixup
7f8522a
fixups
9e03e63
remove old files
f9e3339
add some common globals
a05b5ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 94e31b5
simplify
21e49db
rename
46be004
fixup
01f7a02
always try and convert metrics back to numerics if possible
b035e57
wip: tell mysql to use a datetime that can store fractional seconds
ca101ef
add more trial data for testing
98ec1cc
:type fixups
82f602c
check the telemetry
176480f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 22f4e79
revert the bulk conversion one
aa9f728
debugging
6289216
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5be025e
Merge branch 'main' into refactor/mock-scheduler-and-tests
bpkroth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,9 @@ | |
| }, | ||
| "optimization_targets": { | ||
| "$ref": "./common-defs-subschemas.json#/$defs/optimization_targets" | ||
| }, | ||
| "mock_trial_data": { | ||
| "$ref": "../environments/mock-env-subschema.json#/$defs/mock_trial_data" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allow specifying mock trial data in the globals too. |
||
| } | ||
| }, | ||
| "additionalProperties": { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -363,6 +363,92 @@ def parameters(self) -> dict[str, TunableValue]: | |
| """ | ||
| return self._params.copy() | ||
|
|
||
| @property | ||
| def current_trial_id(self) -> int: | ||
| """ | ||
| Get the current trial ID. | ||
|
|
||
| This value can be used in scripts or environment variables to help | ||
| identify the Trial this Environment is currently running. | ||
|
|
||
| Returns | ||
| ------- | ||
| trial_id : int | ||
| The current trial ID. | ||
|
|
||
| Notes | ||
| ----- | ||
| This method is used to identify the current trial ID for the environment. | ||
| It is expected to be called *after* the base | ||
| :py:meth:`Environment.setup` method has been called and parameters have | ||
| been assigned. | ||
| """ | ||
| val = self._params["trial_id"] | ||
| assert isinstance(val, int), ( | ||
| "Expected trial_id to be an int, but got %s (type %s): %s", | ||
| val, | ||
| type(val), | ||
| self._params, | ||
| ) | ||
| return val | ||
|
|
||
| @property | ||
| def trial_runner_id(self) -> int: | ||
| """ | ||
| Get the ID of the :py:class:`~.mlos_bench.schedulers.trial_runner.TrialRunner` | ||
| for this Environment. | ||
|
|
||
| This value can be used in scripts or environment variables to help | ||
| identify the TrialRunner for this Environment. | ||
|
|
||
| Returns | ||
| ------- | ||
| trial_runner_id : int | ||
| The trial runner ID. | ||
|
|
||
| Notes | ||
| ----- | ||
| This shouldn't change during the lifetime of the Environment since each | ||
| Environment is assigned to a single TrialRunner. | ||
| """ | ||
| val = self._params["trial_runner_id"] | ||
| assert isinstance(val, int), ( | ||
| "Expected trial_runner_id to be an int, but got %s (type %s)", | ||
| val, | ||
| type(val), | ||
| ) | ||
| return val | ||
|
|
||
| @property | ||
| def experiment_id(self) -> str: | ||
| """ | ||
| Get the ID of the experiment. | ||
|
|
||
| This value can be used in scripts or environment variables to help | ||
| identify the TrialRunner for this Environment. | ||
|
|
||
| Returns | ||
| ------- | ||
| experiment_id : str | ||
| The ID of the experiment. | ||
|
|
||
| Notes | ||
| ----- | ||
| This value comes from the globals config or ``mlos_bench`` CLI arguments | ||
| in the experiment setup. | ||
|
|
||
| See Also | ||
| -------- | ||
| mlos_bench.config : documentation on the configuration system | ||
| """ | ||
| val = self._params["experiment_id"] | ||
| assert isinstance(val, str), ( | ||
| "Expected experiment_id to be an int, but got %s (type %s)", | ||
| val, | ||
| type(val), | ||
| ) | ||
| return val | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add some basic accessor methods. |
||
| def setup(self, tunables: TunableGroups, global_config: dict | None = None) -> bool: | ||
| """ | ||
| Set up a new benchmark environment, if necessary. This method must be | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Tell the editor to ignore scanning some python file copies