0

My python process listens for files events and trigger an async task.

When a task runs the following output is written to stderr:

Executing <Task pending coro=<process_file() running at /home/adona/SINT/watcher.py:86> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fea5cb0b078>()] created at /usr/lib/python3.6/asyncio/base_events.py:295> created at /home/adona/SINT/watcher.py:67> took 0.350 seconds
Executing <Handle <TaskWakeupMethWrapper object at 0x7fea5e3d7af8>(<Future finis...events.py:295>) created at /home/adona/SINT/penv/lib/python3.6/site-packages/aiohttp/helpers.py:667> took 0.436 seconds
Executing <Handle <TaskWakeupMethWrapper object at 0x7fea5cb0b258>(<Future finis...events.py:295>) created at /home/adona/SINT/penv/lib/python3.6/site-packages/aiohttp/helpers.py:667> took 0.124 seconds

To me it seems a debug o inform message, not a warning or a problem, but please correct me if I'm wrong.

Is there a way to disable python to write on stderr these messages?

The line 86 at watcher.py:

async for df in sint.FEEDER.upload(pname):  # line 86
    if not isinstance(df, pd.DataFrame):
        raise Exception(
            'internal error: file parser does not returns a dataframe')
attdona
  • 14,517
  • 6
  • 41
  • 54
  • 1
    Check this post: https://stackoverflow.com/questions/47476388/what-does-an-executing-handle-taskwakeupmethwrapper-warning-in-python-asy – Mike67 Jul 30 '20 at 14:10
  • The part of execution of a task **between suspends** should never take too long, so the warning might be appropriate. How is this `FEEDER` implemented? – user4815162342 Jul 30 '20 at 19:14

1 Answers1

1

The message is a warning: an async task executed for a long time without yielding control to the event loop.

If this is acceptable and you want avoid this message, set the log level of asyncio package to ERROR:

# disable the asyncio "Executing took ... seconds" warning
logging.getLogger('asyncio').setLevel(logging.ERROR)
attdona
  • 14,517
  • 6
  • 41
  • 54