示例#1
0
    def __init__(self, camera_factory=None):
        Service.__init__(self, cfg.CAMERA_NAME)

        self.camera_factory = camera_factory
        self.camera = None

        self.handlers[Message.TYPE_PARAMS] = self.handle_params

        self.client = Client(self, cfg.SERVER_HOST, cfg.SERVER_PORT)
        self.protocol = None

        self.frame_rate = 1.0
        return
示例#2
0
    def __init__(self, controller=None):
        Service.__init__(self, 'dispatcher')

        self.handlers[Message.TYPE_LOGIN] = self.handle_login
        self.handlers[Message.TYPE_IMAGE] = self.handle_image
        self.handlers[Message.TYPE_RESULT] = self.handle_result

        self.server = Server(self, cfg.SERVER_PORT)
        self.protocols = {}

        self.nodes = {}

        if cfg.DASHBOARD:
            self.dashboard = Dashboard()
            self.dashboard.start()

        else:
            self.dashboard = None

        measure_period = float(cfg.CONTROLLER_LOOP_TIME)/cfg.MEASURES_PER_LOOP
        self.monitor = Monitor(self.process_measurements, measure_period)
        self.monitor.register_item(self.ITEM_FPS, Monitor.ITEM_RATE)
        self.monitor.register_item(self.ITEM_MAKESPAN, Monitor.ITEM_AVG)
        self.monitor.register_item(self.ITEM_THROUGHPUT, Monitor.ITEM_RATE)

        self.controller = controller
        self.controller.dashboard = self.dashboard
        self.controller.dispatcher = self

        if self.dashboard:
            self.dashboard.controller = controller

        self.imagebuf = Queue.Queue()   # Buffer of encoded images
                                        # (time stamp, image data)

        # Initialize probe to blank image
        self.probe_image = self.generate_probe_image()

        self.tokens = Queue.Queue()
        self.job_id = 0

        self.job_image_cache = {}

        self.sub_loop = 0
        return
示例#3
0
 def __init__(self, id, name="parser", configfile=None):
     Service.__init__(self, id, name, configfile)
     self.parser_cmdline = CommandLineParser()
     self.parser_jsoncmdline = JSONCommandLineParser()
     self.parser_bql = BQLParser()
示例#4
0
 def __init__(self, id, name="bfs", configfile=None):
     Service.__init__(self, id, name, configfile)
     self.reserved_dbs = self.configreader["services"][self.name]["reserved_dbs"]
     self.collection = self.configreader["services"][self.name]["content_collection"]
     self.counter_collection = self.configreader["services"][self.name]["counter_collection"]
示例#5
0
 def __init__(self, id, name="email", configfile=None):
     Service.__init__(self, id, name, configfile)
     self.pending_emails_key = "pending.mails"
示例#6
0
 def __init__(self, id, name="emailcheck", configfile=None):
     Service.__init__(self, id, name, configfile)