S15qkd/controller.py
def crash_detection_and_restart(self, process_states):
        '''
        Checks if processes are running and restarts if any abnormalities are detected.
        '''

        if qkd_engine_state in [QKDEngineState.SERVICE_MODE, QKDEngineState.KEY_GENERATION]:
            if process_states['transferd'] is False:
                self._logger.error(f'Transferd crashed. Trying to restart communication and key generation.')
                stop_key_gen()
                transferd.stop_communication()
                start_communication()
                time.sleep(1)
                start_service_mode()
                return
            if transferd.low_count_side is True:
                if False in [process_states['readevents'],
                             process_states['chopper'],
                             process_states['splicer']]:
                    self._logger.error(f'Crash detected. Processes running: Readevents: {process_states["readevents"]} \
                                   Chopper: {process_states["chopper"]} \
                                   Splicer: {process_states["splicer"]}')
                    stop_key_gen()
                    start_service_mode()
            elif transferd.low_count_side is False:
                if False in [process_states['readevents'],
                             process_states['chopper2'],
                             process_states['costream']]:
                    self._logger.error(f"Crash detected. Processes running: readevents: {process_states['readevents']} \
                                   chopper2: {process_states['chopper2']} \
                                   costream: {process_states['costream']}")
                    stop_key_gen()
                    start_service_mode()

        if qkd_engine_state == QKDEngineState.KEY_GENERATION:
            if process_states['error_correction'] is False:
                stop_key_gen()
                start_service_mode()

        Checks if processes are running and restarts if any abnormalities are detected.
        
Checks if processes are running and restarts if any abnormalities are detected.
Checks if processes are running and restarts if any abnormalities are detected .
def crash_detection_and_restart(self, process_states):
        if qkd_engine_state in [QKDEngineState.SERVICE_MODE, QKDEngineState.KEY_GENERATION]:
            if process_states['transferd'] is False:
                self._logger.error(f'Transferd crashed. Trying to restart communication and key generation.')
                stop_key_gen()
                transferd.stop_communication()
                start_communication()
                time.sleep(1)
                start_service_mode()
                return
            if transferd.low_count_side is True:
                if False in [process_states['readevents'],
                             process_states['chopper'],
                             process_states['splicer']]:
                    self._logger.error(f'Crash detected. Processes running: Readevents: {process_states["readevents"]} \
                                   Chopper: {process_states["chopper"]} \
                                   Splicer: {process_states["splicer"]}')
                    stop_key_gen()
                    start_service_mode()
            elif transferd.low_count_side is False:
                if False in [process_states['readevents'],
                             process_states['chopper2'],
                             process_states['costream']]:
                    self._logger.error(f"Crash detected. Processes running: readevents: {process_states['readevents']} \
                                   chopper2: {process_states['chopper2']} \
                                   costream: {process_states['costream']}")
                    stop_key_gen()
                    start_service_mode()
        if qkd_engine_state == QKDEngineState.KEY_GENERATION:
            if process_states['error_correction'] is False:
                stop_key_gen()
                start_service_mode()
def crash_detection_and_restart ( self , process_states ) : if qkd_engine_state in [ QKDEngineState . SERVICE_MODE , QKDEngineState . KEY_GENERATION ] : if process_states [ 'transferd' ] is False : self . _logger . error ( f'Transferd crashed. Trying to restart communication and key generation.' ) stop_key_gen ( ) transferd . stop_communication ( ) start_communication ( ) time . sleep ( 1 ) start_service_mode ( ) return if transferd . low_count_side is True : if False in [ process_states [ 'readevents' ] , process_states [ 'chopper' ] , process_states [ 'splicer' ] ] : self . _logger . error ( f'Crash detected. Processes running: Readevents: {process_states["readevents"]} \
                                   Chopper: {process_states["chopper"]} \
                                   Splicer: {process_states["splicer"]}' ) stop_key_gen ( ) start_service_mode ( ) elif transferd . low_count_side is False : if False in [ process_states [ 'readevents' ] , process_states [ 'chopper2' ] , process_states [ 'costream' ] ] : self . _logger . error ( f"Crash detected. Processes running: readevents: {process_states['readevents']} \
                                   chopper2: {process_states['chopper2']} \
                                   costream: {process_states['costream']}" ) stop_key_gen ( ) start_service_mode ( ) if qkd_engine_state == QKDEngineState . KEY_GENERATION : if process_states [ 'error_correction' ] is False : stop_key_gen ( ) start_service_mode ( )
Checks if processes are running and restarts if any abnormalities are detected.
Checks if processes are running and restarts if any abnormalities are detected .
'''
        Checks if processes are running and restarts if any abnormalities are detected.
        '''
self
process_states