Skip to content

Commit ad2e48e

Browse files
Fix formatting
1 parent 3fa5e3c commit ad2e48e

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

apps/bfd-pipeline-idr/src/idr_pipeline/model/load_progress.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,24 @@ def model_type() -> ModelType:
3636

3737
@override
3838
@classmethod
39-
def fetch_query(
40-
cls, partition: LoadPartition, start_time: datetime, source: Source, job_id: int
41-
) -> str:
39+
def fetch_query(cls, partition: LoadPartition, start_time: datetime, source: Source) -> str:
4240
return f"""
4341
SELECT table_name, last_ts, last_id, batch_partition, job_start_ts,
4442
batch_complete_ts, job_id, max_run_ts
4543
FROM idr.load_progress
4644
WHERE table_name = %({LoadProgress.query_placeholder()})s
4745
AND batch_partition = '{partition.name}'
46+
AND job_id = 1
47+
"""
48+
49+
@classmethod
50+
def fetch_query_by_job(cls, partition: LoadPartition, job_id: int) -> str:
51+
return f"""
52+
SELECT table_name, last_ts, last_id, batch_partition, job_start_ts,
53+
batch_complete_ts, job_id, max_run_ts
54+
FROM idr.load_progress
55+
WHERE table_name = %({LoadProgress.query_placeholder()})s
56+
AND batch_partition = '{partition.name}'
4857
AND job_id = {job_id}
4958
"""
5059

apps/bfd-pipeline-idr/src/idr_pipeline/pipeline_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636

3737
def get_progress(
3838
load_mode: LoadMode,
39-
source: Source,
4039
table_name: str,
41-
start_time: datetime,
4240
partition: LoadPartition,
4341
job_id: int,
4442
) -> LoadProgress | None:
@@ -48,7 +46,7 @@ def get_progress(
4846
return PostgresExtractor(
4947
load_mode=load_mode, cls=LoadProgress, partition=partition
5048
).extract_single(
51-
LoadProgress.fetch_query(partition, start_time, source, job_id),
49+
LoadProgress.fetch_query_by_job(partition, job_id),
5250
{LoadProgress.query_placeholder(): table_name},
5351
)
5452

@@ -77,7 +75,7 @@ def extract_and_load(
7775

7876
while True:
7977
try:
80-
progress = get_progress(load_mode, source, cls.table(), job_start, partition, job_id)
78+
progress = get_progress(load_mode, cls.table(), partition, job_id)
8179

8280
if progress:
8381
logger.info(

0 commit comments

Comments
 (0)