Skip to content

Commit 7d25d45

Browse files
authored
Merge pull request #323 from DataBiosphere/0.5.2_dev
0.5.2 dev
2 parents db72058 + b101d8a commit 7d25d45

File tree

7 files changed

+38
-14
lines changed

7 files changed

+38
-14
lines changed

dsub/_dsub_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
"""
2828

2929

30-
DSUB_VERSION = '0.5.2.dev0'
30+
DSUB_VERSION = '0.5.2'
3131

test/integration/e2e_logging_paths.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ readonly LOGGING_BASE="$(dirname "${LOGGING}")"
2727
declare LOGGING_OVERRIDE
2828

2929
readonly JOB_NAME="log-test"
30-
readonly JOB_USER="${USER}"
30+
readonly JOB_USER="${USER:-$(whoami)}"
3131

3232
# Test a basic job with base logging path
3333
echo "Subtest #1: Basic logging path"

test/integration/e2e_logging_paths_pattern_tasks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ readonly LOGGING_BASE="$(dirname "${LOGGING}")"
3131
declare LOGGING_OVERRIDE
3232

3333
readonly JOB_NAME=$(logging_paths_tasks_setup::get_job_name)
34-
readonly JOB_USER="${USER}"
34+
readonly JOB_USER="${USER:-$(whoami)}"
3535

3636
# Set up the tasks file
3737
logging_paths_tasks_setup::write_tasks_file

test/integration/io_setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ readonly INPUT_BAM_MD5="4afb9b8908959dbd4e2d5c54bf254c93"
2626
readonly REQUESTER_PAYS_INPUT_BAM_FULL_PATH="gs://${DSUB_BUCKET_REQUESTER_PAYS}/${INPUT_BAM_FILE}"
2727
readonly REQUESTER_PAYS_POPULATION_FILE_FULL_PATH="gs://${DSUB_BUCKET_REQUESTER_PAYS}/${POPULATION_FILE}"
2828

29+
# Set user variable like in other tests
30+
readonly JOB_USER="${USER:-$(whoami)}"
2931
# This is the image we use to test the PD mount feature.
3032
# Inject the TEST_TOKEN into the name so that multiple tests can run
3133
# concurrently. Since the image test can be run multiple times for one
@@ -230,7 +232,7 @@ function io_setup::check_dstat() {
230232
local dstat_output=$(run_dstat --status '*' --jobs "${job_id}" --full)
231233

232234
echo " Checking user-id"
233-
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER}"
235+
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${JOB_USER}"
234236

235237
echo " Checking logging"
236238
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].logging" "${LOGGING}"

test/integration/io_tasks_setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
readonly JOB_USER="${USER:-$(whoami)}"
1516
readonly POPULATION_FILE="gs://genomics-public-data/ftp-trace.ncbi.nih.gov/1000genomes/ftp/20131219.superpopulations.tsv"
1617
readonly POPULATION_MD5="68a73f849b82071afe11888bac1aa8a7"
1718

@@ -119,7 +120,7 @@ function io_tasks_setup::check_dstat() {
119120
echo " Check task ${task_id}"
120121

121122
echo " Checking user-id"
122-
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${USER}"
123+
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].user-id" "${JOB_USER}"
123124

124125
echo " Checking logging"
125126
util::dstat_yaml_assert_field_equal "${dstat_output}" "[0].logging" "${LOGGING}/${job_id}.${task_id}.log"

test/integration/test_setup.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
# * Provide functions run_dsub, run_dstat, run_ddel which will call a function
3131
# with DSUB_PROVIDER-specific default parameters set.
3232

33+
# Set default USER if not already set (needed for Jupyterlab/Docker environments)
34+
export USER="${USER:-$(whoami)}"
35+
3336
# If the DSUB_PROVIDER is not set, figure it out from the name of the script.
3437
# If the script name is <test>.<provider>.sh, pull out the provider.
3538
# If the script name is <test>.sh, use "local".
@@ -89,16 +92,23 @@ function run_dsub() {
8992
}
9093

9194
function dsub_google-batch() {
92-
local location="${LOCATION:-}"
95+
# Use REGIONS env var if set, otherwise fall back to LOCATION
96+
local location="${LOCATION:-${REGIONS:-}}"
97+
98+
# Use environment variables for VPC-SC configuration if set
99+
local network="${GPU_NETWORK:-global/networks/default}"
100+
local subnetwork="${GPU_SUBNETWORK:-regions/us-central1/subnetworks/default}"
101+
local service_account="${PET_SA_EMAIL:-}"
93102

94103
dsub \
95104
--provider google-batch \
96105
--project "${PROJECT_ID}" \
97106
${location:+--location "${location}"} \
98107
--logging "${LOGGING_OVERRIDE:-${LOGGING}}" \
99-
--network "global/networks/default" \
100-
--subnetwork "regions/us-central1/subnetworks/default" \
108+
--network "${network}" \
109+
--subnetwork "${subnetwork}" \
101110
--use-private-address \
111+
${service_account:+--service-account "${service_account}"} \
102112
"${@}"
103113
}
104114

test/integration/test_setup_e2e.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,27 @@ def dsub_google_batch(dsub_args):
171171
if val:
172172
opt_args.append(var[1], val)
173173

174-
# pyformat: disable
175-
return dsub_command.call([
174+
# Use environment variables for VPC-SC configuration if set
175+
network = os.environ.get("GPU_NETWORK", "global/networks/default")
176+
subnetwork = os.environ.get("GPU_SUBNETWORK",
177+
"regions/us-central1/subnetworks/default")
178+
location = os.environ.get("LOCATION", os.environ.get("REGIONS", "us-central1"))
179+
service_account = os.environ.get("PET_SA_EMAIL", "")
180+
181+
args = [
176182
"--provider", "google-batch",
177183
"--project", PROJECT_ID,
178184
"--logging", LOGGING,
179-
"--regions", "us-central1",
180-
"--network", "global/networks/default",
181-
"--subnetwork", "regions/us-central1/subnetworks/default",
185+
"--regions", location,
186+
"--network", network,
187+
"--subnetwork", subnetwork,
182188
"--use-private-address"
183-
] + opt_args + dsub_args)
189+
]
190+
if service_account:
191+
args.extend(["--service-account", service_account])
192+
193+
# pyformat: disable
194+
return dsub_command.call(args + opt_args + dsub_args)
184195
# pyformat: enable
185196

186197

0 commit comments

Comments
 (0)