Skip to content

Commit

Permalink
Add try clause to DataFusionHook.wait_for_pipeline_state (#10031)
Browse files Browse the repository at this point in the history
Sometimes it may happen that the pipeline is not visible instantly in
DataFusion so retrieving it will result in 404
closes: #10030
  • Loading branch information
turbaszek committed Aug 3, 2020
1 parent 85cc2a6 commit 27020f8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions airflow/providers/google/cloud/hooks/datafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ def wait_for_pipeline_state(
start_time = monotonic()
current_state = None
while monotonic() - start_time < timeout:
current_state = self._get_workflow_state(
pipeline_name=pipeline_name,
pipeline_id=pipeline_id,
instance_url=instance_url,
namespace=namespace,
)

try:
current_state = self._get_workflow_state(
pipeline_name=pipeline_name,
pipeline_id=pipeline_id,
instance_url=instance_url,
namespace=namespace,
)
except AirflowException:
pass # Because the pipeline may not be visible in system yet
if current_state in success_states:
return
if current_state in failure_states:
Expand Down

0 comments on commit 27020f8

Please sign in to comment.