https://flyte.org logo
#ask-the-community
Title
# ask-the-community
f

Fabio Grätz

07/07/2023, 4:01 PM
Has anyone ever seen an error like this?
Copy code
message: "Could not find LHS for WorkflowBase - racon.torch.flyte.common_workflows.default_conversion && Inputs (4): {'model_uri': <class 'str'>, 'kd_task_uri': <class 'str'>, 'config': <class 'racon.torch.flyte.common_workflows.DefaultConfig'>, 'dry_run': <class 'bool'>} && Outputs (1): {'o0': <class 'str'>} && Output bindings: [<FlyteLiteral var: "o0" binding { promise { node_id: "dn4" var: "o0" } }>] &&  in __main__"
name: "flytekit"
We are lost trying to figure out what is going wrong. Thanks 🙏
This is in a nested
@dynamic
(potentially a bad idea?)
k

Kevin Su

07/07/2023, 4:16 PM
is dataclass defined in the main?
f

Fabio Grätz

07/07/2023, 4:17 PM
You mean whether a dataclass is passed to the dynamic workflow?
k

Kevin Su

07/07/2023, 4:18 PM
I mean
Copy code
@task
  ...

if __name__ == "__main__":
   @dataclass  # dataclass can't be defined here or in the function
    ...
are you able to share the code? I can investigate at it
f

Fabio Grätz

07/07/2023, 4:21 PM
I need to check with the engineer who wrote the workflow whether/which part needs to be redacted, let me get back to you. And thanks 🙏
@Lukas Wiest
y

Yee

07/07/2023, 8:09 PM
the main bit is weird.
can you run from a different file and import instead?
l

Lukas Wiest

07/10/2023, 8:38 AM
here is a minimal example by registering and running the
workflow.py
. I assume it is very much related with that we pass tasks as arguments to a dynamic task by converting it to a string and using importlib to load it again.
Is there a best practice for passing tasks to dynamic tasks? 🤔 Also, locally it works it just fails when running in the flyte cluster which makes debugging a bit harder.
y

Yee

07/10/2023, 3:11 PM
no this is not supported sorry. could you elaborate on what this is for? functions are not first class citizens in the flyte idl. it might one day be but it’s not top of mind tbh.
l

Lukas Wiest

07/10/2023, 3:45 PM
oh okay thank you for the response 🙂! We pass tasks to a dynamic task that is shared and chains those tasks. The tasks are different but follow the same interface. The different part of the tasks is mainly datasets which are non-serializable right now. We might be able to change this in future. For now, we found a way by implementing a custom TypeTransformer for PythonFunctionTask. My little feedback: The "Could not find LHS for WorkflowBase" error might be improved. It also happens when one imports the task inside of the function body of the dynamic task like here:
Copy code
@dynamic
def main_with_task() -> str:
    from flyte_tasks.tasks import train_task
    new_model = train_task(model1="model")
    return new_model
Thank you 🙏
56 Views