Ejemplo n.º 1
0
	def start(self):
		"""
		Creates and starts the logging process
		"""
		log_listener = LogQueueListener(_format=LogRuntime.FORMAT, _level=self.level)
		ctx = ProcessContext(log_queue=self.log_queue, stop_event=None)
		# Process
		self.process = ProcessContext.create_process(target=log_listener.run, name='LogListener', args=(ctx,))
		self.process.start()
Ejemplo n.º 2
0
    def create_producer_process(self, context: ProcessContext,
                                producer: Producer):
        """
		Creates a new process for the Producer instance.
		:param context: holds the necessary objects for creating a new process
		:param producer: Producer instance
		:return: newly created process object
		"""
        proc_context = ProcessContext(
            stop_event=context.stop_event,
            log_queue=context.logging_queue,
            shared_data_proxy=self.prod_to_proxy[producer])
        return ProcessContext.create_process(target=producer.start,
                                             name=producer.get_name(),
                                             args=(proc_context, ))
Ejemplo n.º 3
0
    def start_stream_controller_process(self, context: ProcessContext):
        """
		Creates and fires up the stream controller process
		:param context: holds the 'stop event' and the logging queue
		"""
        sc_context = ProcessContext(log_queue=context.logging_queue,
                                    stop_event=context.stop_event,
                                    message_queue=self.sc_queue)
        self.sc_process = ProcessContext.create_process(
            target=self.stream_controller.start,
            name='SC process',
            args=(sc_context, ))

        PCASystem.LOGGER.info('Starting stream-controller')
        self.sc_process.start()
Ejemplo n.º 4
0
    def start_stream_processes(self, context: ProcessContext):
        """
		Creates the stream processes and fires them up.
		:param context: holds the 'stop event' and the loggign queue as well
		"""
        for stream in self.streams:
            s_context = ProcessContext(
                stop_event=context.stop_event,
                log_queue=context.logging_queue,
                shared_data_proxy=self.prod_to_proxy[stream.producer],
                sc_queue=self.sc_queue)
            proc = ProcessContext.create_process(target=stream.start,
                                                 name=stream.get_name(),
                                                 args=(s_context, ))
            self.stream_processes.append(proc)

            PCASystem.LOGGER.info('Starting stream: ' + stream.name)
            proc.start()