Hi! I'm trying to edit a field in the PodTemplate....
# flyte-support
s
Hi! I'm trying to edit a field in the PodTemplate. All I wan't is to use the default values and use the labels argument.
Copy code
pod_template=PodTemplate(labels={"spot": "false"})
That's what i'm trying to do, but I get the error
ModuleNotFoundError: No module named 'kubernetes'
Did anyone try to use just one argument in the PodTemplate?
t
hi! can you add
kubernetes
to your image? it is necessary for the pod template to work.
s
You mean add it in poetry?
t
are you using any image for your flyte task? if not, can you define an imagespec and assign the same to your task?
s
I'm not using a separate image for each task, I only have an image of the workflow
t
sorry, i don't follow. wdym by image of the workflow?
https://docs.flyte.org/en/latest/user_guide/customizing_dependencies/imagespec.html -- this is how you can define an imagespec. you can just specify "kubernetes" in the packages.
s
ok so adding kubernetes fixed it. I don't have a specific image for each task, I use poetry to manage the packages in my repo. I added kubernetes to poetry and that fixed it. All of the tasks in my workflow use the same image I guess if I don't define a specific one, right? In our CI/CD we create a image for each repo, and the workflow is registered using that image. for example, this is how I register a workflow if i'm doing it from my local computer.
Copy code
pyflyte -c ./.config/local-config.yaml register -p dataengineer -d development --image normalized_roles=blah-blah-docker.dev/images/data-wf-normalized-roles:testing-out-spot-instance_50dfab2  flyte/workflows/normalized_roles_enrichment_wf.py
t
All of the tasks in my workflow use the same image I guess if I don't define a specific one, right?
that's right. understood. in that case, you'd have to add the package to your repo-specific image, which you did. 🙂
s
are we using Flyte in the wrong way? haha
t
this should be fine. if you've significantly different package requirements for tasks within a workflow, it might be beneficial to assign separate images to those tasks. also, with imagespec, you needn't worry about writing dockerfiles and such.
it's much easier to maintain.
s
alright, thank you!