Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Log slow callbacks and slow tasks (exection takes more than 100 ms) #105

@GoogleCodeExporter

Description

@GoogleCodeExporter
Attached patch logs slow handles taking more than 1 second to execute at INFO 
level. It should help to detect tasks blocking the event loop and so having an 
impact on the reactivity/latency.

Use for example test_slow_operations.py to test this feature. Output:

---
slow callback: done
INFO:asyncio:Executing Handle(<function slow_callback at 0x7ff6e52c15f0>, ()) 
took 1.001 seconds
slow coroutine: done
INFO:asyncio:Executing Handle(<bound method Task._step of 
Task(<coro>)<result=None>>, ()) took 1.001 seconds

---

Problem: the log for coroutines should be improved, but the issue is not 
specific to log but to repr(Task) in general. The problem is that 
repr(generator) uses generator.gi_code.co_name which is "coro". The @coroutine 
uses functools.wraps() to change the name of the function, but not the name of 
the code object.

Original issue reported on code.google.com by [email protected] on 17 Jan 2014 at 1:34

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions