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
Hello @gcloudLearning,
Welcome to Google Cloud Community!
By default, each task runs for a maximum of 10 minutes but you can change this and make it shorter or longer up to 1 hour. You can do this by changing the task timeout setting.
For a job that you are updating:
gcloud run jobs update JOB_NAME --task-timeout TIMEOUT
The units specify the duration like 10m5s is ten minutes and five seconds. If the unit was not specified, seconds are assumed as the unit.
To view the settings of the task timeout for your Cloud Run job, use this command and locate the timeout setting
gcloud run jobs describe JOB_NAME