Amelie Froessl
09/08/2022, 9:58 AMclass Parameters_1(BaseModel, extra=Extra.forbid):
a: int
b: int
c: str
class Parameters_2(BaseModel, extra=Extra.forbid):
d: int
e: int
f: str
class Parameters_3(BaseModel, extra=Extra.forbid):
g: int
h: int
i: str
class TestConfig(BaseModel, extra=Extra.forbid):
parameters_1: Parameters_1
parameters_2: Parameters_2
parameters_3: Parameters_3
On the UI it shows up like in the attached screenshot. The input would be a dictionary of the values in the respecitve BaseModel like : {"a":1, "b":2, "c": "hello"}
. ... which is not the nicest I guess. I was wondering if there is a way to nicely have the parameters of a sub BaseModel show up/ editable in the UI? Or if somebody has a suggestion on how this could be solved in a nicer way?
Thanks in advance!Anna Geller
09/08/2022, 11:38 AMAmelie Froessl
09/08/2022, 12:20 PM$ prefect deployment build ./test_flow.py:main -n paramter-test -q parameter-test-queue
$ prefect deployment apply main-deployment.yaml
In the UI then I would like to have all of the separate fields in the parameters show up/ customizable.. but it seems like I can only customize the entire parameters one by one...Anna Geller
09/08/2022, 12:58 PMAmelie Froessl
09/08/2022, 1:03 PMAnna Geller
09/08/2022, 1:40 PMAmelie Froessl
09/08/2022, 1:45 PMAnna Geller
09/08/2022, 1:51 PMAmelie Froessl
09/08/2022, 1:56 PMAnna Geller
09/08/2022, 2:02 PM# setup
from prefect.blocks.system import JSON
block = JSON(value=dict(question="ultimate", answer=42))
block.save("demo", overwrite=True)
# use e.g. in a flow/task
x = JSON.load("demo")
print(x.value)
print(type(x.value))
Amelie Froessl
09/09/2022, 2:38 PMparameters.json
file. running it locally works no problem... but when i copy paste the content of the parameters.json
into the parameters input field in the UI to run with custom parameter. The flow is giving me the below error: I've tried a couple of different ways to pass a simple json now to the flow as a customizable input.. but I just can't seem to find a way that works.
Traceback (most recent call last):
File "/home/amelie/.cache/pypoetry/virtualenvs/prefect-pipelines-Ixm-msGT-py3.8/lib/python3.8/site-packages/prefect/engine.py", line 284, in retrieve_flow_then_begin_flow_run
parameters = flow.validate_parameters(flow_run.parameters)
File "/home/amelie/.cache/pypoetry/virtualenvs/prefect-pipelines-Ixm-msGT-py3.8/lib/python3.8/site-packages/prefect/flows.py", line 269, in validate_parameters
raise ParameterTypeError.from_validation_error(exc) from None
prefect.exceptions.ParameterTypeError: Flow run received invalid parameters:
- parameters: value is not a valid dict
Anna Geller
09/09/2022, 7:08 PMAmelie Froessl
09/21/2022, 7:59 AM