This commit is contained in:
Xi Yan 2025-03-16 19:33:57 -07:00
parent d34b70e3ab
commit 035b2dcb60
9 changed files with 2365 additions and 2190 deletions

View file

@ -3,21 +3,49 @@
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from datetime import datetime
from enum import Enum
from typing import Optional
from pydantic import BaseModel
from llama_stack.schema_utils import json_schema_type
@json_schema_type
class Job(BaseModel):
job_id: str
class JobType(Enum):
batch_inference = "batch_inference"
evaluation = "evaluation"
finetuning = "finetuning"
@json_schema_type
class JobStatus(Enum):
completed = "completed"
in_progress = "in_progress"
failed = "failed"
scheduled = "scheduled"
cancelled = "cancelled"
class JobArtifact(BaseModel):
"""
A job artifact is a file or directory that is produced by a job.
"""
path: str
@json_schema_type
class CommonJobFields(BaseModel):
"""Common fields for all jobs.
:param id: The ID of the job.
:param status: The status of the job.
:param created_at: The time the job was created.
:param ended_at: The time the job ended.
:param error: If status of the job is failed, this will contain the error message.
"""
id: str
status: JobStatus
created_at: datetime
ended_at: Optional[datetime] = None
error: Optional[str] = None