varundhussa opened a new issue #10357:
URL: https://github.com/apache/airflow/issues/10357


   **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 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to