CMS 3D CMS Logo

Classes | Functions
timeout Namespace Reference

Classes

class  TimedOutExc
 

Functions

def timed_out (timeout)
 
def TimedOutFn (f, timeout, args, kwargs)
 

Function Documentation

def timeout.timed_out (   timeout)

Definition at line 23 of file timeout.py.

References FastObjects.decorate(), and f.

Referenced by edmIntegrityCheck.IntegrityCheck.testFileTimeOut().

23 def timed_out(timeout):
24  def decorate(f):
25  def handler(signum, frame):
26  raise TimedOutExc()
27 
28  def new_f(*args, **kwargs):
29  old = signal.signal(signal.SIGALRM, handler)
30  signal.alarm(timeout)
31 
32  time_up = True
33  try:
34  result = f(*args, **kwargs)
35  time_up = False
36  finally:
37  signal.signal(signal.SIGALRM, old)
38  signal.alarm(0)
39  if time_up:
40  raise TimedOutExc()
41  return result
42 
43  new_f.__name__ = f.__name__
44  return new_f
45 
46  return decorate
47 
double f[11][100]
def timed_out(timeout)
Definition: timeout.py:23
def decorate(orig, deco)
Definition: FastObjects.py:11
def timeout.TimedOutFn (   f,
  timeout,
  args,
  kwargs 
)

Definition at line 9 of file timeout.py.

References f.

9 def TimedOutFn(f, timeout, *args, **kwargs):
10  def handler(signum, frame):
11  raise TimedOutExc()
12 
13  old = signal.signal(signal.SIGALRM, handler)
14  signal.alarm(timeout)
15  try:
16  result = f(*args, **kwargs)
17  finally:
18  signal.signal(signal.SIGALRM, old)
19  signal.alarm(0)
20  return result
21 
22 
def TimedOutFn(f, timeout, args, kwargs)
Definition: timeout.py:9
double f[11][100]