question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DataProcHook cancel method does not execute the REST call

See original GitHub issue

Apache Airflow version: 1.10.x

What happened: The cancel method of the DataProcHook does not cancel a running DataProc job.

What you expected to happen: The job should get cancelled and return the response JSON Documentation says: returns A Job json dictionary representing the canceled job: https://github.com/apache/airflow/blob/1.10.11/airflow/contrib/hooks/gcp_dataproc_hook.py#L325

What do you think went wrong: The cancel method in the hook only creates the googleapiclient.http.HttpRequest object and returns it. It should call execute on the object and return the response.

It can be fixed by: https://github.com/apache/airflow/blob/1.10.11/airflow/contrib/hooks/gcp_dataproc_hook.py#L336

return self.get_conn().projects().regions().jobs().cancel(
            projectId=project_id,
            region=region,
            jobId=job_id
        ).execute(num_retries=self.num_retries)

How to reproduce it: Submit a dataproc job and call an Airflow operator to cancel the job. It returns the request object instead of the JSON

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
varundhussacommented, Aug 17, 2020

Thanks @potiuk . I completely understand. I will be moving to the 2.0 ports.

0reactions
turbaszekcommented, Aug 17, 2020

Should we close this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[GitHub] [airflow] varundhussa closed issue #10357: DataProcHook ...
[GitHub] [airflow] varundhussa closed issue #10357: DataProcHook cancel method does not execute the REST call · [GitHub] [airflow] varundhussa opened a new issue ......
Read more >
Release a 2nd wave of Backport packages · Issue #10014 · apache ...
Description I think we are really close to release the second wave of Backport Packages ... DataProcHook cancel method does not execute the...
Read more >
Method: projects.regions.operations.cancel - Google Cloud
Starts asynchronous cancellation on a long-running operation. ... If the server doesn't support this method, it returns google.rpc.Code.
Read more >
airflow dataproc 源码 - seaxiang
If ``None`` is specified, requests will not be retried. :param timeout: The amount ... :param metadata: Additional metadata that is provided to the...
Read more >
apache-airflow-providers-google 8.6.0 - PyPI
All classes for this provider package are in airflow.providers.google python package. ... Use non-deprecated method for on_kill in BigQueryHook (#27547).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found