CMS 3D CMS Logo

Classes | Functions
ztee Namespace Reference

Classes

class  GZipLog
 

Functions

def capture (fd, args)
 
def log (s)
 

Function Documentation

def ztee.capture (   fd,
  args 
)

Definition at line 94 of file ztee.py.

Referenced by HadronPhysicsQGSPCMS_FTFP_BERT.ConstructProcess(), and CMSHadronPhysicsFTFP_BERT_ATL.ConstructProcess().

94 def capture(fd, args):
95  log_handler = GZipLog(log_file=args.log)
96 
97  def sigusr1_handle(*kargs, **kwargs):
98  log_handler._sigusr_interrupt = True
99  if log_handler.file:
100  log_handler.flush_block()
101 
102  signal.signal(signal.SIGUSR1, sigusr1_handle)
103 
104  try:
105  while True:
106  try:
107  log_handler._sigusr_interrupt = False
108  rlist, wlist, xlist = select.select([fd], [], [], 5)
109  except select.error as e:
110  if e[0] != errno.EINTR: raise
111  if not log_handler._sigusr_interrupt: raise
112 
113  continue
114 
115  if not rlist:
116  log_handler.handle_timeout()
117  continue
118 
119  bytes = os.read(fd, 4096)
120  if (bytes == ''):
121  break
122 
123  log_handler.write(bytes)
124  if not args.q:
125  sys.stdout.write(bytes)
126  finally:
127  log_handler.finish()
128 
def capture(fd, args)
Definition: ztee.py:94
def ztee.log (   s)

Definition at line 9 of file ztee.py.

9 def log(s):
10  sys.stderr.write("m: " + s + "\n");
11  sys.stderr.flush()
12 
def log(s)
Definition: ztee.py:9