flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] Empty module name

Open Nan2018 opened this issue 2 years ago • 4 comments

Describe the bug

When registering flyte entities using the remote API in the same python module, the module path is missing from the generated command args (see below line 21). And executing the entity leads to ValueError: Empty module name

args:[24 items
0:"pyflyte-fast-execute"
1:"--additional-distribution"
2:"s3://...."
3:"--dest-dir"
4:"{{ .dest_dir }}"
5:"--"
6:"pyflyte-execute"
7:"--inputs"
8:"{{.input}}"
9:"--output-prefix"
10:"{{.outputPrefix}}"
11:"--raw-output-data-prefix"
12:"{{.rawOutputDataPrefix}}"
13:"--checkpoint-path"
14:"{{.checkpointOutputPrefix}}"
15:"--prev-checkpoint"
16:"{{.prevCheckpointPrefix}}"
17:"--resolver"
18:"flytekit.core.python_auto_container.default_task_resolver"
19:"--"
20:"task-module"
21:""
22:"task-name"
23:"my_task"
]

Expected behavior

The module path is detected and included in the generated command args.

Additional context to reproduce

To reproduce, run the following python script

import flytekit
import flytekit.remote
import flytekit.configuration as flyte_config
from flytekit.tools import repo
import uuid

@flytekit.task
def my_task():
    print('my task')


def main(remote_endpoint='dns:///localhost:8089'):
    remote = flytekit.remote.FlyteRemote(
        config=flyte_config.Config.for_endpoint(endpoint=remote_endpoint, insecure=True),
        default_project="flytesnacks",
        default_domain="development",
    )
    detected_root = repo.find_common_root(["."])
    print(f"detected root: {detected_root}")
    _, native_url = remote.fast_package(detected_root)
    fast_serialization_settings = flyte_config.FastSerializationSettings(
        enabled=True,
        destination_dir=".",
        distribution_location=native_url,
    )
    task = remote.register_task(
        my_task,
        version=str(uuid.uuid4()).lower().replace("-", ""),
        serialization_settings=flyte_config.SerializationSettings(
            image_config=flyte_config.ImageConfig.auto_default_image(),
            fast_serialization_settings=fast_serialization_settings,
        ),
    )
    print(task)


if __name__ == "__main__":
    main()

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • [X] Yes

Have you read the Code of Conduct?

  • [X] Yes

Nan2018 avatar Apr 14 '23 16:04 Nan2018

Thank you for opening your first issue here! 🛠

welcome[bot] avatar Apr 14 '23 16:04 welcome[bot]

@Nan2018 Have you found any solution/workaround for this issue? I'm facing something similar.

erikdao avatar May 29 '23 08:05 erikdao

the workaround for me is to put the flyte entities in a different python module

Nan2018 avatar May 30 '23 21:05 Nan2018

Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable. Thank you for your contribution and understanding! 🙏

github-actions[bot] avatar Feb 25 '24 00:02 github-actions[bot]

"Hello 👋, this issue has been inactive for over 90 days. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏"

github-actions[bot] avatar Aug 15 '25 00:08 github-actions[bot]

Hello 👋, this issue has been inactive for over 90 days and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏

github-actions[bot] avatar Aug 23 '25 00:08 github-actions[bot]