Skip to content

Commit

Permalink
bugfix del var that might not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodlz committed Jul 14, 2023
1 parent b75ce6d commit 46577d1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kowalski/alert_brokers/alert_broker_pgir.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def process_alert(alert: Mapping, topic: str):
and len(existing_aux.get("prv_candidates", [])) > 0
):
all_prv_candidates += existing_aux["prv_candidates"]
del existing_aux

# ML models:
with timer(f"MLing of {object_id} {candid}", alert_worker.verbose > 1):
Expand All @@ -92,6 +93,7 @@ def process_alert(alert: Mapping, topic: str):
for prv_candidate in prv_candidates
]

alert_aux, xmatches, xmatches_ztf, passed_filters = None, None, None, None
# cross-match with external catalogs if objectId not in collection_alerts_aux:
if (
alert_worker.mongo.db[alert_worker.collection_alerts_aux].count_documents(
Expand Down
1 change: 1 addition & 0 deletions kowalski/alert_brokers/alert_broker_turbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def process_alert(alert: Mapping, topic: str):
for prv_candidate in prv_candidates
]

alert_aux, xmatches, xmatches_ztf, passed_filters = None, None, None, None
# cross-match with external catalogs if objectId not in collection_alerts_aux:
if (
alert_worker.mongo.db[alert_worker.collection_alerts_aux].count_documents(
Expand Down
2 changes: 2 additions & 0 deletions kowalski/alert_brokers/alert_broker_winter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def process_alert(alert: Mapping, topic: str):
{kk: vv for kk, vv in prv_candidate.items() if vv is not None}
for prv_candidate in prv_candidates
]

alert_aux, xmatches, xmatches_ztf, passed_filters = None, None, None, None
# cross-match with external catalogs if objectId not in collection_alerts_aux:
if (
alert_worker.mongo.db[alert_worker.collection_alerts_aux].count_documents(
Expand Down
2 changes: 2 additions & 0 deletions kowalski/alert_brokers/alert_broker_ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def process_alert(alert: Mapping, topic: str):
and len(existing_aux.get("prv_candidates", [])) > 0
):
all_prv_candidates += existing_aux["prv_candidates"]
del existing_aux

# ML models:
with timer(f"MLing of {object_id} {candid}", alert_worker.verbose > 1):
Expand All @@ -92,6 +93,7 @@ def process_alert(alert: Mapping, topic: str):
for prv_candidate in prv_candidates
]

alert_aux, xmatches, passed_filters = None, None, None
# cross-match with external catalogs if objectId not in collection_alerts_aux:
if (
retry(
Expand Down

0 comments on commit 46577d1

Please sign in to comment.