Hello everyone.. trying to set a launchplan with s...
# flyte-support
r
Hello everyone.. trying to set a launchplan with scheduler but get an error that can’t understand. This is the workflow and launchplan. The workflow works correctly, the problem is with the launchplan registration
Copy code
import typing
from flytekit import workflow, LaunchPlan, CronSchedule
from sync_historicals import check_people


@workflow
def sync_historicals_workflow() -> typing.List[str]:
    return check_people()



lp = LaunchPlan.get_or_create(
    "sync_entityes_workflow_scheduler",
    sync_historicals_workflow,
    schedule=CronSchedule(
        schedule="*/15 * * * *",  # Following schedule runs every min
    ),
)
and this is the error at registration
Copy code
Traceback (most recent call last):
  File "/opt/env/bin/pyflyte", line 8, in <module>
    sys.exit(main())
  File "/opt/env/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/env/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/env/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/env/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/env/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/env/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/env/lib/python3.9/site-packages/flytekit/clis/sdk_in_container/register.py", line 194, in register
    registerable_entities = load_packages_and_modules(
  File "/opt/env/lib/python3.9/site-packages/flytekit/tools/repo.py", line 225, in load_packages_and_modules
    registrable_entities = serialize(pkgs_and_modules, ss, str(project_root), options)
  File "/opt/env/lib/python3.9/site-packages/flytekit/tools/repo.py", line 52, in serialize
    module_loader.just_load_modules(pkgs=pkgs)
  File "/opt/env/lib/python3.9/site-packages/flytekit/tools/module_loader.py", line 33, in just_load_modules
    importlib.import_module(name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/code/workflows/sync_entities/sync_entity_workflow.py", line 12, in <module>
    lp = LaunchPlan.get_or_create(
  File "/opt/env/lib/python3.9/site-packages/flytekit/core/launch_plan.py", line 278, in get_or_create
    lp = cls.create(
  File "/opt/env/lib/python3.9/site-packages/flytekit/core/launch_plan.py", line 126, in create
    wf_signature_parameters = transform_inputs_to_parameters(ctx, workflow.python_interface)
AttributeError: 'str' object has no attribute 'python_interface'
Any ideas?
g
which version of flytekit are you using?
h
Copy code
lp = LaunchPlan.get_or_create(
    "sync_entityes_workflow_scheduler",
    sync_historicals_workflow,
    schedule=CronSchedule(
        schedule="*/15 * * * *",  # Following schedule runs every min
    ),
)
Can you use named args instead of positional args. I wonder if ordering of args changed...
Copy code
lp = LaunchPlan.get_or_create(
    name="sync_entityes_workflow_scheduler",
    workflow=sync_historicals_workflow,
    schedule=CronSchedule(
        schedule="*/15 * * * *",  # Following schedule runs every min
    ),
)
r
using named args was the solution