I am using prefect 2.6.6 local server:I am using r...
# prefect-community
I am using prefect 2.6.6 local server:I am using run_deployment() to trigger flow_run from deployment A and B. Second flow should start once the first is finished. whenever I trigger the flow its failing with below error. Can someone please help me with this.Thanks. Encountered exception during execution: Traceback (most recent call last): File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/client/orion.py", line 1351, in read_deployment_by_name response = await self._client.get(f"/deployments/name/{name}") File "/home/x/anaconda3/lib/python3.9/site-packages/httpx/_client.py", line 1751, in get return await self.request( File "/home/x/anaconda3/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/client/base.py", line 182, in send response.raise_for_status() File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/client/base.py", line 125, in raise_for_status raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.cause prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url 'https://api.prefect.cloud/api/accounts/e25149ff-b6ff-4b7b-8d35-15fedaa1a20b/workspaces/fb6e8c45-2229-4aaf-8c98-9c03a6f2ae86/deployments/name/db2_replace' Response: {'detail': 'Not Found'} For more information check: https://httpstatuses.com/404 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/engine.py", line 610, in orchestrate_flow_run result = await run_sync(flow_call) File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 68, in run_sync_in_worker_thread return await anyio.to_thread.run_sync(call, cancellable=True) File "/home/x/anaconda3/lib/python3.9/site-packages/anyio/to_thread.py", line 28, in run_sync return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable, File "/home/x/anaconda3/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread return await future File "/home/x/anaconda3/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 754, in run result = context.run(func, *args) File "/home/x/Desktop/mlp-prefect/mlp_prefect/flows/standard/pipeline/mainflow_db2_etl.py", line 13, in mainflow db2_load_flow_run = run_deployment(name="db2_replace") File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 197, in coroutine_wrapper return run_async_from_worker_thread(async_fn, *args, **kwargs) File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 148, in run_async_from_worker_thread return anyio.from_thread.run(call) File "/home/x/anaconda3/lib/python3.9/site-packages/anyio/from_thread.py", line 35, in run return asynclib.run_async_from_thread(func, *args) File "/home/x/anaconda3/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 847, in run_async_from_thread return f.result() File "/home/x/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 446, in result return self.__get_result() File "/home/x/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result raise self._exception File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/client/utilities.py", line 47, in with_injected_client return await fn(*args, **kwargs) File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/deployments.py", line 78, in run_deployment deployment = await client.read_deployment_by_name(name) File "/home/x/anaconda3/lib/python3.9/site-packages/prefect/client/orion.py", line 1354, in read_deployment_by_name raise prefect.exceptions.ObjectNotFound(http_exc=e) from e prefect.exceptions.ObjectNotFound
Hi @Sowmiya Anand 👋 It looks like the client can't find the deployment you're trying to kick off how are you calling
? and are you passing a
It's also worth pointing out that the URL in the error message is pointing to Cloud so if you're using a local Orion instance and you're deployment exists there it won't be able to find it.
upvote 1
yes my deployment is in cloud and I am trying to trigger it from local @Mason Menges
this is my test code
import prefect from prefect import flow from prefect.deployments import run_deployment #from prefect.client.utilities import run_deployment @flow def mainflow(loglevel: str = "INFO"): #triggering 1st deployment [db2 run] run_name = "Mainflow run" #using run_deployment() from prefect new release 2.5 trigger a flow run for db2 using deployment=db2_replace db2_load_flow_run = run_deployment(name="db2_replace")
Brilliant 😄 it looks like you're just passing the deployment name into the run deployment command, the name argument actually requires both the flow name and deployment name
name: The deployment name in the form: '<flow-name>/<deployment-name>'
thanks, let me try it.
@Sowmiya Anand Replying here to your dm, how are you setting the prefect API URL, are you using prefect cloud login or setting it explicitly with
prefect config set PREFECT_API_URL
? the error in this case is pretty descriptive in terms of not being found it's hard to say for sure but my guess is there might be something misconfigured with the URL, how does your deployment name display in the UI from prefect cloud?