Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivanshShalabh committed Feb 4, 2025
1 parent 3c7689b commit 9c3ac0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions python_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,12 @@ async def predict(request: PredictRequest):
# experiment_id=create_expriement( cur, conn)

trial= get_trial_by_model_and_input( model_id, inputs)
# print(trial)
print("-"*20,experiment_id,"-"*20)
if not experiment_id:
print("+"*20,"ENTERED IF","+"*20)
cur,conn=get_db_cur_con()
experiment_id=create_expriement(cur, conn)
print("+"*20,"ENTERED IF", experiment_id,"+"*20)


# print(trail)
Expand All @@ -401,7 +403,7 @@ async def predict(request: PredictRequest):
new_trial_id=create_trial( model_id, experiment_id, cur, conn,source_trial)
# if not experiment_id:
# experiment_id=create_expriement(cur, conn)

print("*"*20,"RETURNING IF TRIAL", experiment_id,"*"*20)
return {"experimentId": experiment_id, "trialId": new_trial_id, "model_id": model["name"], "input_url": inputs}
else:
cur,conn=get_db_cur_con()
Expand Down Expand Up @@ -429,6 +431,7 @@ async def predict(request: PredictRequest):
message= makePredictMessage(architecture, batch_size, desired_result_modality, gpu, inputs,has_multi_input,context,config, model["name"], trace_level, 0, "localhost:6831")

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


Expand Down
2 changes: 1 addition & 1 deletion python_api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_trial_inputs(trial_id, inputs, cur, conn):
while True:
try:
# Fetch the latest max ID
cur.execute("SELECT LAST_VALUE(id) OVER (ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS id FROM trial_inputs LIMIT 1")
cur.execute("SELECT MAX(id) as id FROM trial_inputs")
max_id = cur.fetchone()["id"]
max_id = int(max_id) if max_id is not None else 0 # Handle NULL case

Expand Down

0 comments on commit 9c3ac0d

Please sign in to comment.