I'm using an ECS push pool and using a yaml to dep...
# prefect-cloud
a
I'm using an ECS push pool and using a yaml to deploy my flows. I'm struggling to get prefect to pull the flows from s3 at run time. My yaml looks like:
Copy code
deployments:

- name: 's3_test_sdbx'  
  flow: flows/sleepy_flow.py
  entrypoint: flows/sleepy_flow.py:sleepy_flow
  description: "what is this" 
  work_pool: *sm_work_pool
  pull:
      - prefect_aws.deployments.steps.pull_from_s3:
          requires: prefect-aws>=0.3.0
          bucket: sdbx-prefect-bucket
          folder: flows
          credentials: "{{ prefect.blocks.aws-credentials.my-block }}"
I've confirmed that the flow is present in the bucket. The errors at run time are:
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1016, in get_code
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flows/sleepy_flow.py'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 420, in retrieve_flow_then_begin_flow_run
    else await load_flow_from_flow_run(flow_run, client=client)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 78, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 316, in load_flow_from_flow_run
    flow = await run_sync_in_worker_thread(load_flow_from_entrypoint, str(import_path))
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1667, in load_flow_from_entrypoint
    flow = import_object(entrypoint)
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object
    module = load_script_as_module(script_path)
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
    raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/sleepy_flow.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
I'm guessing that prefect is successfully get the flow but the entrypoint is messed up in the container. Pulling from git does not result in any errors. I'm guessing there's a simple mistake causing the workdir to shift when the prefect engine launches. My docker image is custom but does not establish any workdir, just env variables and installing packages.
Base image
FROM prefecthq/prefect:2-python3.10