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

Cornelis Boon

03/11/2024, 12:07 PM
Hey, got a little trouble when trying to register my workflow to my remote flyte instance using
Copy code
pyflyte register workflows/workflows.py
By the looks of it, it happens when it tries to generate a default launchplan, but I'm not sure how to fix it or how to reproduce it outside of registration Stacktrace in ๐Ÿงต
Copy code
:
Failed with Unknown Exception <class 'TypeError'> Reason: isinstance() arg 2 must be a type, a tuple of types, or a union
Traceback:
  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/utils.py", line 139, in invoke
    return super().invoke(ctx)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/register.py", line 202, in register
    raise e

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/register.py", line 183, in register
    repo.register(

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 264, in register
    registrable_entities = load_packages_and_modules(

  File "<<root>>envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 183, in load_packages_and_modules
    registrable_entities = serialize(pkgs_and_modules, ss, str(project_root), options)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 48, in serialize
    registrable_entities = get_registrable_entities(ctx, options=options)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/serialize_helpers.py", line 60, in get_registrable_entities
    lp = LaunchPlan.get_default_launch_plan(ctx, entity)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/launch_plan.py", line 93, in get_default_launch_plan
    parameter_map = transform_inputs_to_parameters(ctx, workflow.python_interface)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/interface.py", line 233, in transform_inputs_to_parameters
    default_lv = TypeEngine.to_literal(ctx, _default, python_type=interface.inputs[k], expected=v.type)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/type_engine.py", line 1111, in to_literal
    transformer.assert_type(python_type, python_val)

  File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/type_engine.py", line 154, in assert_type
    if not hasattr(t, "__origin__") and not isinstance(v, t):

isinstance() arg 2 must be a type, a tuple of types, or a union
One type annotation had a '=" instead of ':' ๐Ÿ˜…
k

Kevin Su

03/11/2024, 6:13 PM
could you share your code snippet?
c

Cornelis Boon

03/11/2024, 6:21 PM
I can't post specifically my code due to confidentiality reasons, but it looked similar to:
Copy code
from flytekit import workflow

@workflow
def mywf(first=str, second=str):
  ....
instead of
Copy code
from flytekit import workflow

@workflow
def mywf(first:str, second:str):
  ....
Swapping the equal signs for colons was all I needed to do
Just wasnt' immediately clear from the stacktrace
k

Kevin Su

03/11/2024, 6:33 PM
ah, I see. could you file a ticket? [flyte-bug]
k

Kevin Su

03/11/2024, 6:34 PM
weโ€™re trying to improve the error message recently