I'm trying to use
ImageSpec
with
@task(container_image=...)
Here's my code:
from flytekit import task, ImageSpec
my_task_image = ImageSpec(packages=["torch"],)
@task(
container_image=my_task_image
)
def hello(name: str) -> str:
try:
import torch
except ImportError:
print("no torch")
msg = f"Hello {name}"
return msg
@workflow
def hello_world_workflow(
input_name: str = "World",
) -> str:
hello_greeting: str = hello(name=input_name)
return hello_greeting
I'm using
flytekit==1.9.1
and
flytekitplugins-envd==1.9.1
.
When I execute my workflow, I get the following error:
Failed with Unknown Exception <class 'Exception'> Reason: failed to run command envd build --path /tmp/flyte-m0o9qb2q/sandbox/local_flytekit/0f01355716b8894a0f943a8fc1db30fe --platform linux/amd64 with error b'time="2023-08-30T20:02:29Z" level=fatal msg="failed to interpret: failed to exec starlark file /tmp/flyte-m0o9qb2q/sandbox/local_flytekit/0f01355716b8894a0f943a8fc1db30fe/build.envd: Exception when exec build func: io.copy: unexpected keyword argument \\"host_path\\""\n'
Inspecting the
build.envd
file that Flyte creates, this is what I see:
# syntax=v1
def build():
base(image="<http://cr.flyte.org/flyteorg/flytekit:py3.8-1.9.1|cr.flyte.org/flyteorg/flytekit:py3.8-1.9.1>", dev=False)
install.python_packages(name=["torch"])
install.apt_packages(name=[])
runtime.environ(env={'PYTHONPATH': '/root', '_F_IMG_ID': 'flytekit:P1CReKTnTRkuvn7554aqfA..'})
config.pip_index(url="<https://pypi.org/simple>")
io.copy(host_path="./", envd_path="/root")
and the error seems to be at the last line
io.copy(host_path=...)
. Any leads?