Schema changes example for mlos_benchd service#931
Merged
bpkroth merged 11 commits intomicrosoft:mainfrom Jan 17, 2025
Merged
Conversation
Contributor
Author
|
Rough idea here is in the comments in the At a high level, imagine that we have 1+ VMs running
A # quick pseudo code
while true:
sleep(1)
with conn.begin() as conn:
try:
experiment_row = conn.select(schema.experiments)
.where(
schema.experiments.status == Status.PENDING.name,
schema.experiments.worker_name is None,
schema.experiments.start_ts >= datetime.utcnow(),
)
.limit(1)
if experiment_row:
# try to grab
result = conn.update(schema.experiments)
.values({
schema.experiments.worker_name: sys.hostname,
schema.experiments.status: status.READY.name,
})
.where(
schema.experiments.worker_name is None,
schema.experiments.experiment_id == experiment_row.experiment_id,
)
if result:
# succeeded, commit the transaction and return
conn.commit()
# return this to calling code to spawn a new `mlos_bench`
# process to fork and execute this Experiment on this host
# in the background
return experiment_row.experiment_id
else:
# someone else probably grabbed it
conn.rollback()
except SqlException as e:
# probably a conflict
conn.rollback()
# try again in a moment |
bpkroth
commented
Jan 14, 2025
bpkroth
commented
Jan 14, 2025
eujing
reviewed
Jan 14, 2025
eujing
approved these changes
Jan 14, 2025
motus
approved these changes
Jan 16, 2025
Member
motus
left a comment
There was a problem hiding this comment.
Approved, but let's have a short discussion before merging it in
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request
Title
Schema changes for mlos_benchd service.
Description
Schema changes for mlos_benchd service.
Storage APIs to adjust these to come in a future PR.
Type of Change
Testing
Local, CI
Additional Notes (optional)
@eujing have a look at the commit history in the PR for a sense of what's going on.
This can probably be merged as is. Happy to discuss further though.