@@ -107,13 +107,29 @@ class Code(int, Enum):
107107 DATA_LOSS = 15
108108 UNAUTHENTICATED = 16
109109
110- # Custom codes for rollout states (using higher numbers to avoid conflicts)
110+ # Custom codes for EP (using higher numbers to avoid conflicts)
111111 FINISHED = 100
112+ RUNNING = 101
112113
113114 @classmethod
114115 def rollout_running (cls ) -> "Status" :
115116 """Create a status indicating the rollout is running."""
116- return cls (code = cls .Code .OK , message = "Rollout is running" , details = [])
117+ return cls (code = cls .Code .RUNNING , message = "Rollout is running" , details = [])
118+
119+ @classmethod
120+ def eval_running (cls ) -> "Status" :
121+ """Create a status indicating the evaluation is running."""
122+ return cls (code = cls .Code .RUNNING , message = "Evaluation is running" , details = [])
123+
124+ @classmethod
125+ def eval_finished (cls ) -> "Status" :
126+ """Create a status indicating the evaluation finished."""
127+ return cls (code = cls .Code .FINISHED , message = "Evaluation finished" , details = [])
128+
129+ @classmethod
130+ def aborted (cls , message : str , details : Optional [List [Dict [str , Any ]]] = None ) -> "Status" :
131+ """Create a status indicating the evaluation was aborted."""
132+ return cls (code = cls .Code .ABORTED , message = message , details = details or [])
117133
118134 @classmethod
119135 def rollout_finished (
@@ -127,7 +143,12 @@ def rollout_finished(
127143 details .append (ErrorInfo .termination_reason (termination_reason ).to_aip193_format ())
128144 if extra_info :
129145 details .append (ErrorInfo .extra_info (extra_info ).to_aip193_format ())
130- return cls (code = cls .Code .FINISHED , message = "Rollout finished" , details = details )
146+ return cls .finished ("Rollout finished" , details )
147+
148+ @classmethod
149+ def finished (cls , message : str , details : Optional [List [Dict [str , Any ]]] = None ) -> "Status" :
150+ """Create a status indicating the rollout finished."""
151+ return cls (code = cls .Code .FINISHED , message = message , details = details or [])
131152
132153 @classmethod
133154 def rollout_error (cls , error_message : str , extra_info : Optional [Dict [str , Any ]] = None ) -> "Status" :
@@ -140,11 +161,11 @@ def rollout_error(cls, error_message: str, extra_info: Optional[Dict[str, Any]]
140161 @classmethod
141162 def error (cls , error_message : str , details : Optional [List [Dict [str , Any ]]] = None ) -> "Status" :
142163 """Create a status indicating the rollout failed with an error."""
143- return cls (code = cls .Code .INTERNAL , message = error_message , details = details )
164+ return cls (code = cls .Code .INTERNAL , message = error_message , details = details or [] )
144165
145166 def is_running (self ) -> bool :
146167 """Check if the status indicates the rollout is running."""
147- return self .code == self .Code .OK and self . message == "Rollout is running"
168+ return self .code == self .Code .RUNNING
148169
149170 def is_finished (self ) -> bool :
150171 """Check if the status indicates the rollout finished successfully."""
@@ -436,9 +457,7 @@ class EvalMetadata(BaseModel):
436457 default_factory = get_pep440_version ,
437458 description = "Version of the evaluation. Should be populated with a PEP 440 version string." ,
438459 )
439- status : Optional [Literal ["running" , "finished" , "error" , "stopped" ]] = Field (
440- None , description = "Status of the evaluation"
441- )
460+ status : Optional [Status ] = Field (None , description = "Status of the evaluation" )
442461 num_runs : int = Field (..., description = "Number of times the evaluation was repeated" )
443462 aggregation_method : str = Field (..., description = "Method used to aggregate scores across runs" )
444463 passed_threshold : Optional [EvaluationThreshold ] = Field (
@@ -527,7 +546,7 @@ class EvaluationRow(BaseModel):
527546 )
528547
529548 pid : Optional [int ] = Field (
530- None ,
549+ default = None ,
531550 description = "The PID of the process that created the row. This is used by the evaluation watcher to detect stopped evaluations." ,
532551 )
533552
0 commit comments