def _start(msg, parent_pid, is_analysis=''): _send('start', '%d\0%s\0%s\0%f' % ( parent_pid, is_analysis, msg, time(), ))
def status(msg): if g.running == 'daemon': yield lambda _: None return global _cookie _cookie += 1 cookie = str(_cookie) t = str(time()) typ = 'push' def update(msg): assert msg and isinstance(msg, str_types) and '\0' not in msg _send(typ, '\0'.join((msg, t, cookie))) update(msg) typ = 'update' try: yield update finally: _send('pop', cookie)
def status(msg): if g.running == 'daemon': yield lambda _: None return global _cookie _cookie += 1 cookie = str(_cookie) t = str(time()) typ = 'push' # capture the PID here, because update might be called in a different process pid = os.getpid() def update(msg): assert msg and isinstance(msg, str_types) and '\0' not in msg _send(typ, '\0'.join((msg, t, cookie)), pid=pid) update(msg) typ = 'update' try: yield update finally: _send('pop', cookie)
def update(msg): assert msg and isinstance(msg, str_types) and '\0' not in msg _send(typ, '\0'.join((msg, t, cookie)))
def _end(): _send('end', '')