Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

parallel jobs and taks in the cloud run

I have a cloud run job. using docker file and shell script for enabling the apis, disk snapshot and some other gcloud commands .

I have multiple vms . scripts sample is like below

 

# loop driven by lines of output
for line in $(gcloud compute instances list --format="csv[no-heading](name,zone)"); do
vm=$(echo "$line" | cut -d, -f1)
location=$(echo "$line" | cut -d, -f2)
echo "GCP VM instance: $vm in zone $location"

gcloud commands...1

gcloud commands...2
done

This process is taking 10-15 min. I want to make use of || and task feature to reduce the time. if I am changing the task number from 1 to "2" , it's running the same process for all the vms two times. it's repeating , any thing here I am missing,

How to separate the task here to get the benefit.

I am not able to understand, how to benefit from || and task functionality 

0 1 631