Bryce Derriso
04/02/2024, 4:40 PMFileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flows'
I'm running my own docker build, but managing the deploy through `prefect.yaml`:
name: orchestration
prefect-version: 2.16.6
pull:
- prefect.deployments.steps.set_working_directory:
directory: /opt/prefect/flows
deployments:
- name: "test deployment"
tags: []
schedule: null
entrypoint: 'flows/control_flows.py:test_flow'
parameters: {}
work_pool:
name: 'kubernetes-work-pool'
work_queue_name: 'default'
job_variables:
image: '<my_ecr_repo>:my_build_tag'
Docker build steps:
docker build --platform=linux/arm64 --no-cache -f ./Dockerfile ..
tag:
docker tag <hash_from_build_above> <my_ecr_repo>:my_build_tag
And, Dockerfile:
FROM prefecthq/prefect:2-python3.9
# Create the user
COPY kubernetes/requirements.txt /requirements.txt
# use absolute path when installing requirements
RUN pip3 install -r /requirements.txt --trusted-host <http://pypi.python.org|pypi.python.org> --no-cache-dir
COPY orchestration/flows /opt/prefect/flows
My flow code lives at orchestration/flows/control_flows.py
and is:
from prefect import flow
@flow(name="test_flow", log_prints=True)
def test_flow():
print("test_flow")
Nate
04/02/2024, 4:49 PMdocker run -it
Nate
04/02/2024, 4:49 PMBryce Derriso
04/02/2024, 5:49 PMroot@d8458ee4800f:/opt/prefect/flows# pwd
/opt/prefect/flows
root@d8458ee4800f:/opt/prefect/flows# ls
__pycache__ control_flows.py
root@d8458ee4800f:/opt/prefect/flows# cat control_flows.py
from prefect import flow
@flow(name="test_flow", log_prints=True)
def test_flow():
print("test_flow")
Bryce Derriso
04/03/2024, 3:55 PMFileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flows'
When trying to run a Flow in a custom docker container from a Kubernetes worker.
Does anyone have any ideas for fixing this?Lennert Van de Velde
04/04/2024, 2:13 PMLennert Van de Velde
04/04/2024, 2:18 PMNate
04/04/2024, 2:20 PMNate
04/04/2024, 2:21 PMprefect.deployments.steps.run_shell_script
step after your set working directory step with an ls -a
or something?Bryce Derriso
04/05/2024, 4:45 PMprefect.deployments.steps.*
available, and what they do?
I can guess what run_shell_script
does, but haven't seen what all my options are here.Nate
04/05/2024, 4:46 PMNate
04/05/2024, 4:47 PMprefect.deployment.steps.*
are all just fully qualified names of functions in our repoBryce Derriso
04/05/2024, 4:53 PMbut in case its helpful prefect.deployment.steps.* are all just fully qualified names of functions in our repoAh! That's very helpful, got it!