feat: valves on_startup & on_shutdown

This commit is contained in:
Timothy J. Baek
2024-05-28 15:39:28 -07:00
parent a8348a3197
commit 88f3d59fcb
20 changed files with 56 additions and 48 deletions

View File

@@ -255,6 +255,7 @@ async def update_valves(pipeline_id: str, form_data: dict):
pipeline_module = PIPELINE_MODULES[pipeline_id]
await pipeline_module.on_shutdown()
try:
ValvesModel = pipeline_module.valves.__class__
valves = ValvesModel(**form_data)
@@ -265,6 +266,7 @@ async def update_valves(pipeline_id: str, form_data: dict):
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f"{str(e)}",
)
await pipeline_module.on_startup()
return pipeline_module.valves