I am getting this error while executing a flow via...
# prefect-community
x
I am getting this error while executing a flow via Cloud Prefect 2.0 "RuntimeError: This portal is not running". Any clue what is going wrong. The same flow was working fine before I use Cloud Prefect 2.0. Actually it finishes all my flows and tasks successfully and at the end it crashes and it happens to all my existing flows. line 1512, in propose_state raise prefect.exceptions.Abort(response.details.reason) prefect.exceptions.Abort: This run has already terminated.
z
Can you share the full traceback and a small example flow that this occurs for? The output of
prefect version
would be useful as well.
x
prefect orion 2.03b
202531.787 | INFO | prefect.engine - Created flow run 'wealthy-poodle' for flow 'Parent Flow1' 202531.787 | INFO | Flow run 'wealthy-poodle' - Using task runner 'ConcurrentTaskRunner' I'm the parent flow 202532.167 | INFO | Flow run 'wealthy-poodle' - Created subflow run 'lavender-peacock' for flow 'Sub Flow3' I'm the subflow 202532.455 | INFO | Flow run 'lavender-peacock' - Finished in state Completed(None) 202532.741 | ERROR | Flow run 'wealthy-poodle' - Crash detected! Execution was interrupted by an unexpected exception. Traceback (most recent call last): File "/localpart0/aop-shared/WAVES/workflows/flow1.py", line 27, in <module> parent_flow1() File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/flows.py", line 314, in call return enter_flow_run_engine_from_flow_call(self, parameters) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/engine.py", line 110, in enter_flow_run_engine_from_flow_call return anyio.run(begin_run) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 56, in run return asynclib.run(func, *args, **backend_options) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 233, in run return native_run(wrapper(), debug=debug) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete return future.result() File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 228, in wrapper return await func(*args) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/client.py", line 82, in with_injected_client return await fn(*args, **kwargs) File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/engine.py", line 175, in create_then_begin_flow_run return await begin_flow_run( File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/engine.py", line 283, in begin_flow_run await client.propose_state( File "/localpart0/aop-shared/WAVES/prefect2/lib/python3.10/site-packages/prefect/client.py", line 1512, in propose_state raise prefect.exceptions.Abort(response.details.reason) prefect.exceptions.Abort: This run has already terminated.
Code is from prefect import flow from prefect import task, flow from prefect.task_runners import DaskTaskRunner from prefect.deployments import DeploymentSpec from prefect.flow_runners import SubprocessFlowRunner from prefect.tasks import task_input_hash from datetime import timedelta from prefect import get_run_logger from prefect.orion.schemas.schedules import RRuleSchedule from dateutil.rrule import rrule, MINUTELY, DAILY, MO, TU, WE, TH, FR import pendulum from prefect.orion.schemas.schedules import IntervalSchedule from datetime import timedelta @flow(name="Parent Flow1") def parent_flow1(): print("I'm the parent flow") sub_flow() @flow(name="Sub Flow3") def sub_flow(): print("I'm the subflow") if name == "__main__": parent_flow1()
It is a very simple code
The main error at the end of executing the flow completely is "Crash detected! Execution was interrupted by an unexpected exception."
upgraded to 2.0b3 and it solved the problem.
z
This seems like an error that would be raise don 2.0b2
Yeah we were setting the final flow run state twice in 2.0b2 which shouldn’t be allowed but a separate bug allowed it to happen. We patched the server to ban the behavior, which means 2.0b2 and older are not supported with Cloud anymore.
x
Thanks, Michael
z
@Zach Angell perhaps once we have a better API version mismatch error, bumping the version in a case like this would be the best outcome so the error tells them to upgrade 🙂
đź‘Ť 1
Glad it’s worked out for you 🙂
x
How to cleanup existing flows and tasks in Cloud 2.0?
There is no reset DB option
z
You’d probably need to delete and recreate your workspace
x
oh man! ok
Any doc or guidance or tutorial to make a REST API call to Cloud Prefect 2.0 please?
z
With the Python client Prefect provides or with another tool?
x
We have a Web UI which calls Prefect REST APIs to create a flow or schedule it.
We use Create Flow, Run Deploy APIs
z
I see, so if you run
prefect config view
you should see the API url you need to hit as a well as your current API key
x
So far we used with the prefect deployed locally in our server. Since today I configured with Cloud 2.0, I would like to know how to call it
z
You need to provide the API key in a header e.g.
httpx_settings["headers"].setdefault("Authorization", f"Bearer {api_key}")
x
I don't need to create bearer token before call the API via that URL?
z
You need the token, presumably you have one locally that you can use
You could create a separate one too
x
Example would help. Thanks, Michael
z
We don’t have any examples published yet.
You can see the REST documentation at https://orion-docs.prefect.io/api-ref/rest-api/
These include examples for each endpoint, you’ll just need to hit the API url that includes you account/workspace handle and set the key in the header.
x
it worked. Thanks.
265 Views