Skip to content

Commit

Permalink
Refactor create_trial function to handle source trials absence
Browse files Browse the repository at this point in the history
  • Loading branch information
amirnd51 committed Sep 10, 2024
1 parent 95a0387 commit 2365171
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python_api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_trial( model_id, experiment_id, cur, conn,source_id="",completed_at=N
if source_id!="":
cur.execute("INSERT INTO trials (id,model_id,created_at,updated_at,completed_at,experiment_id,source_trial_id) VALUES (%s,%s,%s,%s,%s,%s,%s) RETURNING id", (trial_id,model_id, datetime.now(), datetime.now() ,datetime.now() , experiment_id,source_id))
else:
cur.execute("INSERT INTO trials (id,model_id,created_at,updated_at,experiment_id) VALUES (%s,%s,%s,%s) RETURNING id", (trial_id,model_id, datetime.now(), datetime.now() , experiment_id))
cur.execute("INSERT INTO trials (id,model_id,created_at,updated_at,experiment_id) VALUES (%s,%s,%s,%s,%s) RETURNING id", (trial_id, model_id, datetime.now(), datetime.now() , experiment_id))
conn.commit()
return trial_id

Expand Down

0 comments on commit 2365171

Please sign in to comment.