You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Tomasz Urbaszek (JIRA)" <ji...@apache.org> on 2019/08/01 09:20:00 UTC

[jira] [Commented] (AIRFLOW-2308) Method poll_job_complete in BigQueryBaseCursor class doesn't work outside its class

    [ https://issues.apache.org/jira/browse/AIRFLOW-2308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16897909#comment-16897909 ] 

Tomasz Urbaszek commented on AIRFLOW-2308:
------------------------------------------

 

It seems that  BigQueryBaseCursor has poll_job_complete method
{code:java}
In [1]: from airflow.contrib.hooks.bigquery_hook import BigQueryHook, BigQueryBaseCursor

In [2]: from mock import MagicMock

In [3]: curs = BigQueryBaseCursor(MagicMock(), MagicMock())

In [4]: curs.poll_job_complete("job_id")
Out[4]: False
{code}
 

> Method poll_job_complete in BigQueryBaseCursor class doesn't work outside its class
> -----------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-2308
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2308
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: contrib, gcp
>    Affects Versions: 2.0.0
>            Reporter: Guillermo Rodríguez Cano
>            Priority: Major
>
> We have encountered an strange behaviour in the aforementioned method `poll_job_complete` of the class `BigQueryBaseCursor` when we were create a sensor that should simply poll to check for the completion of a BigQuery job.
> After creating a `BigQueryBaseCursor` object, when we call the method `poll_job_complete` on that object we get the following error: `AttributeError: ‘BigQueryBaseCursor’ object has no attribute ‘poll_job_complete’`.
>  However, if we copy and paste the code contained in the  `poll_job_complete` function to our sensor, it works.
> We are not sure what is the problem exactly or even why...
> Ideally we would want to do something like this, but we get such error:
> {code:java}
> hook = BigQueryHook(bigquery_conn_id=self.bigquery_conn_id, delegate_to=self.delegate_to)
> service = hook.get_service()
> bqCursor = BigQueryBaseCursor(service, self.project_id)
> return bqCursor.poll_job_complete(self.job_id)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)