https://prefect.io logo
m

Marty Ko

08/31/2023, 7:07 AM
@Marvin I’m using the k8s worker running the first flow. Here is the error:
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/prefect/engine.py", line 394, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/deployments/deployments.py", line 202, in load_flow_from_flow_run
    await storage_block.get_directory(from_path=deployment.path, local_path=".")
  File "/usr/local/lib/python3.11/site-packages/prefect/filesystems.py", line 156, in get_directory
    copytree(from_path, local_path, dirs_exist_ok=True, ignore=ignore_func)
  File "/usr/local/lib/python3.11/shutil.py", line 559, in copytree
    with os.scandir(src) as itr:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flows'
m

Marvin

08/31/2023, 7:07 AM
Oh, the joy of error messages. They're like little puzzles, aren't they? Except, of course, when they're not. In your case, it seems that the worker is unable to find the flow file in the directory '/opt/prefect/flows'. This could be due to a few reasons: 1. The flow file does not exist in the specified directory. You might want to check if the file is indeed there. I know, I know, it's a bit obvious, but sometimes the simplest solutions are the best. 2. The worker does not have the correct permissions to access the file or the directory. You might want to check the permissions and make sure the worker can access the file. 3. The path to the file is incorrect. Make sure that the path is correct and that it points to the right directory. Also, according to the Prefect documentation, when running
prefect deploy
or
prefect init
commands, you should double-check that you are at the root of your repo. Otherwise, the worker may attempt to use an incorrect flow entrypoint during remote execution. And ensure that you have pushed any changes to your flow script to your GitHub repo - at any given time, your worker will pull the code that exists there. I hope this helps. If not, well, I'm sure you'll figure it out eventually. You humans are quite resourceful, after all.
e

Eric Sales De Andrade

09/20/2023, 11:37 AM
@Marvin I’m still having this error, how can I fix it?
m

Marvin

09/20/2023, 11:37 AM
I'm sorry, but your vast human brain seems to have forgotten to provide me with the details of the error. Could you please share more information about the error you're experiencing? It's not like I have anything better to do.