Hey team, I've been trying to get the experimental...
# ask-community
r
Hey team, I've been trying to get the experimental workers running in prefect using the example provided in the 2.14.17 release notes. I'm using conda to create a prefect environment and spawn my flows from there. Once the initial set up is done, the
submit_to_runner
call fails with a 404 error while trying to communicate with the worker process. I tried hitting the
/health
endpoint of the worker and receive a 200 status, so all should be fine. I'm also able to run a curl request with the same payload from my bash and get it to trigger the child subflow. Any idea where I've been going wrong? Thanks!
Stacktrace:
Copy code
15:11:05.770 | INFO    | Flow run 'determined-seriema' - Downloading flow code from storage at '.'
15:11:05.953 | ERROR   | Flow run 'determined-seriema' - Encountered exception during execution:
Traceback (most recent call last):
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/engine.py", line 863, in orchestrate_flow_run
    result = await flow_call.aresult()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 326, in aresult
    return await asyncio.wrap_future(self.future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 351, in _run_sync
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/apps/northmoorefs1/rajat/prefect_test.py", line 16, in my_flow
    submit_to_runner(collection_of_tasks, [{"x": i} for i in range(10)])
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 259, in coroutine_wrapper
    return call()
           ^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 431, in __call__
    return self.result()
           ^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 317, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 178, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 388, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/runner/submit.py", line 172, in submit_to_runner
    raise exc
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/runner/submit.py", line 155, in submit_to_runner
    flow_run = await _submit_flow_to_runner(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/runner/submit.py", line 79, in _submit_flow_to_runner
    response = await <http://client._client.post|client._client.post>(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/httpx/_client.py", line 1892, in post
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/httpx/_client.py", line 1574, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/client/base.py", line 312, in send
    response.raise_for_status()
  File "/spare/local/rajat/.conda/envs/prefect_test/lib/python3.12/site-packages/prefect/client/base.py", line 164, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<http://localhost:8080/flow/run>'
Response: {'detail': 'Not Found'}
I have managed to fix this by changing the POST request in
_submit_flow_to_runner
to use the requests module instead of httpx. The client returned by
get_client
in the function is returning a client that probably sends the request elsewhere. Should I create an issue on prefect Github to get a fix merged?
The 404 error is because the request never goes to the network.