server: first attempts to split post pipeline as single celery tasks

This commit is contained in:
2023-11-15 21:24:21 +01:00
committed by Mathieu Virbel
parent 55a3a59d52
commit aecc3a0c3b
4 changed files with 241 additions and 48 deletions

View File

@@ -1,6 +1,7 @@
import importlib
from pydantic import BaseModel
from reflector.settings import settings
import importlib
class FileResult(BaseModel):
@@ -17,14 +18,14 @@ class Storage:
cls._registry[name] = kclass
@classmethod
def get_instance(cls, name, settings_prefix=""):
def get_instance(cls, name: str, settings_prefix: str = "", folder: str = ""):
if name not in cls._registry:
module_name = f"reflector.storage.storage_{name}"
importlib.import_module(module_name)
# gather specific configuration for the processor
# search `TRANSCRIPT_BACKEND_XXX_YYY`, push to constructor as `backend_xxx_yyy`
config = {}
config = {"folder": folder}
name_upper = name.upper()
config_prefix = f"{settings_prefix}{name_upper}_"
for key, value in settings:
@@ -34,6 +35,10 @@ class Storage:
return cls._registry[name](**config)
def __init__(self):
self.folder = ""
super().__init__()
async def put_file(self, filename: str, data: bytes) -> FileResult:
return await self._put_file(filename, data)