示例#1
0
import zmq.utils.monitor
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui


# Set up nice logging for tests:
# remote processes forward logs to this process
logger = logging.getLogger()
#logger.level = logging.DEBUG
start_log_server(logger)
# local log messages are time-sorted and colored
handler = RPCLogHandler()
logger.addHandler(handler)
# messages originating locally can be easily identified
set_process_name('main_process')
set_thread_name('main_thread')


qapp = pg.mkQApp()


def test_rpc():
    previous_level = logger.level
    #logger.level = logging.DEBUG
    
    class TestClass(object):
        count = 0
        def __init__(self, name):
            self.name = name
            TestClass.count += 1
示例#2
0
文件: bootstrap.py 项目: zoeith/pyacq
faulthandler.enable()
logger = logging.getLogger()
logger.level = conf['loglevel']

import pyacq
from pyacq.core.rpc import log

# Start QApplication if requested
if conf['qt']:
    import pyqtgraph as pg
    app = pg.mkQApp()
    app.setQuitOnLastWindowClosed(False)

# Set up log record forwarding
if conf['procname'] is not None:
    log.set_process_name(conf['procname'])
if conf['logaddr'] is not None:
    log.set_logger_address(conf['logaddr'].encode())

# Also send unhandled exceptions to log server
log.log_exceptions()

logger.info(
    "New process {procname} {class_name}({args}) log_addr:{logaddr} log_level:{loglevel}"
    .format(**conf))

# Open a socket to parent process to inform it of the new RPC server address
bootstrap_sock = zmq.Context.instance().socket(zmq.PAIR)
bootstrap_sock.connect(conf['bootstrap_addr'].encode())
bootstrap_sock.linger = 1000
示例#3
0
faulthandler.enable()
logger = logging.getLogger()
logger.level = conf['loglevel']

import pyacq
from pyacq.core.rpc import log

# Start QApplication if requested
if conf['qt']:
    import pyqtgraph as pg
    app = pg.mkQApp()
    app.setQuitOnLastWindowClosed(False)

# Set up log record forwarding
if conf['procname'] is not None:
    log.set_process_name(conf['procname'])
if conf['logaddr'] is not None:
    log.set_logger_address(conf['logaddr'].encode())

# Also send unhandled exceptions to log server
log.log_exceptions()

logger.info("New process {procname} {class_name}({args}) log_addr:{logaddr} log_level:{loglevel}".format(**conf))

# Open a socket to parent process to inform it of the new RPC server address
bootstrap_sock = zmq.Context.instance().socket(zmq.PAIR)
bootstrap_sock.connect(conf['bootstrap_addr'].encode())
bootstrap_sock.linger = 1000

# Create RPC server
try: