Skip to content

Commit 9a66882

Browse files
authored
update pattern for dataflow job id extraction (#41794)
1 parent 86e3d29 commit 9a66882

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

airflow/providers/google/cloud/hooks/dataflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272

7373
JOB_ID_PATTERN = re.compile(
74-
r"Submitted job: (?P<job_id_java>[^\"\n]*)|Created job with id: \[(?P<job_id_python>[^\"\n]*)\]"
74+
r"Submitted job: (?P<job_id_java>[^\"\n\s]*)|Created job with id: \[(?P<job_id_python>[^\"\n\s]*)\]"
7575
)
7676

7777
T = TypeVar("T", bound=Callable)

tests/providers/google/cloud/hooks/test_dataflow.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,18 @@ def test_delete_data_pipeline(self, mock_connection):
20912091
> gcloud dataflow jobs --project=XXX cancel --region=europe-west3 {TEST_JOB_ID}
20922092
"""
20932093

2094+
# using logback pattern: [%d] %-5level %msg \(%c\) \(%t\)%n
2095+
APACHE_BEAM_V_2_58_1_JAVA_SDK_LOG = f""""\
2096+
[2024-08-28 08:06:39,298] INFO Dataflow SDK version: 2.58.1 (org.apache.beam.runners.dataflow.DataflowRunner) (main)
2097+
[2024-08-28 08:06:40,305] INFO To access the Dataflow monitoring console, please navigate to\
2098+
https://console.cloud.google.com/dataflow/jobs/europe-west1/{TEST_JOB_ID}?project=XXXX\
2099+
(org.apache.beam.runners.dataflow.DataflowRunner) (main)
2100+
[2024-08-28 08:06:40,305] INFO Submitted job: {TEST_JOB_ID} (org.apache.beam.runners.dataflow.DataflowRunner) (main)
2101+
[2024-08-28 08:06:40,305] INFO To cancel the job using the 'gcloud' tool, run:
2102+
> gcloud dataflow jobs --project=gowish-develop cancel --region=europe-west1 {TEST_JOB_ID}\
2103+
(org.apache.beam.runners.dataflow.DataflowRunner) (main)
2104+
"""
2105+
20942106
CLOUD_COMPOSER_CLOUD_LOGGING_APACHE_BEAM_V_2_56_0_JAVA_SDK_LOG = f"""\
20952107
WARNING - {{"message":"org.apache.beam.runners.dataflow.DataflowRunner - Dataflow SDK version: 2.56.0",\
20962108
"severity":"INFO"}}
@@ -2153,6 +2165,7 @@ class TestDataflow:
21532165
[
21542166
pytest.param(APACHE_BEAM_V_2_14_0_JAVA_SDK_LOG, id="apache-beam-2.14.0-JDK"),
21552167
pytest.param(APACHE_BEAM_V_2_22_0_JAVA_SDK_LOG, id="apache-beam-2.22.0-JDK"),
2168+
pytest.param(APACHE_BEAM_V_2_58_1_JAVA_SDK_LOG, id="apache-beam-2.58.1-JDK"),
21562169
pytest.param(
21572170
CLOUD_COMPOSER_CLOUD_LOGGING_APACHE_BEAM_V_2_56_0_JAVA_SDK_LOG,
21582171
id="cloud-composer-cloud-logging-apache-beam-2.56.0-JDK",

0 commit comments

Comments
 (0)