You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/01/03 09:08:17 UTC

[airflow] branch main updated: Ensure Beam Go file downloaded from GCS still exists when referenced (#28664)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8da678ccd2 Ensure Beam Go file downloaded from GCS still exists when referenced (#28664)
8da678ccd2 is described below

commit 8da678ccd2e5a30f9c2d22c7526b7a238c185d2f
Author: Johanna Öjeling <51...@users.noreply.github.com>
AuthorDate: Tue Jan 3 10:08:09 2023 +0100

    Ensure Beam Go file downloaded from GCS still exists when referenced (#28664)
---
 airflow/providers/apache/beam/operators/beam.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/airflow/providers/apache/beam/operators/beam.py b/airflow/providers/apache/beam/operators/beam.py
index efef187aaf..e9395a8dde 100644
--- a/airflow/providers/apache/beam/operators/beam.py
+++ b/airflow/providers/apache/beam/operators/beam.py
@@ -585,12 +585,12 @@ class BeamRunGoPipelineOperator(BeamBasePipelineOperator):
             if self.go_file.lower().startswith("gs://"):
                 gcs_hook = GCSHook(self.gcp_conn_id, self.delegate_to)
 
-                with tempfile.TemporaryDirectory(prefix="apache-beam-go") as tmp_dir:
-                    tmp_gcs_file = exit_stack.enter_context(
-                        gcs_hook.provide_file(object_url=self.go_file, dir=tmp_dir)
-                    )
-                    self.go_file = tmp_gcs_file.name
-                    self.should_init_go_module = True
+                tmp_dir = exit_stack.enter_context(tempfile.TemporaryDirectory(prefix="apache-beam-go"))
+                tmp_gcs_file = exit_stack.enter_context(
+                    gcs_hook.provide_file(object_url=self.go_file, dir=tmp_dir)
+                )
+                self.go_file = tmp_gcs_file.name
+                self.should_init_go_module = True
 
             if is_dataflow and self.dataflow_hook:
                 with self.dataflow_hook.provide_authorized_gcloud():