pankajkoti commented on code in PR #49711:
URL: https://github.com/apache/airflow/pull/49711#discussion_r2067132762
##########
providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py:
##########
@@ -116,16 +117,39 @@ def get_task_instance(self, session: Session) ->
TaskInstance:
)
return task_instance
+ def get_task_state(self):
+ from airflow.sdk.execution_time.task_runner import RuntimeTaskInstance
+
+ task_states_response = RuntimeTaskInstance.get_task_states(
Review Comment:
yes, the run method is declared as `async def run` from where this would be
invoked. In general, the expectation is that Airflow triggers run async code as
sync calls block the triggerer thread. I guess this may not have been followed
as often in trigger implementations if you're seeing it to be missing in few
places, but would be nice to incorporate that here.
The doc at
https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/deferring.html
mentions
_"The run method must be asynchronous (using Python’s asyncio), and
correctly await whenever it does a blocking operation."_
you can find an example here:
https://github.com/apache/airflow/blob/78615a35f04b6d7a0bf2dbb1787260ba5f4356dc/providers/standard/src/airflow/providers/standard/triggers/external_task.py#L150-L153
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]