When using Flyte remote, is there a way to convert...
# flytekit
b
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?
t
FlyteWorkflowExecution
used to have
raw_outputs
but I don’t find it in the recent flytekit versions. @high-accountant-32689, 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.
πŸ‘ 1
f
You can simply type - execution.inputs and this returns a resolver
The resolver can return raw, guessed or you can pass it a hint
πŸ‘ 1
b
Thanks @tall-lock-23197 and @freezing-airport-6809, using a type hint works and will return an instance of
TrainingArgs
Copy code
execution.inputs.get("training_args", as_type=TrainingArgs)
πŸ’― 1
πŸ‘ 2
156 Views