Hey #flyte team, I want to use `FlyteRemote` to ex...
# announcements
a
Hey #flyte team, I want to use
FlyteRemote
to execute a workflow launch plan where one of the parameters is my custom class (assume that I have a good reason why I want to do this). For example, I have:
Copy code
@dataclass_json
@dataclass
class WrappedList:
    files: str
and the workflow
Copy code
@flytekit.workflow
def LocalSlam(input_list: WrappedList)
and that I want to use
FlyteRemote
to execute this worklow like
Copy code
lp = remote.fetch_launch_plan(name=workflow_name, version=workflow_version)
e = remote.execute(lp, inputs=inputs)
The issue is that I can't figure out how to specify my
inputs
for this custom class, e.g. if I have:
Copy code
inputs = {'input_list': WrappedList("foo")}
and I run this code I get:
flytekit.common.exceptions.user.FlyteTypeException: Type error! Received: <class '__main__.WrappedList'> with value: WrappedList(files='foo'), Expected: <class 'types.WrappedlistSchema'>.
So Flyte is unhappy between my local
WrappedList
class type and the remote
types.WrappedlistSchema
that it registered for my class
In the latest flytekit,
remote.execute
takes
type_hints
, but I'm stuck on 0.26.0 for this repo so I can't use that argument (which isn't in that 0.26.0)
Sorry for the esoteric question. Any ideas for constructing a local type that represents the remote
types.WrappedlistSchema
type and passing it into
remote.execute
?
Here is the yaml definition of the
input_list
workflow parameter (from the launch plan):
Copy code
defaultInputs:
    parameters:
      input_files:
        default:
          scalar:
            generic:
              files: ""
        var:
          description: input_files
          type:
            metadata:
              $ref: '#/definitions/WrappedlistSchema'
              $schema: <http://json-schema.org/draft-07/schema#>
              definitions:
                WrappedlistSchema:
                  additionalProperties: false
                  properties:
                    files:
                      title: files
                      type: string
                  type: object
            simple: STRUCT
If you have no idea, it is ok! Just checking in case you do happen to know exactly how I can pass in a class instance into
remote.execute
...
y
hey
can you give a type hint?
execute takes a
type_hints
named arg
@Marc Paquette
163 Views