Skip to content

Commit 13236ff

Browse files
authored
WX-1443 Adopt gcloud storage for localization only (#7359)
1 parent e74d51b commit 13236ff

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Cromwell Change Log
22

3+
## 87 Release Notes
4+
5+
### Replacement of `gsutil` with `gcloud storage`
6+
7+
In this release, all **localization** functionality on the GCP backend migrates to use the more modern and performant `gcloud storage`. With sufficiently powerful worker VMs, Cromwell can now localize at up to 1200 MB/s [0][1][2].
8+
9+
In a future release, **delocalization** will also migrate to `gcloud storage`. As part of that upcoming change, we are considering turning on [parallel composite uploads](https://cromwell.readthedocs.io/en/stable/backends/Google/#parallel-composite-uploads) by default to maximize performance. Delocalized composite objects will no longer have an md5 checksum in their metadata; refer to the matrix below [3]. If you have compatibility concerns for your workflow, please [submit an issue](https://github.com/broadinstitute/cromwell/issues).
10+
11+
| Delocalization Strategy | Performance | crc32c | md5 |
12+
|-------------------------|---------------|--------|-----|
13+
| Classic | Baseline/slow |||
14+
| Parallel Composite | Fast |||
15+
16+
[0] Tested with Intel Ice Lake CPU platform, 16 vCPU, 32 GB RAM, 2500 GB SSD
17+
18+
[1] [Throughput scales with vCPU count](https://cloud.google.com/compute/docs/disks/performance#n2_vms) with a plateau at 16 vCPUs.
19+
20+
[2] [Throughput scales with disk size and type](https://cloud.google.com/compute/docs/disks/performance#throughput_limits_for_zonal) with at a plateau at 2.5 TB SSD. Worked example: 1200 MB/s ÷ 0.48 MB/s per GB = 2500 GB.
21+
22+
[3] Cromwell itself uses crc32c hashes for call caching and is not affected
23+
324
## 86 Release Notes
425

526
### GCP Batch

supportedBackends/google/pipelines/v2beta/src/main/resources/gcs_transfer.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,18 @@ localize_files() {
163163
fi
164164

165165
# We need to determine requester pays status of the first file attempting at most `max_attempts` times.
166-
NO_REQUESTER_PAYS_COMMAND="mkdir -p '$container_parent' && rm -f "$HOME/.config/gcloud/gce" && gsutil -o 'GSUtil:parallel_thread_count=1' -o 'GSUtil:sliced_object_download_max_components=${num_cpus}' cp '$first_cloud_file' '$container_parent'"
167-
REQUESTER_PAYS_COMMAND="rm -f "$HOME/.config/gcloud/gce" && gsutil -o 'GSUtil:parallel_thread_count=1' -o 'GSUtil:sliced_object_download_max_components=${num_cpus}' -u $project cp '$first_cloud_file' '$container_parent'"
166+
NO_REQUESTER_PAYS_COMMAND="mkdir -p '$container_parent' && rm -f "$HOME/.config/gcloud/gce" && gcloud storage cp '$first_cloud_file' '$container_parent'"
167+
REQUESTER_PAYS_COMMAND="rm -f "$HOME/.config/gcloud/gce" && gcloud storage cp --billing-project $project '$first_cloud_file' '$container_parent'"
168168

169169
basefile=$(basename "$first_cloud_file")
170170
private::localize_message "$first_cloud_file" "${container_parent}${basefile}"
171171
private::determine_requester_pays ${max_attempts}
172172

173173
if [[ ${USE_REQUESTER_PAYS} = true ]]; then
174-
rpflag="-u $project"
174+
# https://cloud.google.com/storage/docs/using-requester-pays#using
175+
gcloud_storage_rpflag="--billing-project $project"
175176
else
176-
rpflag=""
177+
gcloud_storage_rpflag=""
177178
fi
178179

179180

@@ -192,7 +193,7 @@ localize_files() {
192193
while [[ ${attempt} -le ${max_attempts} ]]; do
193194
# parallel transfer the remaining files
194195
rm -f "$HOME/.config/gcloud/gce"
195-
if cat files_to_localize.txt | gsutil -o "GSUtil:parallel_thread_count=1" -o "GSUtil:sliced_object_download_max_components=${num_cpus}" -m ${rpflag} cp -I "$container_parent"; then
196+
if cat files_to_localize.txt | gcloud storage cp ${gcloud_storage_rpflag} --read-paths-from-stdin "$container_parent"; then
196197
break
197198
else
198199
attempt=$((attempt + 1))
@@ -209,13 +210,13 @@ private::localize_directory() {
209210
local cloud="$1"
210211
local container="$2"
211212
local max_attempts="$3"
212-
local rpflag="$4"
213+
local gcloud_storage_rpflag="$4"
213214

214215
local attempt=1
215216
private::localize_message "$cloud" "$container"
216217
while [[ ${attempt} -lt ${max_attempts} ]]; do
217-
# Do not quote rpflag, when that is set it will be -u project which should be two distinct arguments.
218-
if mkdir -p "${container}" && rm -f "$HOME/.config/gcloud/gce" && gsutil ${rpflag} -m rsync -r "${cloud}" "${container}" > /dev/null 2>&1; then
218+
# Do not quote gcloud_storage_rpflag, when that is set it will be `--billing-project project` which should be two distinct arguments.
219+
if mkdir -p "${container}" && rm -f "$HOME/.config/gcloud/gce" && gcloud storage ${gcloud_storage_rpflag} rsync -r "${cloud}" "${container}" > /dev/null 2>&1; then
219220
break
220221
else
221222
attempt=$(($attempt + 1))
@@ -242,21 +243,21 @@ localize_directories() {
242243

243244
BASE_COMMAND="private::localize_directory '${cloud_directory}' '${container_directory}' '${max_attempts}'"
244245
NO_REQUESTER_PAYS_COMMAND="${BASE_COMMAND} ''"
245-
REQUESTER_PAYS_COMMAND="${BASE_COMMAND} '-u $project'"
246+
REQUESTER_PAYS_COMMAND="${BASE_COMMAND} '--billing-project $project'"
246247

247248
private::determine_requester_pays ${max_attempts}
248249

249250
if [[ ${USE_REQUESTER_PAYS} = true ]]; then
250-
rpflag="-u $project"
251+
gcloud_storage_rpflag="--billing-project $project"
251252
else
252-
rpflag=""
253+
gcloud_storage_rpflag=""
253254
fi
254255

255256
while [[ $# -gt 0 ]]; do
256257
cloud_directory="$1"
257258
container_directory="$2"
258259
shift 2
259-
private::localize_directory "$cloud_directory" "$container_directory" "$max_attempts" "$rpflag"
260+
private::localize_directory "$cloud_directory" "$container_directory" "$max_attempts" "$gcloud_storage_rpflag"
260261
done
261262
}
262263

0 commit comments

Comments
 (0)