Content-Length: 309540 | pFad | https://github.com/apache/airflow/commit/841d81664737c25d73d095a7dab5de80d369c87c

E0 Allow setting the pooling time in DLPHook (#8824) · apache/airflow@841d816 · GitHub
Skip to content

Commit 841d816

Browse files
xuan616mik-lajashb
authored
Allow setting the pooling time in DLPHook (#8824)
Co-authored-by: Kamil Breguła <mik-laj@users.noreply.github.com> Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
1 parent 2121f49 commit 841d816

File tree

1 file changed

+5
-3
lines changed
  • airflow/providers/google/cloud/hooks

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
3939

4040
DLP_JOB_PATH_PATTERN = "^projects/[^/]+/dlpJobs/(?P<job>.*?)$"
41-
# Time to sleep between active checks of the operation results
42-
TIME_TO_SLEEP_IN_SECONDS = 1
4341

4442

4543
# pylint: disable=R0904, C0302
@@ -180,6 +178,7 @@ def create_dlp_job(
180178
timeout: Optional[float] = None,
181179
metadata: Optional[Sequence[Tuple[str, str]]] = None,
182180
wait_until_finished: bool = True,
181+
time_to_sleep_in_seconds: int = 60
183182
) -> DlpJob:
184183
"""
185184
Creates a new job to inspect storage or calculate risk metrics.
@@ -207,6 +206,9 @@ def create_dlp_job(
207206
until it is set to DONE.
208207
:type wait_until_finished: bool
209208
:rtype: google.cloud.dlp_v2.types.DlpJob
209+
:param time_to_sleep_in_seconds: (Optional) Time to sleep, in seconds, between active checks
210+
of the operation results. Defaults to 60.
211+
:type time_to_sleep_in_seconds: int
210212
"""
211213

212214
client = self.get_conn()
@@ -242,7 +244,7 @@ def create_dlp_job(
242244
DlpJob.JobState.RUNNING,
243245
DlpJob.JobState.JOB_STATE_UNSPECIFIED,
244246
]:
245-
time.sleep(TIME_TO_SLEEP_IN_SECONDS)
247+
time.sleep(time_to_sleep_in_seconds)
246248
else:
247249
raise AirflowException(
248250
"Stopped polling DLP job state. DLP job {} state: {}.".format(

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/apache/airflow/commit/841d81664737c25d73d095a7dab5de80d369c87c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy