New RunLLM response generated: >>>*# Question* He...
# runllm-flyte-trial
a
New RunLLM response generated: >>>*# Question* 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'```
Copy code
Any ideas?
*# Answer*
The error you're encountering is due to the incorrect order of arguments in the `LaunchPlan.get_or_create` method. The first argument should be the workflow, followed by the name of the launch plan, and then the schedule. Here's the corrected 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_historicals_workflow, name="sync_entityes_workflow_scheduler", schedule=CronSchedule( schedule="*/15 * * * *", # Following schedule runs every 15 minutes ), ) ``` This should resolve the
AttributeError: 'str' object has no attribute 'python_interface'
issue. Would you like more details or further assistance? Sources: - [Flyte Issue #4577](https://github.com/flyteorg/flyte/issues/4577) # Slack Link https://flyte-org.slack.com/archives/CP2HDHKE1/p1718843811.492899 ๐Ÿ‘ 0 button ๐Ÿ‘Ž 0 button ๐Ÿ’ก Hint: Mention @runllm in the thread for followups.