Rasmus Lindqvist07/11/2023, 7:44 AM
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:
prefect.exceptions.ScriptError: Script at 'src/flows/flow.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
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?
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, )
Christopher Boyd07/11/2023, 1:37 PM
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 itself
if I’m using docker / kubernetes and the code is embedded in the image, not cloned in
Rasmus Lindqvist07/11/2023, 3:33 PM
, however then I get this error:
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 🙂 !
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/backend/backend/pipeline'
Christopher Boyd07/11/2023, 6:04 PM
. If I do something like this for the docker image:
Then my deployment is like:
COPY flow.py /opt/prefect/flows/
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 Lindqvist07/12/2023, 6:28 AM
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!!