-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [x] Make Scheduler class loadable from JSON configs * [x] Update the Launcher and `run.py` to instantiate Scheduler from JSON * [x] Create JSON schema for the Scheduler config * [x] Add unit tests for the new Scheduler JSON configs Closes #700 --------- Co-authored-by: Brian Kroth <bpkroth@microsoft.com> Co-authored-by: Brian Kroth <bpkroth@users.noreply.github.com>
- Loading branch information
1 parent
2a09a07
commit 4166e96
Showing
20 changed files
with
395 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
11 changes: 11 additions & 0 deletions
11
mlos_bench/mlos_bench/config/schedulers/sync_scheduler.jsonc
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Mock optimizer to test the benchmarking framework. | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/MLOS/main/mlos_bench/mlos_bench/config/schemas/schedulers/scheduler-schema.json", | ||
|
||
"class": "mlos_bench.schedulers.SyncScheduler", | ||
|
||
"config": { | ||
"trial_config_repeat_count": 3, | ||
"teardown": false | ||
} | ||
} |
This file contains 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 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
100 changes: 100 additions & 0 deletions
100
mlos_bench/mlos_bench/config/schemas/schedulers/scheduler-schema.json
This file contains 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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://raw.githubusercontent.com/microsoft/MLOS/main/mlos_bench/mlos_bench/config/schemas/schedulers/scheduler-schema.json", | ||
"title": "mlos_bench Scheduler config", | ||
|
||
"$defs": { | ||
"comment": { | ||
"$comment": "This section contains reusable partial schema bits (or just split out for readability)" | ||
}, | ||
|
||
"config_base_scheduler": { | ||
"$comment": "config properties common to all Scheduler types.", | ||
"type": "object", | ||
"properties": { | ||
"experiment_id": { | ||
"$ref": "../cli/common-defs-subschemas.json#/$defs/experiment_id" | ||
}, | ||
"trial_id": { | ||
"$ref": "../cli/common-defs-subschemas.json#/$defs/trial_id" | ||
}, | ||
"config_id": { | ||
"$ref": "../cli/common-defs-subschemas.json#/$defs/config_id" | ||
}, | ||
"teardown": { | ||
"description": "Whether to teardown the experiment after running it.", | ||
"type": "boolean" | ||
}, | ||
"trial_config_repeat_count": { | ||
"description": "Number of times to repeat a config.", | ||
"type": "integer", | ||
"minimum": 1, | ||
"examples": [3, 5] | ||
} | ||
} | ||
} | ||
}, | ||
|
||
"description": "config for the mlos_bench scheduler", | ||
"$comment": "top level schema document rules", | ||
"type": "object", | ||
"properties": { | ||
"$schema": { | ||
"description": "The schema to use for validating the scheduler config (accepts both URLs and local paths).", | ||
"type": "string", | ||
"$comment": "This is optional, but if provided, should match the name of this file.", | ||
"pattern": "/schemas/schedulers/scheduler-schema.json$" | ||
}, | ||
|
||
"description": { | ||
"description": "Optional description of the config.", | ||
"type": "string" | ||
}, | ||
|
||
"class": { | ||
"description": "The name of the scheduler class to use.", | ||
"$comment": "required", | ||
"enum": [ | ||
"mlos_bench.schedulers.SyncScheduler", | ||
"mlos_bench.schedulers.sync_scheduler.SyncScheduler" | ||
] | ||
}, | ||
|
||
"config": { | ||
"description": "The scheduler-specific config.", | ||
"$comment": "Stub for scheduler-specific config appended with condition statements below", | ||
"type": "object", | ||
"minProperties": 1 | ||
} | ||
}, | ||
"required": ["class"], | ||
|
||
"oneOf": [ | ||
{ | ||
"$comment": "extensions to the 'config' object properties when synchronous scheduler is being used", | ||
"if": { | ||
"properties": { | ||
"class": { | ||
"enum": [ | ||
"mlos_bench.schedulers.SyncScheduler", | ||
"mlos_bench.schedulers.sync_scheduler.SyncScheduler" | ||
] | ||
} | ||
}, | ||
"required": ["class"] | ||
}, | ||
"then": { | ||
"properties": { | ||
"config": { | ||
"type": "object", | ||
"allOf": [{ "$ref": "#/$defs/config_base_scheduler" }], | ||
"$comment": "disallow other properties", | ||
"unevaluatedProperties": false | ||
} | ||
} | ||
}, | ||
"else": false | ||
} | ||
], | ||
"unevaluatedProperties": false | ||
} |
This file contains 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 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 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
Oops, something went wrong.