Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/integration/e2e_logging_paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ readonly LOGGING_BASE="$(dirname "${LOGGING}")"
declare LOGGING_OVERRIDE

readonly JOB_NAME="log-test"
readonly JOB_USER="${USER}"
readonly JOB_USER="${USER:-jupyter}"

# Test a basic job with base logging path
echo "Subtest #1: Basic logging path"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/e2e_logging_paths_pattern_tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ readonly LOGGING_BASE="$(dirname "${LOGGING}")"
declare LOGGING_OVERRIDE

readonly JOB_NAME=$(logging_paths_tasks_setup::get_job_name)
readonly JOB_USER="${USER}"
readonly JOB_USER="${USER:-jupyter}"

# Set up the tasks file
logging_paths_tasks_setup::write_tasks_file
Expand Down
2 changes: 1 addition & 1 deletion test/integration/io_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function io_setup::check_dstat() {
local dstat_output=$(run_dstat --status '*' --jobs "${job_id}" --full)

echo " Checking user-id"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER}"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER:-jupyter}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be preferable for io_setup.sh to set a variable, like JOB_USER in the other test scripts, and then reference it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated that here as well as in io_tasks_setup.sh


echo " Checking logging"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].logging" "${LOGGING}"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/io_tasks_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function io_tasks_setup::check_dstat() {
echo " Check task ${task_id}"

echo " Checking user-id"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER}"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER:-jupyter}"

echo " Checking logging"
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].logging" "${LOGGING}/${job_id}.${task_id}.log"
Expand Down
16 changes: 13 additions & 3 deletions test/integration/test_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
# * Provide functions run_dsub, run_dstat, run_ddel which will call a function
# with DSUB_PROVIDER-specific default parameters set.

# Set default USER if not already set (needed for Jupyterlab/Docker environments)
export USER="${USER:-jupyter}"

# If the DSUB_PROVIDER is not set, figure it out from the name of the script.
# If the script name is <test>.<provider>.sh, pull out the provider.
# If the script name is <test>.sh, use "local".
Expand Down Expand Up @@ -89,16 +92,23 @@ function run_dsub() {
}

function dsub_google-batch() {
local location="${LOCATION:-}"
# Use REGIONS env var if set, otherwise fall back to LOCATION
local location="${LOCATION:-${REGIONS:-}}"

# Use environment variables for VPC-SC configuration if set
local network="${GPU_NETWORK:-global/networks/default}"
local subnetwork="${GPU_SUBNETWORK:-regions/us-central1/subnetworks/default}"
local service_account="${PET_SA_EMAIL:-}"

dsub \
--provider google-batch \
--project "${PROJECT_ID}" \
${location:+--location "${location}"} \
--logging "${LOGGING_OVERRIDE:-${LOGGING}}" \
--network "global/networks/default" \
--subnetwork "regions/us-central1/subnetworks/default" \
--network "${network}" \
--subnetwork "${subnetwork}" \
--use-private-address \
${service_account:+--service-account "${service_account}"} \
"${@}"
}

Expand Down
23 changes: 17 additions & 6 deletions test/integration/test_setup_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,27 @@ def dsub_google_batch(dsub_args):
if val:
opt_args.append(var[1], val)

# pyformat: disable
return dsub_command.call([
# Use environment variables for VPC-SC configuration if set
network = os.environ.get("GPU_NETWORK", "global/networks/default")
subnetwork = os.environ.get("GPU_SUBNETWORK",
"regions/us-central1/subnetworks/default")
location = os.environ.get("LOCATION", os.environ.get("REGIONS", "us-central1"))
service_account = os.environ.get("PET_SA_EMAIL", "")

args = [
"--provider", "google-batch",
"--project", PROJECT_ID,
"--logging", LOGGING,
"--regions", "us-central1",
"--network", "global/networks/default",
"--subnetwork", "regions/us-central1/subnetworks/default",
"--regions", location,
"--network", network,
"--subnetwork", subnetwork,
"--use-private-address"
] + opt_args + dsub_args)
]
if service_account:
args.extend(["--service-account", service_account])

# pyformat: disable
return dsub_command.call(args + opt_args + dsub_args)
# pyformat: enable


Expand Down