简体   繁体   中英

How to list gcloud dataflow jobs filters to list only draining jobs?

I want to get the list of the jobs that have the status "Draining"

# gives 0 results 
gcloud dataflow jobs list --filter="status=Draining"
gcloud dataflow jobs list --filter="status=draining"
gcloud dataflow jobs list --filter="Status=Draining"
gcloud dataflow jobs list --filter="Status=draining"

# gives an error, because status can only be "all", "active", "terminated"
gcloud dataflow jobs list --status="Draining" 

I confirm the @kiran-mathew comment, you can use the following gcloud command to list all the Dataflow jobs with the draining state:

gcloud dataflow jobs list --region="europe-west1"  --filter='STATE=DRAINING'

An example of result:

JOB_ID NAME TYPE CREATION_TIME STATE REGION
2022-12-14_15_00_47-1012997933146788402 job-name Streaming 2022-12-14 23:00:48 Draining europe-west1

The flag STATUS has only three options active , all and terminated , that is why you are getting an error in your last command. You can follow this google cloud documentation to know more about the Status field.

To get the list of the jobs that have the are in "Draining" mode you can use bellow command:

gcloud dataflow jobs list --filter='STATE=DRAINING'

在此处输入图像描述

Addition to @Mazlum Tosun's answer you only need to use --region if you want to have a region specific resource list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM