コード例 #1
0
def _start(msg, parent_pid, is_analysis=''):
    _send('start', '%d\0%s\0%s\0%f' % (
        parent_pid,
        is_analysis,
        msg,
        time(),
    ))
コード例 #2
0
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)
コード例 #3
0
ファイル: status.py プロジェクト: gridl/accelerator
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)
コード例 #4
0
 def update(msg):
     assert msg and isinstance(msg, str_types) and '\0' not in msg
     _send(typ, '\0'.join((msg, t, cookie)))
コード例 #5
0
def _end():
    _send('end', '')