This commit is contained in:
Xi Yan 2025-03-12 00:09:03 -07:00
parent 5c954dd033
commit 78b4cdad67
2 changed files with 82 additions and 46 deletions

View file

@ -3,21 +3,34 @@
#
# 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
@json_schema_type
class JobStatus(Enum):
completed = "completed"
in_progress = "in_progress"
failed = "failed"
scheduled = "scheduled"
cancelled = "cancelled"
@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 finished_at: The time the job finished.
"""
id: str
status: JobStatus
created_at: datetime
finished_at: Optional[datetime] = None