1212class TrialStatus (enum .Enum ):
1313 PENDING = "pending"
1414 RUNNING = "running"
15- FINISHED = "finished "
15+ COMPLETED = "completed "
1616 FAILED = "failed"
1717
1818
19- COMPLETED_STATUS = [TrialStatus .FINISHED , TrialStatus .FAILED ]
19+ FINISHED_STATUS = [TrialStatus .COMPLETED , TrialStatus .FAILED ]
2020
2121
2222class Project (Base ):
@@ -26,9 +26,11 @@ class Project(Base):
2626 name = Column (String , nullable = False )
2727 description = Column (String , nullable = True )
2828
29- created_at = Column (DateTime (timezone = True ), default = datetime .now (UTC ))
29+ created_at = Column (DateTime (timezone = True ), default = lambda : datetime .now (UTC ))
3030 updated_at = Column (
31- DateTime (timezone = True ), default = datetime .now (UTC ), onupdate = datetime .now (UTC )
31+ DateTime (timezone = True ),
32+ default = lambda : datetime .now (UTC ),
33+ onupdate = lambda : datetime .now (UTC ),
3234 )
3335 is_del = Column (Integer , default = 0 , comment = "0 for not deleted, 1 for deleted" )
3436
@@ -43,9 +45,11 @@ class Experiment(Base):
4345 project_id = Column (UUID (as_uuid = True ), nullable = False )
4446 meta = Column (JSON , nullable = True , comment = "Additional metadata for the experiment" )
4547
46- created_at = Column (DateTime (timezone = True ), default = datetime .now (UTC ))
48+ created_at = Column (DateTime (timezone = True ), default = lambda : datetime .now (UTC ))
4749 updated_at = Column (
48- DateTime (timezone = True ), default = datetime .now (UTC ), onupdate = datetime .now (UTC )
50+ DateTime (timezone = True ),
51+ default = lambda : datetime .now (UTC ),
52+ onupdate = lambda : datetime .now (UTC ),
4953 )
5054 is_del = Column (Integer , default = 0 , comment = "0 for not deleted, 1 for deleted" )
5155
@@ -60,16 +64,19 @@ class Trial(Base):
6064 description = Column (String , nullable = True )
6165 meta = Column (JSON , nullable = True , comment = "Additional metadata for the trial" )
6266 params = Column (JSON , nullable = True , comment = "Parameters for the experiment" )
67+ duration = Column (Float , nullable = True , comment = "Duration of the trial in seconds" )
6368 status = Column (
6469 Enum (TrialStatus ),
6570 default = TrialStatus .PENDING ,
6671 nullable = False ,
6772 comment = "Status of the trial" ,
6873 )
6974
70- created_at = Column (DateTime (timezone = True ), default = datetime .now (UTC ))
75+ created_at = Column (DateTime (timezone = True ), default = lambda : datetime .now (UTC ))
7176 updated_at = Column (
72- DateTime (timezone = True ), default = datetime .now (UTC ), onupdate = datetime .now (UTC )
77+ DateTime (timezone = True ),
78+ default = lambda : datetime .now (UTC ),
79+ onupdate = lambda : datetime .now (UTC ),
7380 )
7481
7582
@@ -80,9 +87,11 @@ class Run(Base):
8087 project_id = Column (UUID (as_uuid = True ), nullable = False )
8188 trial_id = Column (UUID (as_uuid = True ), nullable = False )
8289
83- created_at = Column (DateTime (timezone = True ), default = datetime .now (UTC ))
90+ created_at = Column (DateTime (timezone = True ), default = lambda : datetime .now (UTC ))
8491 updated_at = Column (
85- DateTime (timezone = True ), default = datetime .now (UTC ), onupdate = datetime .now (UTC )
92+ DateTime (timezone = True ),
93+ default = lambda : datetime .now (UTC ),
94+ onupdate = lambda : datetime .now (UTC ),
8695 )
8796
8897
@@ -96,9 +105,11 @@ class Model(Base):
96105 version = Column (String , nullable = False )
97106 meta = Column (JSON , nullable = True , comment = "Additional metadata for the model" )
98107
99- created_at = Column (DateTime (timezone = True ), default = datetime .now (UTC ))
108+ created_at = Column (DateTime (timezone = True ), default = lambda : datetime .now (UTC ))
100109 updated_at = Column (
101- DateTime (timezone = True ), default = datetime .now (UTC ), onupdate = datetime .now (UTC )
110+ DateTime (timezone = True ),
111+ default = lambda : datetime .now (UTC ),
112+ onupdate = lambda : datetime .now (UTC ),
102113 )
103114 is_del = Column (Integer , default = 0 , comment = "0 for not deleted, 1 for deleted" )
104115
0 commit comments