mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 20:59:05 +00:00
server: first attempts to split post pipeline as single celery tasks
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user