|
30 | 30 | # * Provide functions run_dsub, run_dstat, run_ddel which will call a function |
31 | 31 | # with DSUB_PROVIDER-specific default parameters set. |
32 | 32 |
|
| 33 | +# Set default USER if not already set (needed for Jupyterlab/Docker environments) |
| 34 | +export USER="${USER:-$(whoami)}" |
| 35 | + |
33 | 36 | # If the DSUB_PROVIDER is not set, figure it out from the name of the script. |
34 | 37 | # If the script name is <test>.<provider>.sh, pull out the provider. |
35 | 38 | # If the script name is <test>.sh, use "local". |
@@ -89,16 +92,23 @@ function run_dsub() { |
89 | 92 | } |
90 | 93 |
|
91 | 94 | 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:-}" |
93 | 102 |
|
94 | 103 | dsub \ |
95 | 104 | --provider google-batch \ |
96 | 105 | --project "${PROJECT_ID}" \ |
97 | 106 | ${location:+--location "${location}"} \ |
98 | 107 | --logging "${LOGGING_OVERRIDE:-${LOGGING}}" \ |
99 | | - --network "global/networks/default" \ |
100 | | - --subnetwork "regions/us-central1/subnetworks/default" \ |
| 108 | + --network "${network}" \ |
| 109 | + --subnetwork "${subnetwork}" \ |
101 | 110 | --use-private-address \ |
| 111 | + ${service_account:+--service-account "${service_account}"} \ |
102 | 112 | "${@}" |
103 | 113 | } |
104 | 114 |
|
|
0 commit comments