-
Notifications
You must be signed in to change notification settings - Fork 68
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
Schema changes example for mlos_benchd service #931
Schema changes example for mlos_benchd service #931
Conversation
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 |
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.
Approved, but let's have a short discussion before merging it in
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.