Skip to content

Commit

Permalink
Fix backfill migration (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed May 14, 2021
1 parent 9e33f49 commit 4db84c8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions migrations/versions/0d4e564b1876_backfill_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def upgrade():
machines_by_id = {m["id"]: m for m in machines}

seen = {
f'{d["sha"]}{d["case_id"]}{d["context_id"]}{d["machine_id"]}'
f'{d["sha"]}{d["case_id"]}{d["context_id"]}{d["machine_hash"]}'
for d in distributions
}

Expand All @@ -140,15 +140,19 @@ def upgrade():
if not commit:
continue

hash_ = f'{commit["sha"]}{summary["case_id"]}{summary["context_id"]}{summary["machine_id"]}'
if hash_ in seen:
continue

m = machines_by_id[summary["machine_id"]]
machine_hash = (
f"{m.name}-{m.cpu_core_count}-{m.cpu_thread_count}-{m.memory_bytes}"
)

hash_ = (
f'{commit["sha"]}{summary["case_id"]}{summary["context_id"]}{machine_hash}'
)
if hash_ in seen:
continue

seen.add(hash_)

distributions = list(
connection.execute(
get_distribution(
Expand Down

0 comments on commit 4db84c8

Please sign in to comment.