From 02f9b78b3e69261e82b33a7b7208272e3d5b7869 Mon Sep 17 00:00:00 2001 From: caetano melone Date: Thu, 25 Apr 2024 00:04:55 -0700 Subject: [PATCH 1/2] clarify insert/race condition error message --- gantry/clients/db/insert.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gantry/clients/db/insert.py b/gantry/clients/db/insert.py index 068f0fd..515131e 100644 --- a/gantry/clients/db/insert.py +++ b/gantry/clients/db/insert.py @@ -66,11 +66,15 @@ async def insert_job(db: aiosqlite.Connection, job: dict) -> int: job, # if the job somehow gets added into the db (pod+id being unique) # then ignore the insert + # in this case, lastrowid will be 0 ignore=True, ) ) as cursor: if cursor.rowcount > 0: return cursor.lastrowid - logger.error(f"job not inserted: {job}. data is likely missing") + logger.error( + f"job not inserted: {job}. either a duplicate insert was attempted,\ + or the insert failed due to missing data" + ) return None From a2486cddb4a0355cd885b3d3a92f4c59b573a5d3 Mon Sep 17 00:00:00 2001 From: caetano melone Date: Thu, 25 Apr 2024 00:06:19 -0700 Subject: [PATCH 2/2] clarify node message --- gantry/clients/db/insert.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gantry/clients/db/insert.py b/gantry/clients/db/insert.py index 515131e..8a5e1e7 100644 --- a/gantry/clients/db/insert.py +++ b/gantry/clients/db/insert.py @@ -52,7 +52,10 @@ async def insert_node(db: aiosqlite.Connection, node: dict) -> int: pk = await get_node(db, node["uuid"]) if pk is None: - logger.error(f"node not inserted: {node}. data is likely missing") + logger.error( + f"node not inserted: {node}. either a duplicate insert was attempted,\ + or the insert failed due to missing data" + ) return pk