https://prefect.io logo
Title
b

Braun Reyes

04/13/2023, 8:39 PM
Hey everyone! Prefect Cloud Customer getting the following error when trying to execute a flow on AWS ECS Fargate
Downloading flow code from storage at 'orchestration/main-orchestration-flow'
03:31:38 PM
prefect.flow_runs

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/main_orchestration_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 276, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/deployments.py", line 217, 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 91, 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 31, 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 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 809, 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 'main_orchestration_flow.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
I saw that a bug was fixed in 2.10.3, but this flow is running on that version. The files are in the remote storage.
👀 1
b

Bianca Hoch

04/13/2023, 9:18 PM
Hey Braun, thanks for raising this. I found the <FileNotFoundError:%20[Errno%202]%20No%20such%20file%20or%20directory:%20'/opt/prefect/main_orchestration_flow.py'|closed issue> you mentioned. Could you create a new issue, or leave a comment on this issue with the stack trace you shared here?
:thank-you: 1
b

Braun Reyes

04/13/2023, 9:18 PM
yes I can do that
:gratitude-thank-you: 2
looks like this was an issue on my end solved it by making sure the github relative path matches the entrypoint path.
prefect deployment build -a data-products/src/orchestration/main_orchestration_flow.py:main_orchestration_flow -sb github/data-flows-dev/data-products/src/orchestration --name base
1
1
b

Bianca Hoch

04/21/2023, 8:50 PM
Glad you found the problem, thank you for sharing, Braun!!