Xun Wang
08/09/2024, 9:14 PMAn error occurred while monitoring flow run 'f63aabc6-12b3-4b62-9b57-3d6e067452da'. The flow run will not be marked as failed, but an issue may have occurred.
+ Exception Group Traceback (most recent call last):
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/workers/base.py", line 908, in _submit_run_and_capture_errors
| result = await self.run(
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/workers/process.py", line 166, in run
| process = await run_process(
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 273, in run_process
| await consume_process_output(
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 287, in consume_process_output
| async with anyio.create_task_group() as tg:
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__
| raise BaseExceptionGroup(
| exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 314, in stream_text
| await sink.write(item)
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/anyio/_core/_fileio.py", line 109, in write
| return await to_thread.run_sync(self._fp.write, b)
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
| return await get_async_backend().run_sync_in_worker_thread(
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
| return await future
| File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
| result = context.run(func, *args)
| OSError: [Errno 5] Input/output error
+------------------------------------
This error will not show up if I run the flow as python function from the command line. But it is always there if I run using prefect deployment run. For example: prefect deployment run 'hello-sync/hello_sync-test-deployment'
A process work pool is used for the flow deployment.
Here is the test code:
import sys
from prefect import task, flow
@task(log_prints=True)
def say_hello_sync():
print('Hello!')
@flow(log_prints=True)
def hello_sync():
say_hello_sync()
def main():
if len(sys.argv) > 1 and sys.argv[1] == 'run':
hello_sync()
else:
print('Unsupported operation: ', sys.argv)
print('completed: ', sys.argv)
if __name__ == "__main__":
main()
Here is the prefect.yaml file content:
name: prefect2
prefect-version: 2.20.0
build: null
push: null
pull:
- prefect.deployments.steps.set_working_directory:
directory: /home/pentaho/prefect2
deployments:
- name: hello_sync-test-deployment
version:
tags: []
entrypoint: playground/test_sync.py:hello_sync
parameters: {}
work_pool:
name: id90-process-pool
work_queue_name:
job_variables: {}
schedules: []
description: 'a test'
How do I find out the root cause of it? Please let me know more details are needed.Marvin
08/09/2024, 9:14 PMI am getting this error for most of my flows but all the flow runs marked as successfully completed.```An error occurred while monitoring flow run 'f63aabc6-12b3-4b62-9b57-3d6e067452da'. The flow run will not be marked as failed, but an issue may have occurred. + Exception Group Traceback (most recent call last): | File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/workers/base.py", line 908, in _submit_run_and_capture_errors | result = await self.run( | File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/workers/process.py", line 166, in run | process = await run_process( | File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 273, in run_process | await consume_process_output( | File "/home/pentaho/anaconda3/envs/py310/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 287, in consume_process_output | async with anyio.create_task_group() as tg: | File "/home
Xun Wang
08/09/2024, 9:23 PMMarvin
08/09/2024, 9:23 PMHere is the shortened error:An error occurred while monitoring flow run 'f63aabc6-12b3-4b62-9b57-3d6e067452da'. The flow run will not be marked as failed, but an issue may have occurred. + Exception Group Traceback (most recent call last): prefect/workers/base.py", line 908, in _submit_run_and_capture_errors result = await self.run( /prefect/workers/process.py", line 166, in run process = await run_process( /prefect/utilities/processutils.py", line 273, in run_process await consume_process_output( /prefect/utilities/processutils.py", line 287, in consume_process_output async with anyio.create_task_group() as tg: /anyio/_backends/_asyncio.py", line 680, in aexit raise BaseExceptionGroup( exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) Traceback (most recent call last): /prefect/utilities/processutils.py", line 314, in stream_text await sink.write(item) /anyio/_core/_fileio.py", line 109, in write return await to_thread.run_sync(self._fp.write, b) /anyio/to_thread.py", line 56, in run_sync
Xun Wang
08/09/2024, 9:24 PMMarvin
08/09/2024, 9:24 PMHere is the shortened error:An error occurred while monitoring flow run 'f63aabc6-12b3-4b62-9b57-3d6e067452da'. The flow run will not be marked as failed, but an issue may have occurred. + Exception Group Traceback (most recent call last): ... async with anyio.create_task_group() as tg: /anyio/_backends/_asyncio.py", line 680, in aexit raise BaseExceptionGroup( exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) Traceback (most recent call last): /prefect/utilities/processutils.py", line 314, in stream_text await sink.write(item) /anyio/_core/_fileio.py", line 109, in write return await to_thread.run_sync(self._fp.write, b) /anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( /anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread return await future /anyio/_backends/_asyncio.py", line 859, in run result = context.run(func, *args) OSError: [Errno 5] Input/output error which only happens to prefect deployment
Xun Wang
08/09/2024, 9:29 PMMarvin
08/09/2024, 9:29 PMPytestUnraisableExceptionWarning: Exception ignored in: <ssl.SSLSocket fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
This error suggests an unclosed resource, like a network socket, often seen when running tests or managing connections incorrectly. You might be encountering something similar if an underlying resource or connection is not being managed correctly in your deployment.
Link: https://docs.prefect.io/latest/guides/troubleshooting/
2. Unhandled Errors in a Task Group:
Your error indicates a failure within an anyio
task group, typically related to async task execution. Specifically, the OSError: [Errno 5] Input/output error
might be signaling a deeper issue with resource access or network connectivity.
If your deployment runs into IO issues while direct execution does not, it might indicate environment-specific problems such as:
- File access permissions
- Network issues
- Resource limits differing between development and deployment environments
Next Steps:
- Review your deployment environment's access to required resources.
- Ensure any network connections, files, or other IO operations have appropriate permissions and are correctly handled.
- Look into async task management in your deployment script. There might be resources not being properly awaited or closed.
If issues persist, more specific details about your deployment configuration and environment setup might be needed to diagnose further.
If you need further guidance, let me know!