Skip to content

Commit f0d9820

Browse files
committed
better logging for crossmatch
1 parent e8ce6f8 commit f0d9820

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

app/crossmatch/engine.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from collections import defaultdict
33
from typing import cast
44

5-
import click
65
from psycopg import sql
76

87
from app import log
@@ -215,14 +214,15 @@ def _resolve_batch(
215214
result = resolver.resolve(evidence)
216215
results.append((record_id, result))
217216
if print_pending and result.triage_status == TriageStatus.PENDING:
218-
line = record_id + f"({result.status})"
219-
if result.pending_reason is not None:
220-
line += " " + result.pending_reason.value
221-
if result.colliding_pgcs:
222-
line += " pgcs: " + ",".join(str(p) for p in sorted(result.colliding_pgcs))
223-
elif result.matched_pgc is not None:
224-
line += " pgc: " + str(result.matched_pgc)
225-
click.echo(line)
217+
log.logger.warning(
218+
"pending crossmatch",
219+
record_id=record_id,
220+
status=result.status.value,
221+
pending_reason=result.pending_reason.value if result.pending_reason is not None else None,
222+
colliding_pgcs=sorted(result.colliding_pgcs) if result.colliding_pgcs else None,
223+
matched_pgc=result.matched_pgc,
224+
link=f"https://leda.sao.ru/records/{record_id}/crossmatch",
225+
)
226226
return results
227227

228228

app/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def query(
1818
params: Sequence[Any] | None = None,
1919
) -> list[dict[str, Any]]:
2020
query_str = query if isinstance(query, str) else query.as_string(self._conn)
21-
log.logger.info("Started query", query=query_str)
21+
log.logger.debug("Started query", query=query_str)
2222
if isinstance(query, str):
2323
query_exec: sql.SQL | sql.Composed = sql.SQL(cast(LiteralString, query))
2424
else:
2525
query_exec = query
2626
with self._conn.cursor(row_factory=dict_row) as cur:
2727
cur.execute(query_exec, params)
2828
rows = list(cur.fetchall())
29-
log.logger.info("Finished query", rows=len(rows))
29+
log.logger.debug("Finished query", rows=len(rows))
3030
return rows

0 commit comments

Comments
 (0)