tsbm
tsbm

Reputation: 13

Unable to drain/cancel Dataflow job. It keeps pending state

Some jobs are remaining with pending pending state and I can't cancel them.

How do I cancel the job.

Web console shows like this.

There are no instances in the Compute Engline tab.

What I did is below. I created a streaming job. it was simple template job, Pubsub subscription to BigQuery. I set machineType as e2-micro because it was just a testing.

I also tried to drain and cancel by gcloud but it doesn't work.

$ gcloud dataflow jobs drain --region asia-northeast1 JOBID

Failed to drain job [...]: (...): Workflow modification failed. Causes: (...): 
Operation drain not allowed for JOBID. 
Job is not yet ready for draining. Please retry in a few minutes. 
Please ensure you have permission to access the job and the `--region` flag, asia-northeast1, matches the job's
region.

This is jobs list

$ gcloud dataflow jobs list --region asia-northeast1
JOB_ID  NAME                               TYPE       CREATION_TIME        STATE      REGION
JOBID1  pubsub-to-bigquery-udf4            Streaming  2021-02-09 04:24:23  Pending    asia-northeast1
JOBID2  pubsub-to-bigquery-udf2            Streaming  2021-02-09 03:20:35  Pending    asia-northeast1
...other jobs...

Please let me know how to stop/cancel/delete these streaming jobs.

Job IDs:

WebUI: https://i.sstatic.net/B75OX.png

https://i.sstatic.net/LzUGQ.png

Upvotes: 1

Views: 2370

Answers (2)

Vibhor Gupta
Vibhor Gupta

Reputation: 699

As per personal experience some time few instance get stuck either they keep on running, or they cannot be canceled or you can not see thr graphical data flow pipelines. Best way to handle this kind of issue is to leave them in thr status, unless it is not impacting your solution by exceeding maximum concurrent runs at a moment. It will be canceled automatically or by Google team, since Dataflow is a google managed.

Upvotes: 1

Jin Lee
Jin Lee

Reputation: 3512

In GCP console Dataflow UI, if you have running Dataflow jobs, you will see the "STOP" button just like the below image.

enter image description here

Press the STOP button. enter image description here

When you successfully stop your job, you will see the status like below. (I was too slow to stop the job with the first try, so I had to test it again. :) ) enter image description here

Upvotes: 0

Related Questions