mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: add batch docstrings
This commit is contained in:
parent
a15a5bc3b8
commit
b98c9b516a
@ -47,7 +47,7 @@ async def create_batch(
|
|||||||
graph: Graph = Body(description="The graph to initialize the session with"),
|
graph: Graph = Body(description="The graph to initialize the session with"),
|
||||||
batch: Batch = Body(description="Batch config to apply to the given graph"),
|
batch: Batch = Body(description="Batch config to apply to the given graph"),
|
||||||
) -> BatchProcessResponse:
|
) -> BatchProcessResponse:
|
||||||
"""Creates and starts a new new batch process"""
|
"""Creates a batch process"""
|
||||||
batch_process_res = ApiDependencies.invoker.services.batch_manager.create_batch_process(batch, graph)
|
batch_process_res = ApiDependencies.invoker.services.batch_manager.create_batch_process(batch, graph)
|
||||||
return batch_process_res
|
return batch_process_res
|
||||||
|
|
||||||
@ -63,6 +63,7 @@ async def create_batch(
|
|||||||
async def start_batch(
|
async def start_batch(
|
||||||
batch_process_id: str = Path(description="ID of Batch to start"),
|
batch_process_id: str = Path(description="ID of Batch to start"),
|
||||||
) -> Response:
|
) -> Response:
|
||||||
|
"""Executes a batch process"""
|
||||||
try:
|
try:
|
||||||
ApiDependencies.invoker.services.batch_manager.run_batch_process(batch_process_id)
|
ApiDependencies.invoker.services.batch_manager.run_batch_process(batch_process_id)
|
||||||
return Response(status_code=202)
|
return Response(status_code=202)
|
||||||
@ -78,7 +79,7 @@ async def start_batch(
|
|||||||
async def cancel_batch(
|
async def cancel_batch(
|
||||||
batch_process_id: str = Path(description="The id of the batch process to cancel"),
|
batch_process_id: str = Path(description="The id of the batch process to cancel"),
|
||||||
) -> Response:
|
) -> Response:
|
||||||
"""Creates and starts a new new batch process"""
|
"""Cancels a batch process"""
|
||||||
ApiDependencies.invoker.services.batch_manager.cancel_batch_process(batch_process_id)
|
ApiDependencies.invoker.services.batch_manager.cancel_batch_process(batch_process_id)
|
||||||
return Response(status_code=202)
|
return Response(status_code=202)
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ async def cancel_batch(
|
|||||||
responses={200: {"model": list[BatchProcessResponse]}},
|
responses={200: {"model": list[BatchProcessResponse]}},
|
||||||
)
|
)
|
||||||
async def list_incomplete_batches() -> list[BatchProcessResponse]:
|
async def list_incomplete_batches() -> list[BatchProcessResponse]:
|
||||||
"""Gets a list of sessions, optionally searching"""
|
"""Lists incomplete batch processes"""
|
||||||
return ApiDependencies.invoker.services.batch_manager.get_incomplete_batch_processes()
|
return ApiDependencies.invoker.services.batch_manager.get_incomplete_batch_processes()
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ async def list_incomplete_batches() -> list[BatchProcessResponse]:
|
|||||||
responses={200: {"model": list[BatchProcessResponse]}},
|
responses={200: {"model": list[BatchProcessResponse]}},
|
||||||
)
|
)
|
||||||
async def list_batches() -> list[BatchProcessResponse]:
|
async def list_batches() -> list[BatchProcessResponse]:
|
||||||
"""Gets a list of sessions, optionally searching"""
|
"""Lists all batch processes"""
|
||||||
return ApiDependencies.invoker.services.batch_manager.get_batch_processes()
|
return ApiDependencies.invoker.services.batch_manager.get_batch_processes()
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ async def get_batch(
|
|||||||
async def get_batch_sessions(
|
async def get_batch_sessions(
|
||||||
batch_process_id: str = Path(description="The id of the batch process to get"),
|
batch_process_id: str = Path(description="The id of the batch process to get"),
|
||||||
) -> list[BatchSession]:
|
) -> list[BatchSession]:
|
||||||
"""Gets a list of BatchSessions Batch Process"""
|
"""Gets a list of batch sessions for a given batch process"""
|
||||||
return ApiDependencies.invoker.services.batch_manager.get_sessions(batch_process_id)
|
return ApiDependencies.invoker.services.batch_manager.get_sessions(batch_process_id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,34 +27,42 @@ class BatchProcessResponse(BaseModel):
|
|||||||
class BatchManagerBase(ABC):
|
class BatchManagerBase(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def start(self, invoker: Invoker) -> None:
|
def start(self, invoker: Invoker) -> None:
|
||||||
|
"""Starts the BatchManager service"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def create_batch_process(self, batch: Batch, graph: Graph) -> BatchProcessResponse:
|
def create_batch_process(self, batch: Batch, graph: Graph) -> BatchProcessResponse:
|
||||||
|
"""Creates a batch process"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def run_batch_process(self, batch_id: str) -> None:
|
def run_batch_process(self, batch_id: str) -> None:
|
||||||
|
"""Runs a batch process"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def cancel_batch_process(self, batch_process_id: str) -> None:
|
def cancel_batch_process(self, batch_process_id: str) -> None:
|
||||||
|
"""Cancels a batch process"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_batch(self, batch_id: str) -> BatchProcessResponse:
|
def get_batch(self, batch_id: str) -> BatchProcessResponse:
|
||||||
|
"""Gets a batch process"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_batch_processes(self) -> list[BatchProcessResponse]:
|
def get_batch_processes(self) -> list[BatchProcessResponse]:
|
||||||
|
"""Gets all batch processes"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_incomplete_batch_processes(self) -> list[BatchProcessResponse]:
|
def get_incomplete_batch_processes(self) -> list[BatchProcessResponse]:
|
||||||
|
"""Gets all incomplete batch processes"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_sessions(self, batch_id: str) -> list[BatchSession]:
|
def get_sessions(self, batch_id: str) -> list[BatchSession]:
|
||||||
|
"""Gets the sessions associated with a batch"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user