From e833342581ce9faab23c491156a41f59db493951 Mon Sep 17 00:00:00 2001 From: faraphel Date: Sun, 19 Jan 2025 18:54:47 +0100 Subject: [PATCH] stdout from the running model is now visible from the manager stdout --- source/model/PythonModel.py | 1 + source/utils/parameters.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/model/PythonModel.py b/source/model/PythonModel.py index c80095b..d2a5b2b 100644 --- a/source/model/PythonModel.py +++ b/source/model/PythonModel.py @@ -45,6 +45,7 @@ class PythonModel(base.BaseModel): self._process = subprocess.Popen( [ "conda", "run", # run a command within conda + "--no-capture-output", # make conda not capture stdout, allow us to see the stdout "--prefix", self.environment.relative_to(self.path), # use the model environment "python3", "-c", # run a python command diff --git a/source/utils/parameters.py b/source/utils/parameters.py index 69d8fff..ce97040 100644 --- a/source/utils/parameters.py +++ b/source/utils/parameters.py @@ -1,4 +1,6 @@ import inspect +import typing + import fastapi @@ -24,8 +26,10 @@ def load(parameters_definition: dict[str, dict]) -> list[inspect.Parameter]: match definition["type"]: case "file": # shortcut for uploading a file - definition["type"] = fastapi.UploadFile - + definition["type"] = typing.Annotated[ + fastapi.UploadFile, + fastapi.File() + ] # deserialize the parameter parameter = inspect.Parameter(