-
Notifications
You must be signed in to change notification settings - Fork 73
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
bpkroth 2c9c968
fixup scheduler schemas refactor
bpkroth 2f4a82e
reorg optimizer fixtures for reuse
bpkroth 24ccf5a
reorg files based storage fixture
bpkroth bdfd9b0
adding basic scheduler config example loader test
bpkroth b66e17a
Refactor Scheduler schema definitions to make it easier to add new ones.
bpkroth 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…
bpkroth ea7b3ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7563b8a
fixup
bpkroth b03e31c
lint
bpkroth 8eb14c0
apply suggestions
bpkroth 8ad4c3d
revert
bpkroth d4d5153
load test configs too
bpkroth 1eb1acb
format
bpkroth 947b759
Merge branch 'refactor/tests' into refactor/mock-scheduler-and-tests
bpkroth 0c3c805
Merge branch 'refactor/scheduler-schemas' into refactor/mock-schedule…
bpkroth 1112af4
list in __all__ so we load it as a part of tests schemas checking
bpkroth 973ad2b
Merge branch 'main' into refactor/mock-scheduler-and-tests
bpkroth 7a0d087
new mock scheduler schema and test configs
bpkroth dded243
refactor to split steps for easier hooking
bpkroth c305196
Merge remote-tracking branch 'upstream/main' into refactor/mock-sched…
bpkroth 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
bpkroth 70130ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0a440a1
ignore the build tree in vscode
bpkroth efafc6f
adding more accessors
bpkroth 842d393
wip: enable mock env to report arbitrary data
bpkroth 19cec78
spelling
bpkroth 175f315
refactor status parsing a little bit again
bpkroth 7904716
extra test too
bpkroth 54a96e8
more links
bpkroth 2e1c4db
start adding a mock trial runner
bpkroth 626554d
Revert "start adding a mock trial runner"
bpkroth b87c02a
schema work on mock trial data
bpkroth b4e5640
remove mock scheduler
bpkroth 80cf2fa
allow mock trial data to be in the global config as well
bpkroth 8426621
comments as prompts in preparation to run a trial
bpkroth cdc614f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b3f49e9
fixups
bpkroth a41e85f
revert
bpkroth 63e0f88
remove
bpkroth 44bdde2
refactor status parsing a little bit again
bpkroth 607fffd
extra test too
bpkroth aaf0842
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8f472bb
revert
bpkroth 8a4aac2
comments
bpkroth 50ffde4
add accessor for the mock_trial_data property
bpkroth b1e2a52
make it a property
bpkroth f0f7c4c
add some basic fixtures to get started with
bpkroth c27b3c2
add a method for creating schedulers, intended to be used with pytest…
bpkroth 9813268
stubbing out a very basic test to get started
bpkroth 3b92017
wip: testing
bpkroth 341564e
wip
bpkroth 5c06814
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 836dcd9
comments
bpkroth 0072141
fixups
bpkroth 5400bd6
more checks
bpkroth e62a378
Add more checks
bpkroth 206bb77
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] abe412b
linting
bpkroth f5cb468
doc tweaks
bpkroth c047bc2
Merge branch 'refactor/parse-status' into refactor/mock-scheduler-and…
bpkroth dc7a7b2
fixup
bpkroth 76e94ed
fixup
bpkroth 7f8522a
fixups
bpkroth 9e03e63
remove old files
bpkroth f9e3339
add some common globals
bpkroth a05b5ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 94e31b5
simplify
bpkroth 21e49db
rename
bpkroth 46be004
fixup
bpkroth 01f7a02
always try and convert metrics back to numerics if possible
bpkroth b035e57
wip: tell mysql to use a datetime that can store fractional seconds
bpkroth ca101ef
add more trial data for testing
bpkroth 98ec1cc
:type fixups
bpkroth 82f602c
check the telemetry
bpkroth 176480f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 22f4e79
revert the bulk conversion one
bpkroth aa9f728
debugging
bpkroth 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" | ||
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 | ||
|
||
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