I'm interacting with the Prefect 2 API (from Prefe...
# ask-community
c
I'm interacting with the Prefect 2 API (from Prefect 1) and I'm getting
Copy code
Traceback (most recent call last):
  File "/databricks/python3/lib/python3.9/site-packages/prefect/engine/task_runner.py", line 880, in get_task_run_state
    value = prefect.utilities.executors.run_task_with_timeout(
  File "/databricks/python3/lib/python3.9/site-packages/prefect/utilities/executors.py", line 493, in run_task_with_timeout
    return run_with_multiprocess_timeout(
  File "/databricks/python3/lib/python3.9/site-packages/prefect/utilities/executors.py", line 417, in run_with_multiprocess_timeout
    raise result
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
From what I understand, it's the Prefect 2 API server that's aborting the connection; under what circumstances does it do that?
I should note that what I'm doing is triggering a Prefect 2 deployment, waiting 5 minutes, and then, using the same session that created the flow run, checking the state of that flow-run. The error above is happening on that second check; I'm wondering if it's the fact that I'm sleeping for 5 minutes that's causing the server to kill the connection?
b
Hi Constantino! You won't be able to use Prefect 1 with Prefect 2. They use different APIs (REST for 2, GraphQL for 1) and have pretty significant differences under the hood
c
I don't mean to suggest i'm using one directly in/with the other, I have two separate instances/deployment of prefect; prefect 1 is executing code to submit an HTTP request to the prefect 2 server.
note that I"m not using the prefect 2 client to make these requests, these are vanilla
requests
POST & GET calls
b
Ahhh gotcha, thank you for the clarification. Have you already tested the theory of shortening the sleep after the initial check?
c
I end up catching the ConnectionError and recreating a client (which resolves the issue), but I'd like to better understand the root cause instead of just guessing