Skip to content

Commit

Permalink
Allow 0 in draksetup scale to disable services, don't enable first dr…
Browse files Browse the repository at this point in the history
…akrun worker on draksetup postinstall (#972)
  • Loading branch information
psrok1 authored Sep 27, 2024
1 parent 4e42b15 commit ffdc363
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 3 additions & 6 deletions drakrun/drakrun/draksetup/postinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ def postinstall(generate_apivectors_profile):
create_vm_profiles(generate_apivectors_profile)

log.info("All right, drakrun setup is done.")
log.info("First instance of drakrun will be enabled automatically...")
subprocess.check_output("systemctl enable drakrun@1", shell=True)
subprocess.check_output("systemctl start drakrun@1", shell=True)

log.info("If you want to have more parallel instances, execute:")
log.info(" # draksetup scale <number of instances>")
log.info("If you want to enable drakrun worker, execute:")
log.info(" # draksetup scale 1")
log.info("or provide a higher number if you want to have more parallel VMs")
6 changes: 4 additions & 2 deletions drakrun/drakrun/draksetup/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
@click.argument("scale_count", type=int)
def scale(scale_count):
"""Enable or disable additional parallel instances of drakrun service.."""
if scale_count < 1:
raise RuntimeError("Invalid value of scale parameter. Must be at least 1.")
if scale_count >= 0:
raise RuntimeError(
"Invalid value of scale parameter - must be a positive number."
)

cur_services = set(list(get_enabled_drakruns()))
new_services = set([f"drakrun@{i}.service" for i in range(1, scale_count + 1)])
Expand Down

0 comments on commit ffdc363

Please sign in to comment.