some-grass-84903
02/21/2023, 3:45 PMpyflyte run --remote
"cannot import tasks and workflows from other files currently" I tried going the way of "use pyflyte register
to handle those". (quotations taking from the --help output of pyflyte run)
With my current setup:
workflow/
|- ClassTest.py
|- example.py
And example.py using ClassTest.py like the following:
from ClassTest import TestClass
from flytekit import task, workflow
@workflow
def wf():
test_class = TestClass()
test_class.do_stuff()
I get ModuleNotFoundError: No module named 'ClassTest'
.
What am I missing?freezing-airport-6809
freezing-airport-6809
some-grass-84903
02/22/2023, 7:57 AMsome-grass-84903
02/22/2023, 3:17 PMpyflyte register workflow
(with the directory only) and not pyflyte register workflows/example.py
pointing directly to the specific workflow file...
Not sure how I should get it working like here in the docs where it only points to the path: https://docs.flyte.org/projects/cookbook/en/latest/getting_started/package_register.html#iterating-on-a-flyte-projectsome-grass-84903
02/22/2023, 3:23 PMsome-grass-84903
02/22/2023, 3:30 PMAttributeError: module 'ClassTest' has no attribute 'do_stuff'
.freezing-airport-6809
some-grass-84903
02/23/2023, 7:49 AM(flytekit) tree
.
├── docker_build.sh
├── Dockerfile
├── LICENSE
├── README.md
├── requirements.txt
└── workflows
├── ClassTest.py
├── example.py
├── __pycache__
│ ├── aws__init__.cpython-310.pyc
│ ├── ClassTest.cpython-310.pyc
│ ├── example.cpython-310.pyc
│ └── __init__.cpython-310.pyc
I can execute it locally:
(flytekit) pyflyte run workflows/example.py wf
stufffff
If I put an init.py file next to ClassTest.py and example.py the local execution gets ModuleNotFoundError: No module named 'ClassTest'
Register works out like this:
(flytekit) pyflyte register workflows/example.py
Running pyflyte register from /home/bp/src/flyte/test-project/packit with images ImageConfig(default_image=Image(name='default', fqn='<http://ghcr.io/flyteorg/flytekit|ghcr.io/flyteorg/flytekit>', tag='py3.10-1.3.1'), images=[Image(name='default', fqn='<http://ghcr.io/flyteorg/flytekit|ghcr.io/flyteorg/flytekit>', tag='py3.10-1.3.1')]) and image destination folder /root on 1 package(s) ('/home/bp/src/flyte/test-project/packit/workflows/example.py',)
Registering against flyte.data-lake.url
Detected Root /home/bp/src/flyte/test-project/packit/workflows, using this to create deployable package...
{"asctime": "2023-02-23 08:40:06,054", "name": "flytekit.cli", "levelname": "WARNING", "message": "Could not determine ignored files due to:\nb'fatal: not a git repository (or any of the parent directories): .git\\n'\nNot applying any filters"}
No output path provided, using a temporary directory at /tmp/tmpvqdhys55 instead
Computed version is gkQhvVfIwtIgYDAdD6lG-A==
Loading packages ['example'] under source root /home/bp/src/flyte/test-project/packit/workflows
Successfully serialized 3 flyte objects
[✔] Registration ClassTest.do_stuff type TASK successful with version gkQhvVfIwtIgYDAdD6lG-A==
[✔] Registration <http://example.wf|example.wf> type WORKFLOW successful with version gkQhvVfIwtIgYDAdD6lG-A==
[✔] Registration <http://example.wf|example.wf> type LAUNCH_PLAN successful with version gkQhvVfIwtIgYDAdD6lG-A==
Successfully registered 3 entities
When I run the registered workflow on my cluster I get: AttributeError: module 'ClassTest' has no attribute 'do_stuff'
some-grass-84903
02/23/2023, 10:02 AM