Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 gcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ These scripts deploy Dataproc clusters in various configurations, supporting bot
## Setup & Configuration

1. **Prerequisites:**
* `gcloud` CLI and `gsutil`
* `gcloud` CLI and `gcloud storage`
* `jq` (for JSON parsing)
* `sqlite3` (for state cache queries)
* `perl` (used in some robust text-manipulation utilities)
Expand Down
2 changes: 1 addition & 1 deletion gcloud/bin/create-dpgce
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if [[ "${ENABLE_GPU}" == "true" ]]; then
TIMESTAMP=$(date +%s)
export GPU_INIT_ACTION_URI="gs://${BUCKET}/tmp_init_actions/install_gpu_driver_${TIMESTAMP}.sh"
echo "INFO: Uploading local GPU init action to ${GPU_INIT_ACTION_URI}" >&2
gsutil cp "${DP_EVOLUTION_DIR}/initialization-actions/gpu/install_gpu_driver.sh" "${GPU_INIT_ACTION_URI}"
"${gsutil_cmd[@]}" cp "${DP_EVOLUTION_DIR}/initialization-actions/gpu/install_gpu_driver.sh" "${GPU_INIT_ACTION_URI}"
fi

if [[ "${IS_CUSTOM}" == "true" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion gcloud/bin/recreate-dpgce
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if [[ "${ENABLE_GPU}" == "true" ]]; then
TIMESTAMP=$(date +%s)
export GPU_INIT_ACTION_URI="gs://${BUCKET}/tmp_init_actions/install_gpu_driver_${TIMESTAMP}.sh"
echo "INFO: Uploading local GPU init action to ${GPU_INIT_ACTION_URI}" >&2
gsutil cp "${DP_EVOLUTION_DIR}/initialization-actions/gpu/install_gpu_driver.sh" "${GPU_INIT_ACTION_URI}"
"${gsutil_cmd[@]}" cp "${DP_EVOLUTION_DIR}/initialization-actions/gpu/install_gpu_driver.sh" "${GPU_INIT_ACTION_URI}"
fi

# --- Source other necessary function files ---
Expand Down
19 changes: 17 additions & 2 deletions gcloud/init/gce-proxy-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,25 @@ function is_rocky() { [[ "$(os_id)" == "rocky" ]] ; }
# --- End OS Detection Helpers ---

# --- Version Comparison Helpers ---
function version_ge(){ [[ "$1" = "$(echo -e "$1\n$2"|sort -V|tail -n1)" ]]; }
function version_gt(){ [[ "$1" = "$2" ]] && return 1 || version_ge "$1" "$2"; }
function version_le(){ [[ "$1" = "$(echo -e "$1\n$2"|sort -V|head -n1)" ]]; }
function version_lt(){ [[ "$1" = "$2" ]] && return 1 || version_le "$1" "$2"; }
# --- End Version Comparison Helpers ---

# With the 402.0.0 release of gcloud sdk, `gcloud storage` can be
# used as a more performant replacement for `gsutil`
gcloud_sdk_version="$(gcloud --version 2>/dev/null | awk -F'SDK ' '/Google Cloud SDK/ {print $2}' || echo '0.0.0')"
if [[ -z "${gcloud_sdk_version}" ]] || version_lt "${gcloud_sdk_version}" "402.0.0" ; then
gsutil_cmd=("gsutil" "-o" "GSUtil:check_hashes=never")
gsutil_stat_cmd=("gsutil" "stat")
rsync_cmd=("gsutil" "-o" "GSUtil:check_hashes=never" "-m" "rsync")
else
gsutil_cmd=("gcloud" "storage")
gsutil_stat_cmd=("gcloud" "storage" "objects" "describe")
rsync_cmd=("gcloud" "storage" "rsync")
fi

function execute_with_retries() {
local -r cmd="$*"
local retries=3
Expand Down Expand Up @@ -218,14 +233,14 @@ function set_proxy(){
trusted_pem_dir="/usr/local/share/ca-certificates"
proxy_ca_pem="${trusted_pem_dir}/proxy_ca.crt"
mkdir -p "${trusted_pem_dir}"
gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; }
"${gsutil_cmd[@]}" cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; }
update-ca-certificates
trusted_pem_path="/etc/ssl/certs/ca-certificates.crt"
elif is_rocky ; then
trusted_pem_dir="/etc/pki/ca-trust/source/anchors"
proxy_ca_pem="${trusted_pem_dir}/proxy_ca.crt"
mkdir -p "${trusted_pem_dir}"
gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; }
"${gsutil_cmd[@]}" cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; }
update-ca-trust
trusted_pem_path="/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
fi
Expand Down
4 changes: 2 additions & 2 deletions gcloud/lib/database/oracle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo "Starting Oracle DB setup..."
# sudo yum install -y oracle-database-preinstall-19c

# 2. Download Oracle Database Software (e.g., from Oracle website or GCS)
# Example: wget ... or gsutil cp ...
# Example: wget ... or gcloud storage cp ...

# 3. Unzip and Run Oracle Installer
# Example: unzip ...
Expand Down Expand Up @@ -60,7 +60,7 @@ EOF
fi

print_status " Uploading OVA to GCS..."
if run_gcloud "${log_file}" gsutil cp "${REPRO_TMPDIR}/${ova_file}" "${gcs_uri}"; then
if run_gcloud "${log_file}" "${gsutil_cmd[@]}" cp "${REPRO_TMPDIR}/${ova_file}" "${gcs_uri}"; then
report_result "Pass"
else
report_result "Fail"
Expand Down
21 changes: 21 additions & 0 deletions gcloud/lib/script-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# --- Version Comparison Helpers ---
function version_ge(){ [[ "$1" = "$(echo -e "$1\n$2"|sort -V|tail -n1)" ]]; }
function version_gt(){ [[ "$1" = "$2" ]] && return 1 || version_ge "$1" "$2"; }
function version_le(){ [[ "$1" = "$(echo -e "$1\n$2"|sort -V|head -n1)" ]]; }
function version_lt(){ [[ "$1" = "$2" ]] && return 1 || version_le "$1" "$2"; }
export -f version_ge version_gt version_le version_lt
# --- End Version Comparison Helpers ---

# With the 402.0.0 release of gcloud sdk, `gcloud storage` can be
# used as a more performant replacement for `gsutil`
gcloud_sdk_version="$(gcloud --version 2>/dev/null | awk -F'SDK ' '/Google Cloud SDK/ {print $2}' || echo '0.0.0')"
if [[ -z "${gcloud_sdk_version}" ]] || version_lt "${gcloud_sdk_version}" "402.0.0" ; then
gsutil_cmd=("gsutil" "-o" "GSUtil:check_hashes=never")
gsutil_stat_cmd=("gsutil" "stat")
rsync_cmd=("gsutil" "-o" "GSUtil:check_hashes=never" "-m" "rsync")
else
gsutil_cmd=("gcloud" "storage")
gsutil_stat_cmd=("gcloud" "storage" "objects" "describe")
rsync_cmd=("gcloud" "storage" "rsync")
fi

# Usage: print_status "Message..."
function print_status() {
local message="$1"
Expand Down
2 changes: 1 addition & 1 deletion spark-tensorflow/doc/tf-serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ in the [Preprocessing](#preprocessing) section so that the preprocessed data
meant for prediction is stored in `$OUTPUT_DIR`. If you used Dataproc to
preprocess the data for prediction, `$OUTPUT_DIR` is a Cloud Storage bucket. If
not, then you will have to move your data to Cloud Storage to make it available
for batch prediction. You can do so using the [gsutil
for batch prediction. You can do so using the [gcloud storage
tool](https://cloud.google.com/storage/docs/gsutil).

Once your data is on GCS, please set the `GCS_PATH` environment variable to the
Expand Down
Loading