Skip to content

Commit b3f9677

Browse files
logs + comments
1 parent d004212 commit b3f9677

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

apps/bfd-pipeline/bfd-pipeline-idr/extractor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def extract_idr_data(
7575
return res
7676

7777
previous_batch_complete = progress.batch_complete_ts >= progress.batch_start_ts
78+
logger.info("previous batch complete: %s", previous_batch_complete)
79+
7880
compare_timestamp = progress.batch_start_ts if previous_batch_complete else progress.last_ts
7981

8082
idr_query_timer.start()
@@ -179,6 +181,9 @@ def extract_many(self, cls: type[T], sql: str, params: dict[str, DbType]) -> Ite
179181
batch = cur.fetchmany(self.batch_size) # type: ignore[assignment]
180182
cursor_fetch_timer.stop()
181183
return
184+
# Snowflake will throw a reauth error if the pipeline has been running for several hours
185+
# but it seems to be wrapped in a ProgrammingError.
186+
# Unclear the best way to handle this, it will require a bit more trial and error
182187
except (ReauthenticationRequest, RetryRequest, ProgrammingError) as ex:
183188
logger.warning("received transient error, retrying...", exc_info=ex)
184189
if attempt == max_attempts - 1:

apps/bfd-pipeline/bfd-pipeline-idr/pipeline.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ def extract_and_load(
8383
batch_start = datetime.now()
8484
progress = get_progress(connection_string, cls.table(), batch_start)
8585

86-
logger.info("progress for %s - %s", cls.table(), progress.last_ts if progress else "none")
86+
logger.info(
87+
"progress for %s - last_ts: %s batch_start_ts: %s batch_complete_ts: %s",
88+
cls.table(),
89+
progress.last_ts if progress else "none",
90+
progress.batch_start_ts if progress else "none",
91+
progress.batch_complete_ts if progress else "none",
92+
)
8793
data_iter = data_extractor.extract_idr_data(cls, progress, batch_start)
8894

8995
loader = PostgresLoader(connection_string)

0 commit comments

Comments
 (0)