Coverage for ion/util/timeout : 80.00%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python @file ion/util/timeout.py @author David Stuebe @brief A timeout decorator method """
"""Raised when time expires in timeout decorator"""
""" Decorator to add timeout to Deferred calls https://gist.github.com/735556 Credit to theduderog """ def _timeout(*args, **kwargs):
s_args = pu.pprint_to_string(args) s_kwargs = pu.pprint_to_string(kwargs) log.debug('Setting Timeout for function "%s" to %f seconds: \nArgs: \n%s\nKWArgs: \n%s' % (func.__name__, secs, s_args, s_kwargs ))
defer.returnValue(rawD)
#Only rawD should raise an exception else: #Timeout
s_args = pu.pprint_to_string(args) s_kwargs = pu.pprint_to_string(kwargs) sep = '*//////////////////////////*\n' log.error('Timeout error in function "%s"\n%sFunction Args: \n%s\nFunction KWArgs: \n%s %s' % (func.__name__, sep, s_args, s_kwargs, sep ))
#No timeout
|