Rasmus Lindqvist
07/11/2023, 7:44 AMprefect.exceptions.ScriptError: Script at 'src/flows/flow.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
We are using a monorepo where the prefect code sits in a subdirectory called “pipeline”. For deployment I am using the python SDK as such:
deployment = Deployment.build_from_flow(
flow=flow,
name=target_env,
version=3,
path="pipeline",
work_queue_name=target_env,
tags=[target_env],
infrastructure=infrastructure_block,
storage=storage_block,
)
As mentioned it was working in my other environment when I did not use a subdirectory and did not provide a path. I have searched thoroughly in discourse, Slack, documentation and in the source code it self, but am running out of options.
Does anyone see an error with the deployment or have suggestions on resources I can follow to get it working?Christopher Boyd
07/11/2023, 1:37 PMpath="pipeline"
here ?
Path should be a qualified path to the entrypoint, but I believe if you are using a storage block shouldn’t be necessary - just the entrypoint itselfpath
if I’m using docker / kubernetes and the code is embedded in the image, not cloned inRasmus Lindqvist
07/11/2023, 3:33 PMstorage
, however then I get this error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/backend/backend/pipeline'
Is there some cache or something in play that I need to reset ? I have checked the Cloud Run image that I am using and the code is there
Thanks for the help 🙂 !Christopher Boyd
07/11/2023, 6:04 PM/opt/prefect
. If I do something like this for the docker image:
COPY flow.py /opt/prefect/flows/
Then my deployment is like:
deployment = Deployment.build_from_flow(
flow=flow,
name="Test HealthCheck Deployment",
version=1,
flow_name="healthcheck",
work_queue_name="kubernetes",
infrastructure=k8s_job,
#Add Docker path to flow
path="/opt/prefect/flows",
#Add Docker entrypoint relative to path
entrypoint="healthcheck.py:healthcheck"
)
Rasmus Lindqvist
07/12/2023, 6:28 AM'home/runner/work'
path comes from as well ? And are there any resources where I can read about caching? Because I got it working when I upgraded the name of the deployment. Again - thanks a lot!!