-
Notifications
You must be signed in to change notification settings - Fork 0
Allow control of hm dockers from jackhammer. #481
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import time | |
| import os | ||
| import threading | ||
| from typing import List, Literal | ||
| from ocs.ocs_client import OCSClient | ||
|
|
||
|
|
||
| class TermColors: | ||
|
|
@@ -50,6 +51,7 @@ with open(sys_config_file, 'r') as stream: | |
| sys_config = yaml.safe_load(stream) | ||
|
|
||
| use_hostmanager: bool = sys_config.get('use_hostmanager', False) | ||
| hm_instance_id: str = sys_config.get('hostmanager_instance_id') | ||
| docker_compose_cmd: str = sys_config.get('docker_compose_command', 'docker compose') | ||
|
|
||
| def get_pysmurf_controller_docker_service(slot: int) -> str: | ||
|
|
@@ -404,6 +406,11 @@ def hammer_func(args): | |
| reboot = not (args.no_reboot) | ||
| all_slots = len(slots) == len(sys_config['slot_order']) | ||
|
|
||
| if use_hostmanager: | ||
| cprint("Bringing down all agents via hostmanager", style=TermColors.HEADER) | ||
| hm = OCSClient(hm_instance_id) | ||
| hm.update(requests=[('all', 'down')]) | ||
|
Contributor
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. can you do this for just the requested slots? I could imagine it would be disruptive in some cases to restart the
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. Yes, we can change it to only bring down the controllers for the slots of interest.
Member
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. Yes, I think this is a good idea, and matches the behavior that As currently written, |
||
|
|
||
|
Comment on lines
+409
to
+413
Member
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. I would at least move this to after the prompt for "Are you sure (y/n)?". Hammering and then backing out with a 'n' response would result in everything on the ocs side of things being offline otherwise.
If my theory on the logs being too long is correct, then maybe we just limit the log dump to the past X lines via the |
||
| reboot_str = "hard" if reboot else "soft" | ||
| cmd = input(f"You are {reboot_str}-resetting slots {slots}. " | ||
| "Are you sure (y/n)? ") | ||
|
|
@@ -484,6 +491,10 @@ def hammer_func(args): | |
| setup_smurfs(slots) | ||
| print("Finished configuring pysmurf!") | ||
|
|
||
| if use_hostmanager: | ||
| cprint("Bringing up all agents via hostmanager", style=TermColors.HEADER) | ||
| hm.update(requests=[('all', 'up')]) | ||
|
|
||
| # Enters into an ipython notebook for the first specified slot | ||
| cprint(f"Entering pysmurf slot {slots[0]}", style=TermColors.HEADER) | ||
| enter_pysmurf(slots[0], agg=args.agg) | ||
|
|
||
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.
From my original issue on this:
What I was trying to suggest here is that having
use_hostmanagerandhm_instance_idfeels redundant. Ifhm_instance_idis present, we'll be using the HM. And we never want to provide anhm_instance_idand setuse_hostmanager = False.Instead I'd suggest something like this: