straight-businessperson-54649
05/22/2023, 4:11 AMValueError: Empty module name
when running a map_task()
with flytekit and trying to load the actual task
object. More details below ⬇️
cc: @big-easter-12386straight-businessperson-54649
05/22/2023, 4:16 AMmap_task
with flytekit we are seeing this ValueError: Empty module name
│ ❱ 546 │ _execute_map_task( │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/site-packages/flytekit/e │
│ xceptions/scopes.py:160 in system_entry_point │
│ │
│ ❱ 160 │ │ │ │ return wrapped(*args, **kwargs) │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/site-packages/flytekit/b │
│ in/entrypoint.py:394 in _execute_map_task │
│ │
│ ❱ 394 │ │ map_task = mtr.load_task(loader_args=resolver_args, max_concur │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/site-packages/flytekit/c │
│ ore/utils.py:295 in wrapper │
│ │
│ ❱ 295 │ │ │ │ return func(*args, **kwargs) │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/site-packages/flytekit/c │
│ ore/map_task.py:368 in load_task │
│ │
│ ❱ 368 │ │ resolver_obj = load_object_from_module(resolver) │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/site-packages/flytekit/t │
│ ools/module_loader.py:43 in load_object_from_module │
│ │
│ ❱ 43 │ class_obj_mod = importlib.import_module(".".join(class_obj_mod)) │
│ │
│ /root/micromamba/envs/xxx/lib/python3.10/importlib/__init__.py:12 │
│ 6 in import_module │
│ │
│ ❱ 126 │ return _bootstrap._gcd_import(name[level:], package, level) │
│ in _gcd_import:1047 │
│ in _sanity_check:981 │
╰──────────────────────────────────────────────────────────────────────────────╯
ValueError: Empty module name
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
straight-businessperson-54649
05/22/2023, 4:41 AMflytectl register files
map_task
is invoked as such:
result = map_task(foo_task, concurrency=5)(
a = x
)
in a workflow defined in directory flyte/a/b/tasks
foo_task
is defined in a file in the same directory flyte/a/b/tasks
The failing command pyflyte-map-execute
in the logs has --input
'task-module'
: flyte.a.b.tasks
Here is the structure of the error message:
CalledProcessError: Command '['pyflyte-map-execute', '--inputs',
'xxx', '--output-prefix',
'xxx', '--raw-output-data-prefix',
'xxx',
'--checkpoint-path',
'xxx',
'--prev-checkpoint', '""', '--dynamic-addl-distro',
'xxx', '--dynamic-dest-dir', '.',
'--resolver', 'MapTaskResolver', '--', 'vars', 'resolver',
'flytekit.core.python_auto_container.default_task_resolver', 'task-module',
'flyte.a.b.tasks', 'task-name', 'foo_task']'
Thanks Yee, let me know if there's anything else I can provide that would be helpful to troubleshoot!tall-lock-23197
flyte.a.b.tasks.<module>
. Is it possible for you to share the directory structure and the serialization & registration commands you're running?straight-businessperson-54649
05/22/2023, 6:50 AMflyte/a/b/tasks/workflows.py
and the workflow calls a map_task():
@workflow
def foo_workflow():
result = map_task(foo_task, concurrency=5)(
a = x
)
task is defined in flyte/a/b/tasks/tasks.py
Serialization/registration commands:
pyflyte -k a -k flyte.a serialize --image xxx workflows -f /tmp/workflows \
&& flytectl --admin.endpoint dns:///xxx register files /tmp/workflows/* -p foo -d bar --version='xxx' \
tall-lock-23197
pyflyte package
instead of pyflyte serialize
?
https://docs.flyte.org/projects/flytekit/en/latest/pyflyte.html#pyflyte-package
https://docs.flyte.org/projects/cookbook/en/latest/getting_started/package_register.html#package-your-project-with-pyflyte-packagebig-easter-12386
05/22/2023, 10:20 AMtall-lock-23197
high-accountant-32689
05/23/2023, 9:59 PMtree
at the root of the repo)? Also, what's the type of x
in foo_workflow
?big-easter-12386
05/24/2023, 5:54 PMflyte/a/b/workflows.py
@workflow
def repro_issue_workflow() -> List[int]:
foo = foo_task()
bar = map_task(bar_task, concurrency=3)(number=foo)
return bar
flyte/a/b/tasks.py
@task
def foo_task() -> List[int]:
return [1, 2, 3]
@task
def bar_task(number: int) -> int:
return number + 1
In this example, the type of data in the map task is List[int]
. I've confirmed that this fails with both regular registration and fast registration. This also seems to fail when both the tasks and workflows are in the same file 🤔
In the screenshot (included) you can also see that the map task has a different naming convention than I would have expected from past flytekit versions as well, although that might be a red herring.
Happy to open an issue or file a bug report if that would be helpful 🙏