brash-autumn-99506
05/28/2024, 3:58 PMImageSpec
in a given task I am getting a ModuleNotFoundError
on the parent directory, even on the hello_world example, whenever I run the workflow --remote
. Does this have to do with how pyflyte packages the workflow? How should I set up the tree?
Example workflow:
from flytekit import task, workflow, ImageSpec
image_spec = ImageSpec(
name="helloworld",
base_image="python:3.11.5-slim-bullseye",
packages=["numpy", "pandas", "scipy", "scikit-learn", "sentence_transformers", "k_means_constrained", "flytekit"],
registry="localhost:30000"
)
@task(container_image=image_spec)
def say_hello() -> str:
return "Hello, World!"
@workflow
def hello_world_wf() -> str:
res = say_hello()
return res
if __name__ == "__main__":
print(f"Running hello_world_wf() {hello_world_wf()}")
Run with pyflyte run --remote parent_directory_workflows/workflows/hello_world.py hello_world_wf
, yields ModuleNotFoundError: No module named 'parent_directory_workflows'
, with tree being:
.
├── README.md
├── parent_directory_workflows
│ ├── __init__.py
│ ├── __pycache__
│ │ └── __init__.cpython-311.pyc
│ └── workflows
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-311.pyc
│ │ └── hello_world.cpython-311.pyc
│ └── hello_world.py
├── poetry.lock
└── pyproject.toml
glamorous-carpet-83516
05/28/2024, 3:59 PMimage_spec = ImageSpec(
name="helloworld",
packages=["numpy", "pandas", "scipy", "scikit-learn", "sentence_transformers", "k_means_constrained", "flytekit"],
registry="localhost:30000"
)
glamorous-carpet-83516
05/28/2024, 4:00 PMbrash-autumn-99506
05/28/2024, 4:11 PMbrash-autumn-99506
05/28/2024, 4:13 PMpyflyte run --remote parent_directory_workflows/workflows/hello_world.py hello_world_wf
it doesn't find the image built a minute ago and supposedly pushed to localhost:30000
, so it builds again... any idea why?glamorous-carpet-83516
05/28/2024, 4:14 PMbrash-autumn-99506
05/28/2024, 4:15 PMglamorous-carpet-83516
05/28/2024, 4:16 PMbrash-autumn-99506
05/28/2024, 4:18 PMglamorous-carpet-83516
05/28/2024, 5:41 PMglamorous-carpet-83516
05/28/2024, 5:43 PMbrash-autumn-99506
05/29/2024, 6:55 AMbrash-autumn-99506
05/29/2024, 8:13 AMimage_spec = ImageSpec(
name="helloworld",
tag_format="devtest",
packages=["numpy", "pandas", "scipy", "scikit-learn", "sentence_transformers", "k_means_constrained", "flytekit"],
registry="localhost:30000"
)
I get an error, so I'm thinking the push is actually not working
Failed with Unknown Exception <class 'Exception'> Reason: failed to run command envd build --path /var/folders/21/2_6x0r111jb306csghn5w4hm0000gp/T/flytev2pnykln/control_plane_metadata/local_flytekit/54adc7d84fb04862e495d40d5b2c8916 --platform linux/amd64 --output type=image,name=localhost:30000/helloworld:devtest,push=true with error b'time="2024-05-29T09:43:17+02:00" level=fatal msg=exit app=envd error="failed to build the image: failed to build: failed to wait error group: failed to solve LLB: failed to solve: failed to push localhost:30000/helloworld:devtest: failed to do request: Head \\"<http://localhost:30000/v2/helloworld/blobs/sha256:72914424168c8ebb0dbb3d0e08eb1d3b5b2a64cc51745bd65caf29c335b31dc7>\\": dial tcp 127.0.0.1:30000: connect: connection refused" version=v0.3.45\n'
glamorous-carpet-83516
05/29/2024, 8:15 AMglamorous-carpet-83516
05/29/2024, 8:16 AMpyflyte run
two times in the terminal?glamorous-carpet-83516
05/29/2024, 8:16 AMbrash-autumn-99506
05/29/2024, 9:07 AMbrash-autumn-99506
05/29/2024, 9:07 AMbrash-autumn-99506
05/29/2024, 9:16 AMRunning Execution on Remote.
Image localhost:30000/helloworld:devtest not found. building...
Run command: envd context use --name flyte-sandbox
Run command: envd build --path /var/folders/21/2_6x0r111jb306csghn5w4hm0000gp/T/flyter9pdheml/control_plane_metadata/local_flytekit/baf0ee0c705c6a72578a743ba28b4ce8 --platform linux/amd64 --output type=image,name=localhost:30000/helloworld:devtest,push=true
#1 <docker-image://cr.flyte.org/flyteorg/flytekit:py3.11-1.12.0>
#1 resolve cr.flyte.org/flyteorg/flytekit:py3.11-1.12.0 0.7s done
#1 DONE 0.7s
#2 [internal] setting pip cache mount permissions
#2 CACHED
#3 [internal] language environment and system packages
#3 CACHED
#4 [internal] setting PyPI index dir /etc
#4 CACHED
#5 [internal] setting PyPI index file /etc/pip.conf
#5 CACHED
#6 [internal] prepare language
#6 CACHED
#7 [internal] create cache dir
#7 CACHED
#8 [internal] pip install flytekit numpy regex
#8 CACHED
#9 bash -c set -euo pipefail
#9 DONE 0.3s
#10 exporting to image
#10 exporting layers 0.0s done
#10 exporting manifest sha256:71aa3fdfdb017c14f2246951c7d695d53a982ddca2ef9451e6ada0bc255bbec3 done
#10 exporting config sha256:7116af0e88a20063cd54be16cb70fde55be65cc49dee2e8c3229a3178ccf8af1 done
#10 pushing layers 0.0s done
#10 pushing manifest for localhost:30000/helloworld:devtest@sha256:71aa3fdfdb017c14f2246951c7d695d53a982ddca2ef9451e6ada0bc255bbec3 done
#10 DONE 0.1s
[✔] Go to <http://localhost:30080/console/projects/flytesnacks/domains/development/executions/f5d6260598b564009b18> to see execution in the console.
and
Running Execution on Remote.
Image localhost:30000/helloworld:devtest not found. building...
Run command: envd context use --name flyte-sandbox
Run command: envd build --path /var/folders/21/2_6x0r111jb306csghn5w4hm0000gp/T/flytejvizudc5/control_plane_metadata/local_flytekit/46898132c51e107232f282bb503689ba --platform linux/amd64 --output type=image,name=localhost:30000/helloworld:devtest,push=true
#1 <docker-image://cr.flyte.org/flyteorg/flytekit:py3.11-1.12.0>
#1 resolve cr.flyte.org/flyteorg/flytekit:py3.11-1.12.0 0.7s done
#1 DONE 0.7s
#2 [internal] setting pip cache mount permissions
#2 CACHED
#3 [internal] setting PyPI index dir /etc
#3 CACHED
#4 [internal] setting PyPI index file /etc/pip.conf
#4 CACHED
#5 [internal] prepare language
#5 CACHED
#6 [internal] language environment and system packages
#6 CACHED
#7 [internal] create cache dir
#7 CACHED
#8 [internal] pip install flytekit numpy regex
#8 CACHED
#9 bash -c set -euo pipefail
#9 DONE 0.2s
#10 exporting to image
#10 exporting layers 0.0s done
#10 exporting manifest sha256:d1b3efbf2a4e09f014b7f2459eb587f354afcc055be9fcdc49d6d2d1e3467f5c done
#10 exporting config sha256:bb4351daa30f2eb2b8279c7119899508480850bdd38316ff30cc873ca2c2ee5f done
#10 pushing layers 0.0s done
#10 pushing manifest for localhost:30000/helloworld:devtest@sha256:d1b3efbf2a4e09f014b7f2459eb587f354afcc055be9fcdc49d6d2d1e3467f5c
#10 pushing manifest for localhost:30000/helloworld:devtest@sha256:d1b3efbf2a4e09f014b7f2459eb587f354afcc055be9fcdc49d6d2d1e3467f5c done
#10 DONE 0.1s
[✔] Go to <http://localhost:30080/console/projects/flytesnacks/domains/development/executions/f15690c2df320419fb65> to see execution in the console.
brash-autumn-99506
05/30/2024, 9:07 AMdocker pull localhost:30000/helloworld:devtest
docker finds and pulls the image, however pyflyte run
doesn't finds it and yields Image localhost:30000/helloworld:devtest not found. building...
- so the issue seems to be finding the image, pushing to localhost from pyflyte is workingbrash-autumn-99506
05/30/2024, 2:50 PM