llama-stack-mirror/llama_stack/distribution/jobs.py
Ihar Hrachyshka 90799cdcee feat: add /jobs API
This API will be later tied to jobs as defined for specific flows
(post-training, eval, etc.) through the common scheduler mechanism.

Note: At the moment, API does nothing useful. (Except returning Not
Implemented errors when called.)

This is an alternative to developing per-flow jobs APIs. Eventually,
once /jobs API is implemented, we should be able to deprecate existing
APIs under /v1/post-training/, /v1/eval/ etc.

See #1587 (tracker)
See #1238 (design details)

Note: This is an alternative path to #1582 and #1583.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-03-12 17:04:43 -04:00

48 lines
1.1 KiB
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from pydantic import BaseModel
from llama_stack.apis.jobs import (
JobInfo,
Jobs,
ListJobsResponse,
)
from llama_stack.distribution.datatypes import StackRunConfig
class DistributionJobsConfig(BaseModel):
run_config: StackRunConfig
async def get_provider_impl(config, deps):
impl = DistributionJobsImpl(config, deps)
await impl.initialize()
return impl
class DistributionJobsImpl(Jobs):
def __init__(self, config, deps):
self.config = config
self.deps = deps
async def initialize(self) -> None:
pass
async def shutdown(self) -> None:
pass
async def list_jobs(self) -> ListJobsResponse:
raise NotImplementedError
async def delete_job(self, job_id: str) -> None:
raise NotImplementedError
async def cancel_job(self, job_id: str) -> None:
raise NotImplementedError
async def get_job(self, job_id: str) -> JobInfo:
raise NotImplementedError