summaryrefslogtreecommitdiff
path: root/aergia
diff options
context:
space:
mode:
Diffstat (limited to 'aergia')
-rwxr-xr-xaergia/aergia.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/aergia/aergia.py b/aergia/aergia.py
index 6f43f2e..28e8d7a 100755
--- a/aergia/aergia.py
+++ b/aergia/aergia.py
@@ -53,7 +53,6 @@ import sys
import threading
import time
import traceback
-import inspect
orig_thread_join = threading.Thread.join
@@ -110,7 +109,6 @@ class Aergia(object):
in `Aergia._get_idle_task_frames'. The TimerHandler object otherwise
does not keep track of a _source_traceback.
'''
- os.environ["PYTHONASYNCIODEBUG"] = "1"
signal.signal(signal.SIGALRM,
Aergia._idle_signal_handler)
signal.setitimer(signal.ITIMER_REAL,
@@ -239,10 +237,7 @@ class Aergia(object):
'''Given an asyncio event loop, returns the list of idle task frames.
A task is considered 'idle' if it is not currently executing.'''
idle = []
- current = asyncio.current_task(loop)
for task in asyncio.all_tasks(loop):
- if task == current:
- continue
coro = task.get_coro()
if coro:
f = Aergia._get_deepest_traceable_frame(coro)
@@ -316,12 +311,19 @@ if __name__ == "__main__":
metavar='',
type=float,
default=0.01)
+ parser.add_argument('-d', '--debug',
+ help='Turn on debug information for the event loop.',
+ metavar='',
+ type=bool,
+ default=False)
parser.add_argument('script', help='A python script to run.')
parser.add_argument('s_args', nargs=argparse.REMAINDER,
help='python script args')
args = parser.parse_args()
sys.argv = [args.script] + args.s_args
+ if args.debug:
+ os.environ["PYTHONASYNCIODEBUG"] = "1"
try:
with open(args.script, 'r', encoding='utf-8') as fp:
code = compile(fp.read(), args.script, "exec")