Skip to content

Commit

Permalink
chore: make command's run startup-hook.sh [RM-159] (#9275)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBlaskey authored May 1, 2024
1 parent b78020d commit 670ac40
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/release-notes/command-startup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:orphan:

**Improvements**

- Commands: Commands now support automatically executing a ``startup-hook.sh`` script if it is
present in the command's context directory.
10 changes: 10 additions & 0 deletions e2e_tests/tests/command/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ def test_environment_variables_command() -> None:
_run_cmd(sess, ["--config", config_str, "env | grep -q THISISTRUE=true"], expect_success=True)


@pytest.mark.e2e_cpu
def test_command_startup_hook_works() -> None:
sess = api_utils.user_session()
_run_cmd(
sess,
["--context", conf.fixtures_path("no_op/"), '[ -e "startup-hook-ran" ]'],
expect_success=True,
)


@pytest.mark.parametrize("actual,expected", [("24576", "24"), ("1.5g", "1572864")])
@pytest.mark.parametrize("use_config_file", [True, False])
@pytest.mark.slow
Expand Down
2 changes: 2 additions & 0 deletions master/static/srv/command-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ set -e
# to register the proxy with the Determined master.
"$DET_PYTHON_EXECUTABLE" -m determined.exec.prep_container --proxy --download_context_directory

STARTUP_HOOK="startup-hook.sh"
set -x
test -f "${TCD_STARTUP_HOOK}" && source "${TCD_STARTUP_HOOK}"
test -f "${STARTUP_HOOK}" && source "${STARTUP_HOOK}"
set +x

if [ "$#" -eq 1 ]; then
Expand Down

0 comments on commit 670ac40

Please sign in to comment.