Hi everyone, on Prefect 2.19.7, why on a dag list ...
# prefect-ui
g
Hi everyone, on Prefect 2.19.7, why on a dag list parameter, if I use use json input from the UI and the parameter has default values, this is showed like this
Copy code
{
  "parameter1": [
    {
      "__prefect_kind": "json",
      "value": "\"d\""
    }
  ],
  "parameter2": [
    {
      "__prefect_kind": "json",
      "value": "\"a\""
    },
    {
      "__prefect_kind": "json",
      "value": "\"b\""
    },    {
      "__prefect_kind": "json",
      "value": "\"c\""
    },
  ]
}
and not like this?
Copy code
{
  "parameter1": [
    "*._sdc_rejected"
  ],
  "parameter2": [
    "a",
    "b",
    "c"
  ]
}
1
c
@Giacomo Chiarella great question. This is because we store some meta data about the form. When this is sent to the api to actually create a run this gets preprocessed by the api and it turns into the value you’d expect. The reason this is happening for your default values could be a few things. Most likely because there is no type associated with this list in the schema generated from your flow definition. So since the ui doesn’t know if it should use a text input it transforms it into a json type which allows for entering any value.
g
in the function with the @flow decorator I have
parameter1: list, parameter2: list
, what else should I add?
c
You could type what the values in the list are. Like
list[str]
But im wondering if what you’re seeing now is an issue? Or are you just wondering how the ui works?
g
exactly. In the previous version it was working correctly. This issue does not happen on all dags
c
What is the issue though? This is how the ui is expected to work. The ui and the api use this metadata about the form values to generate the form and do validation.
g
I’m just wondering why it appears like that comparing with the previous version. I’m trying to understand what changed in order to fix it or if it is a bug in the ui
I’m setting like you said list[str] and let’s see
c
Is something not working with your flows or deployments? I’m assuming you recently upgraded prefect versions. What you’re seeing is part of the “enhanced deployment parameters” work we did earlier this year.
g
the issue is only in the ui: whenever I have to have to change default values I need to remove the dictionary that Prefect shows me
c
So you’re changing the flow definition and then updating the deployment defaults in the ui?
g
no, sometimes, we need to run a flow with different parameters, like the flow is scheduled to run with a list of tables t1, t2 ,t3, but sometimes we need to run only on t1 or only on t2 and t3 or even t4 and t5 which are not in the default list. So we need a custom run and there you set the values of the parameters and deleting the extra part is annoying (although I have not tried to run it with that __prefect_kind attribute). Anyway, list[str] solved the ui issue, now it shows the list properly
c
Got it. Well if you use just
list
you should have been able to just change the parameters from the ui without messing with the prefect kind attribute and it would run just fine. But updating it to
list[str]
avoids that showing up at all. Unless you manually switched to json in the parameter form. Sounds like you've got it sorted out though, thanks for the question