@@ -211,6 +211,12 @@ def default_job_progress() -> JobProgress:
211
211
212
212
213
213
def default_ml_job_progress () -> JobProgress :
214
+ """
215
+ Default stages for an ML Job.
216
+
217
+ @TODO add this to the get_default_progress() method of the
218
+ MLJob class, or delete it. Currently unused.
219
+ """
214
220
return JobProgress (
215
221
summary = JobProgressSummary (status = JobState .CREATED , progress = 0 ),
216
222
stages = [
@@ -689,8 +695,8 @@ class Job(BaseModel):
689
695
finished_at = models .DateTimeField (null = True , blank = True )
690
696
# @TODO can we use an Enum or Pydantic model for status?
691
697
status = models .CharField (max_length = 255 , default = JobState .CREATED .name , choices = JobState .choices ())
692
- progress : JobProgress = SchemaField (JobProgress , default = default_job_progress () )
693
- logs : JobLogs = SchemaField (JobLogs , default = JobLogs ())
698
+ progress : JobProgress = SchemaField (JobProgress , default = default_job_progress )
699
+ logs : JobLogs = SchemaField (JobLogs , default = lambda : JobLogs ())
694
700
params = models .JSONField (null = True , blank = True )
695
701
result = models .JSONField (null = True , blank = True )
696
702
task_id = models .CharField (max_length = 255 , null = True , blank = True )
@@ -781,7 +787,7 @@ def setup(self, save=True):
781
787
"""
782
788
Setup the job by creating the job stages.
783
789
"""
784
- self .progress = self .progress or default_job_progress
790
+ self .progress = self .progress or self . get_default_progress ()
785
791
786
792
if self .delay :
787
793
delay_stage = self .progress .add_stage ("Delay" )
@@ -941,7 +947,7 @@ def get_custom_user_permissions(self, user) -> list[str]:
941
947
return list (custom_perms )
942
948
943
949
@classmethod
944
- def default_progress (cls ) -> JobProgress :
950
+ def get_default_progress (cls ) -> JobProgress :
945
951
"""Return the progress of each stage of this job as a dictionary"""
946
952
return default_job_progress ()
947
953
0 commit comments