Joshua Grant
10/19/2023, 8:02 PMTask run 'f5cdb7c3-22e7-4845-b3ea-4233c5e0ac2a' received abort during orchestration: The enclosing flow must be running to begin task execution. Task run is in PENDING state.
Followed by this error message:
Encountered exception during execution:
Traceback (most recent call last):
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/engine.py", line 833, in orchestrate_flow_run
result = await flow_call.aresult()
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 292, in aresult
return await asyncio.wrap_future(self.future)
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 316, in _run_sync
result = self.fn(*self.args, **self.kwargs)
File "flow_v2_file.py", line 98, in preliminary_flow_v2
if is_msg_media_type(submitted_file_media_type, file_group_name):
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/tasks.py", line 533, in __call__
return enter_task_run_engine(
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/engine.py", line 1137, in enter_task_run_engine
return from_sync.wait_for_call_in_loop_thread(begin_run)
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/api.py", line 243, in wait_for_call_in_loop_thread
return call.result()
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
return self.future.result(timeout=timeout)
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
return self.__get_result()
File "/opt/bitnami/python/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
result = await coro
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/engine.py", line 1302, in get_task_call_return_value
return await future._result()
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/futures.py", line 237, in _result
return await final_state.result(raise_on_failure=raise_on_failure, fetch=True)
File "/opt/bitnami/python/lib/python3.9/site-packages/prefect/states.py", line 84, in _get_state_result
raise UnfinishedRun(
prefect.exceptions.UnfinishedRun: Run is in PENDING state, its result is not available.
Marvin
10/19/2023, 8:03 PMTask run 'f5cdb7c3-22e7-4845-b3ea-4233c5e0ac2a' received abort during orchestration: The enclosing flow must be running to begin task execution. Task run is in PENDING state.
suggests that a task run was attempted while the flow it belongs to wasn't running. This is a bit like trying to play a scene from a movie that hasn't started yet.
The subsequent error message indicates that the task run was in a PENDING state when it was queried for its result. This is akin to asking someone what they thought of the end of a movie they're still watching.
This could be due to a few reasons. One possibility is that your worker or agent received a SIGTERM signal and is trying to complete ongoing flow runs before terminating. If the process doesn't have enough time to finish its current tasks, it could lead to such issues.
Another scenario could be related to your infrastructure. If you're using something like Kubernetes, where flow run execution occurs outside the agent or worker, a crash or unresponsiveness could leave the flow in a running state, as the agent or worker is unavailable to detect the failure.
To avoid interrupting scheduled flow runs for existing deployments, you might want to reassign all deployments to a newly created work queue. Alternatively, you could initiate a new agent or worker on the existing work queue and then decommission the old worker.
Remember, debugging is just like life. It's full of unexpected surprises, and most of them are unpleasant. But don't worry, you'll get through it. You always do.Joshua Grant
10/19/2023, 8:06 PMMarvin
10/19/2023, 8:06 PM