Launch Plans launched in the UI seem to silently i...
# ask-the-community
e
Launch Plans launched in the UI seem to silently ignore "default_inputs" that are structs when specified in Python. So e.g.
Copy code
@dataclass_json
@dataclass
class MyStruct
   foo: str
   bar: str = 'baz'

def workflow(s: MyStruct):
   pass

qux = LaunchPlan(workflow, default_inputs=dict(s=MyStruct(foo='baz', bar='qux')))
If i go to launch
workflow
with the
qux
launch plan it instead takes the default values from the struct definition. So
foo
will be unset and
bar
will be set by default as
baz
Not sure where the error is here, though. Has anyone else seen this?
k
This might be because of the jsonschema that has field defaults. I think this is a bug in the Ui. The backend will do the right thing. Cc @Jason Porter / @Niels Bantilan
e
Indeed if I go to LaunchPlan details page the struct is visible under "default inputs", but the value is listed as a "scalar", with no additional details
k
Aaha, if you try Flyte remote or cli it should work
Ui bug in overriding the jsonschema with default inputs. Not sure how this can be done
But will follow up with a few Ui folks
n
yeah there are a couple of issues with dataclasses in the UI: @Eli Bixby would you mind opening up a [flyte-bug] issue? 👇
e
I appears that Enums inside of dataclasses are also broken when specified through the UI? It's trying to convert the name of the enum rather than the value of the enum back, and getting a disallowed value error.
Not sure if that's a UI bug or a general bug.
k
So the Ui works by extracting the json schema from the dataclass
You can refer to dataclasses_json docs
Can you explain more about the bug
e
So if I specify a dataclass as:
Copy code
class MyEnum(enum.Enum):
   ONE = 'one'
   TWO = 'two'

class MyStruct:
    option: MyEnum
It will nicely generate a dropdown bar in the UI when I go to launch. But then if I actually run the workflow that recieves MyStruct I'll get:
Copy code
ONE is not a valid MyEnum, please select one of ['one', 'two']
So it looks like it's sending
enum.name
rather than
enum.value
forward to the task. This may be a dataclasses_json bug though? I haven't tried this not in the UI, though it works just fine locally.
Ok. Confirmed this is a UI bug. Enums specified via launch plans, and as default arguments are properly serialized/deserialized by value, whereas those specified in dropdown bars are serialized by name (and fail on deserialization)
n
thanks!
106 Views