When using Flyte remote, is there a way to convert...
# flytekit
s
When using Flyte remote, is there a way to convert inputs/outputs back to the original types if I have access to the code? I.e. if I define a dataclass
TrainingArgs
and use that as an input to a task and then fetch an execution of that task using remote, I'll get a
TrainingargsSchema
object which is generated from the protobuf I guess. Now I'd like to convert that back to a
TrainingArgs
instance. Is this possible?
s
FlyteWorkflowExecution
used to have
raw_outputs
but I don’t find it in the recent flytekit versions. @Eduardo Apolinario (eapolinario), any idea why this has been removed? For the time being, you can convert the schema to dict
<http://dataclass_schema.to|dataclass_schema.to>_dict()
or extract the fields directly from the schema
dataclass_schema.epochs
, and create a dataclass.
k
You can simply type - execution.inputs and this returns a resolver
The resolver can return raw, guessed or you can pass it a hint
s
Thanks @Samhita Alla and @Ketan (kumare3), using a type hint works and will return an instance of
TrainingArgs
Copy code
execution.inputs.get("training_args", as_type=TrainingArgs)