Skip to content

Commit

Permalink
fix: Only insert task record for run 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ahal committed Jun 10, 2024
1 parent 3b5fb19 commit dfc1e14
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/fxci_etl/pulse/handlers/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ def __call__(self, data, message):
run_record[key] = data["status"]["runs"][-1][key]
self.loader.insert(Run.from_dict(run_record))

task_record = {"tags": data["task"]["tags"]}
for key in (
"provisionerId",
"schedulerId",
"taskGroupId",
"taskId",
"taskQueueId",
"workerType",
):
task_record[key] = data["status"][key]

self.loader.insert(Task.from_dict(task_record))
if run_record["runId"] == 0:
# Only insert the task record for run 0 to avoid duplicate records.
task_record = {"tags": data["task"]["tags"]}
for key in (
"provisionerId",
"schedulerId",
"taskGroupId",
"taskId",
"taskQueueId",
"workerType",
):
task_record[key] = data["status"][key]

self.loader.insert(Task.from_dict(task_record))

0 comments on commit dfc1e14

Please sign in to comment.