brainy-carpenter-31280
03/21/2025, 6:46 PMfreezing-airport-6809
brainy-carpenter-31280
03/22/2025, 10:33 AM.
├── dist
├── main.py
├── projects
│ ├── flyte-examples
│ │ ├── README.md
│ │ ├── pyproject.toml
│ │ └── src
│ │ └── flyte_examples
│ │ ├── __init__.py
│ │ ├── workflows
│ │ │ └──hellow_world
│ │ └── py.typed
│ ├── flyte-helper
│ │ ├── README.md
│ │ ├── pyproject.toml
│ │ └── src
│ │ └── flyte_helper
│ │ ├── __init__.py
│ │ ├── utils.py
│ │ └── py.typed
...
├── pyproject.toml
├── .venv
└── uv.lock
with the hello_world.py
from typing import Tuple
from flytekit import task, workflow
from flyte_helper.utils import f
@task
def say_hello() -> str:
return "Hello, World!"
@workflow
def hello_world_wf() -> Tuple[str, int]:
res = say_hello()
res2 = f(1)
return res, res2
if __name__ == "__main__":
print(f"Running hello_world_wf() {hello_world_wf()}")
and flyte_helper/utils.py
import random
def f(_: int) -> int:
x = random.random() * 2 - 1
y = random.random() * 2 - 1
return 1 if x**2 + y**2 <= 1 else 0
running this with
pyflyte run --remote src/flyte_example/examle_workflows/hello_world.py hello_world_wf
will result in
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flytekit/bin/entrypoint.py", line 163, in _dispatch_execute
task_def = load_task()
File "/usr/local/lib/python3.10/site-packages/flytekit/bin/entrypoint.py", line 578, in load_task
return resolver_obj.load_task(loader_args=resolver_args)
File "/usr/local/lib/python3.10/site-packages/flytekit/core/utils.py", line 312, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flytekit/core/python_auto_container.py", line 273, in load_task
task_module = importlib.import_module(name=task_module) # type: ignore
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/root/flyte_example/examle_workflows/hello_world.py", line 5, in <module>
from flyte_helper.utils import f
ModuleNotFoundError: No module named 'flyte_helper'
Message:
ModuleNotFoundError: No module named 'flyte_helper'
Locally it works fine
python src/flyte_example/examle_workflows/hello_world.py
Running hello_world_wf() DefaultNamedTupleOutput(o0='Hello, World!', o1=1)
pyflyte run src/flyte_example/examle_workflows/hello_world.py hello_world_wf
Running Execution on local.
DefaultNamedTupleOutput(o0='Hello, World!', o1=1)
as f is not a workflow or task I think references wont help here or am I missing something?
Thanks for the help!brainy-carpenter-31280
03/22/2025, 1:51 PMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
python
packages to load the task definitions at runtimebrainy-carpenter-31280
03/26/2025, 10:17 AM