Skip to content

Commit 9c3ac0d

Browse files
Debugging
1 parent 3c7689b commit 9c3ac0d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python_api/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,12 @@ async def predict(request: PredictRequest):
382382
# experiment_id=create_expriement( cur, conn)
383383

384384
trial= get_trial_by_model_and_input( model_id, inputs)
385-
# print(trial)
385+
print("-"*20,experiment_id,"-"*20)
386386
if not experiment_id:
387+
print("+"*20,"ENTERED IF","+"*20)
387388
cur,conn=get_db_cur_con()
388389
experiment_id=create_expriement(cur, conn)
390+
print("+"*20,"ENTERED IF", experiment_id,"+"*20)
389391

390392

391393
# print(trail)
@@ -401,7 +403,7 @@ async def predict(request: PredictRequest):
401403
new_trial_id=create_trial( model_id, experiment_id, cur, conn,source_trial)
402404
# if not experiment_id:
403405
# experiment_id=create_expriement(cur, conn)
404-
406+
print("*"*20,"RETURNING IF TRIAL", experiment_id,"*"*20)
405407
return {"experimentId": experiment_id, "trialId": new_trial_id, "model_id": model["name"], "input_url": inputs}
406408
else:
407409
cur,conn=get_db_cur_con()
@@ -429,6 +431,7 @@ async def predict(request: PredictRequest):
429431
message= makePredictMessage(architecture, batch_size, desired_result_modality, gpu, inputs,has_multi_input,context,config, model["name"], trace_level, 0, "localhost:6831")
430432

431433
sendPredictMessage(message,queue_name,trial_id)
434+
print("*"*20,"RETURNING ELSE TRIAL", experiment_id,"*"*20)
432435
return {"experimentId": experiment_id, "trialId": trial_id, "model_id": model["name"],"input_url": inputs}
433436

434437

python_api/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create_trial_inputs(trial_id, inputs, cur, conn):
4545
while True:
4646
try:
4747
# Fetch the latest max ID
48-
cur.execute("SELECT LAST_VALUE(id) OVER (ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS id FROM trial_inputs LIMIT 1")
48+
cur.execute("SELECT MAX(id) as id FROM trial_inputs")
4949
max_id = cur.fetchone()["id"]
5050
max_id = int(max_id) if max_id is not None else 0 # Handle NULL case
5151

0 commit comments

Comments
 (0)