def _respawn_sensor(self, sensor_id, sensor, exit_code):
        """
        Method for respawning a sensor which died with a non-zero exit code.
        """
        extra = {"sensor_id": sensor_id, "sensor": sensor}

        if self._single_sensor_mode:
            # In single sensor mode we want to exit immediately on failure
            LOG.info(
                "Not respawning a sensor since running in single sensor mode",
                extra=extra,
            )

            self._stopped = True
            self._exit_code = exit_code
            return

        if self._stopped:
            LOG.debug("Stopped, not respawning a dead sensor", extra=extra)
            return

        should_respawn = self._should_respawn_sensor(
            sensor_id=sensor_id, sensor=sensor, exit_code=exit_code
        )

        if not should_respawn:
            LOG.debug("Not respawning a dead sensor", extra=extra)
            return

        LOG.debug("Respawning dead sensor", extra=extra)

        self._sensor_respawn_counts[sensor_id] += 1
        sleep_delay = SENSOR_RESPAWN_DELAY * self._sensor_respawn_counts[sensor_id]
        concurrency.sleep(sleep_delay)

        try:
            self._spawn_sensor_process(sensor=sensor)
        except Exception as e:
            LOG.warning(six.text_type(e), exc_info=True)

            # Disable sensor which we are unable to start
            del self._sensors[sensor_id]

        Method for respawning a sensor which died with a non-zero exit code.
        
st2reactor/st2reactor/container/process_container.py