Skip to content

Commit

Permalink
Fix #376: enable systemd.extra_run_flags for devbox (#377)
Browse files Browse the repository at this point in the history
This enables setting systemd.extra_run_flags for devbox and having
the flags apply to all devbox's
For example:
```yaml
systemd:
  extra_run_flags:
    devbox:
      gpus: "all"
```

This will set `--gpus="all"` for all devbox instances
  • Loading branch information
e-carlin authored Sep 1, 2023
1 parent a92c45b commit b84ce87
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rsconf/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _exports(instance_spec, env):
)

def _extra_run_flags(instance_spec):
c = z.pkunchecked_nested_get("extra_run_flags." + compt.name)
c = z.pkunchecked_nested_get("extra_run_flags." + compt.module_name)
if not c:
return ""
return " ".join([f"--{k}='{v}'" for k, v in c.items()])
Expand Down
2 changes: 1 addition & 1 deletion tests/pkcli/build_data/1.in/db/000.yml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ host:
ssh_port: 3103
systemd:
extra_run_flags:
rsivizdevbox:
devbox:
gpus: "all"
jupyterhub:
jupyter_docker_image: radiasoft/custom-jupyter:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rsconf_install_access '500' 'vagrant' 'vagrant'
rsconf_install_file '/srv/devbox_devtech3/cmd' 'e4519a71f8e5f1ccf0006350977c367d'
rsconf_install_file '/srv/devbox_devtech3/env' '22e03a134cc868bb12094d8dc118a6c4'
rsconf_install_file '/srv/devbox_devtech3/remove' 'd8d61104199236b9701424db5247cc32'
rsconf_install_file '/srv/devbox_devtech3/start' 'f05099b7cb37e15f974372a6814d5772'
rsconf_install_file '/srv/devbox_devtech3/start' 'a78c538db7531737496910ae6a088403'
rsconf_install_file '/srv/devbox_devtech3/stop' '38bd86d43d98dfac2ccce1feca46f21c'
rsconf_install_access '444' 'root' 'root'
rsconf_install_file '/etc/systemd/system/devbox_devtech3.service' 'afdbd1365adaa419c07b302e20dff287'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rsconf_install_access '500' 'vagrant' 'vagrant'
rsconf_install_file '/srv/devbox_fullstackdude/cmd' 'cdcf85170cfe88770e11b1fdb2062550'
rsconf_install_file '/srv/devbox_fullstackdude/env' '22e03a134cc868bb12094d8dc118a6c4'
rsconf_install_file '/srv/devbox_fullstackdude/remove' '2e3f05447c3a666355e47923fc17dc79'
rsconf_install_file '/srv/devbox_fullstackdude/start' 'c3e2ce8f63d5e03a5c3c2e972ccd0f3e'
rsconf_install_file '/srv/devbox_fullstackdude/start' 'ca6c123d3e26263f7aae2e71420c66b8'
rsconf_install_file '/srv/devbox_fullstackdude/stop' 'b9d49c0e7995043a88d9602b0cf6e284'
rsconf_install_access '444' 'root' 'root'
rsconf_install_file '/etc/systemd/system/devbox_fullstackdude.service' 'e8e49c2404fb1c49825f03be1ab333fe'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ else
image_cmd+=( /srv/devbox_devtech3/cmd )
fi
# --init runs tini wrapper: https://github.com/krallin/tini
exec docker run "${flags[@]}" --init --rm "--user=$user" --network=host -v '/srv/devbox_devtech3/jupyter:/home/vagrant/jupyter:rw' -v '/srv/devbox_devtech3/src:/home/vagrant/src:rw' -v '/srv/devbox_devtech3/sshd:/home/vagrant/.ssh:ro' -v '/srv/devbox_devtech3:/srv/devbox_devtech3:ro' "${image_cmd[@]}"
exec docker run "${flags[@]}" --init --rm "--user=$user" --network=host -v '/srv/devbox_devtech3/jupyter:/home/vagrant/jupyter:rw' -v '/srv/devbox_devtech3/src:/home/vagrant/src:rw' -v '/srv/devbox_devtech3/sshd:/home/vagrant/.ssh:ro' -v '/srv/devbox_devtech3:/srv/devbox_devtech3:ro' --gpus='all' "${image_cmd[@]}"
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ else
image_cmd+=( /srv/devbox_fullstackdude/cmd )
fi
# --init runs tini wrapper: https://github.com/krallin/tini
exec docker run "${flags[@]}" --init --rm "--user=$user" --network=host -v '/srv/devbox_fullstackdude/jupyter:/home/vagrant/jupyter:rw' -v '/srv/devbox_fullstackdude/src:/home/vagrant/src:rw' -v '/srv/devbox_fullstackdude/sshd:/home/vagrant/.ssh:ro' -v '/srv/devbox_fullstackdude:/srv/devbox_fullstackdude:ro' "${image_cmd[@]}"
exec docker run "${flags[@]}" --init --rm "--user=$user" --network=host -v '/srv/devbox_fullstackdude/jupyter:/home/vagrant/jupyter:rw' -v '/srv/devbox_fullstackdude/src:/home/vagrant/src:rw' -v '/srv/devbox_fullstackdude/sshd:/home/vagrant/.ssh:ro' -v '/srv/devbox_fullstackdude:/srv/devbox_fullstackdude:ro' --gpus='all' "${image_cmd[@]}"

0 comments on commit b84ce87

Please sign in to comment.