-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [flyteconsole] Can't launch task with nested dataclasses as input #3110
Comments
Thank you for opening your first issue here! 🛠 |
If rampant speculation is appropriate - the issue could be one of:
{
"y": {
"type": {
"metadata": {
"fields": {
"$ref": {
"stringValue": "#/definitions/DataclassesonlySchema"
},
"definitions": {
"structValue": {
"fields": {
"DataclassesonlySchema": {
"structValue": {
"fields": {
"type": {
"stringValue": "object"
},
"properties": {
"structValue": {
"fields": {
"first": {
"structValue": {
"fields": {
"type": {
"stringValue": "object"
},
"field_many": {
"boolValue": false
},
"$ref": {
"stringValue": "#/definitions/LiteralsonlySchema"
}
}
}
},
"second": {
"structValue": {
"fields": {
"$ref": {
"stringValue": "#/definitions/LiteralsonlySchema"
},
"type": {
"stringValue": "object"
},
"field_many": {
"boolValue": false
}
}
}
}
}
}
},
"additionalProperties": {
"boolValue": false
}
}
}
},
"LiteralsonlySchema": {
"structValue": {
"fields": {
"properties": {
"structValue": {
"fields": {
"foo": {
"structValue": {
"fields": {
"title": {
"stringValue": "foo"
},
"type": {
"stringValue": "string"
}
}
}
},
"bar": {
"structValue": {
"fields": {
"type": {
"stringValue": "integer"
},
"title": {
"stringValue": "bar"
}
}
}
}
}
}
},
"additionalProperties": {
"boolValue": false
},
"type": {
"stringValue": "object"
}
}
}
}
}
}
},
"$schema": {
"stringValue": "http://json-schema.org/draft-07/schema#"
}
}
},
"simple": 9
},
"description": "y"
}
} |
One interesting line is here: if (literalType?.metadata?.fields?.definitions?.structValue?.fields) {
const keys = Object.keys(literalType?.metadata?.fields?.definitions?.structValue?.fields);
if (keys[0]) {
parsedJson = protobufValueToPrimitive(
literalType.metadata.fields.definitions.structValue.fields[`${keys[0]}`],
);
if (parsedJson) {
parsedJson = formatJson(parsedJson);
jsonFormRenderable = true;
}
} Specifically, the choice to load only the first definition. In my example, the LiteralsonlySchema is the second element in the definition fields, so is not loaded. It looks like this function should be re-written to load all definitions |
@jsonporter to make two tickets from this:
|
Thanks! It might also be helpful to update the docs to mention that nested dataclass types aren't currently supported. That wasn't clear to me from the admonition For what it's worth, for my use case I've just changed every nested dataclass I'm passing around in Flyte to to dict's, and handle conversion from dicts to dataclasses and back within the tasks: @task
def my_task(param: dict) -> dict:
param = ParamClass.from_dict(param)
# do stuff
return result.to_dict() |
cool, yeah let's clean that up. Would you mind opening up a docs issue for that @alex-dr ? https://github.com/flyteorg/flyte/issues/new?assignees=&labels=documentation%2Cuntriaged&template=docs_issue.yaml&title=%5BDocs%5D+ |
Hey @cosmicBboy @alex-dr, This is what I am seeing in terms of JSON schema representation for the task:
I am not sure what is the best solution to this is though I thought I had an initial fix. Looking at the codebase I was able to figure out why the error was arbitrary. Taking the above JSON schema and implementation of the parsedJSON function:
I saw two oddities initially:
Had two follow up questions:
or
|
Just to capture the discussion here, we're going to implement a 2-stage solution:
|
The quick fix sounds great for me, and look forward to the long-term one. Thanks all! |
Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable. |
Describe the bug
I'm having an issue launching tasks from the Flyte Console with nested dataclasses as an input.
My workflow itself runs fine from the CLI and the task inputs/metadata can be viewed as expected.
However, the RERUN button from a workflow task, or Launch Task from the Tasks interface seems to arbitrarily either:
Could not find a definition for #/definitions/LiteralsonlySchema
(see reproducer below)foo
andbar
keys of the LiteralsOnly dataclass (which leads to a deserialization error at runtime if you try it, because those are not the appropriate task inputs).Cases 1 and 2 both appear when launching a workflow or a task if the inputs include nested dataclasses.
Case 2 only appears to happen after a couple page refreshes and navigating around. Once Case 1 appears it seems to get stuck on that error mode.
Expected behavior
I expect to be able to create arbitrary levels of nested dataclasses and to be able to run tasks and workflows taking these types as inputs from the Flyte Console.
If the UI form cannot present arbitrary levels of nested objects, I am fine with pasting in a blob of JSON.
Additional context to reproduce
Simple reproducer script - the
literals_only
task works in the UI just fine, but thedataclasses_only
task does not.dataclasses_only
taskMy environment includes:
Screenshots
Case 1:
Case 2:
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: