def close(self) -> None:
    'Close the Pea\n\n        This method makes sure that the `Process/thread` is properly finished and its resources properly released\n        '
    self.logger.debug('waiting for ready or shutdown signal from runtime')
    if (self.is_ready.is_set() and (not self.is_shutdown.is_set())):
        try:
            self._cancel_runtime()
            if (not self.is_shutdown.wait(timeout=self._timeout_ctrl)):
                self.terminate()
                time.sleep(0.1)
                raise Exception(f'Shutdown signal was not received for {self._timeout_ctrl}')
        except Exception as ex:
            self.logger.error(((f'{ex!r} during {self.close!r}' + f'''
 add "--quiet-error" to suppress the exception details''') if (not self.args.quiet_error) else ''), exc_info=(not self.args.quiet_error))
        if (not self.args.daemon):
            self.join()
    elif self.is_shutdown.is_set():
        pass
    else:
        self.logger.warning('Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start')
        _timeout = self.args.timeout_ready
        if (_timeout <= 0):
            _timeout = None
        else:
            _timeout /= 1000.0
        self.logger.debug('waiting for ready or shutdown signal from runtime')
        if self._wait_for_ready_or_shutdown(_timeout):
            if (not self.is_shutdown.is_set()):
                self._cancel_runtime(skip_deactivate=True)
                if (not self.is_shutdown.wait(timeout=self._timeout_ctrl)):
                    self.terminate()
                    time.sleep(0.1)
                    raise Exception(f'Shutdown signal was not received for {self._timeout_ctrl}')
        else:
            self.logger.warning('Terminating process after waiting for readiness signal for graceful shutdown')
            self.terminate()
            time.sleep(0.1)
    self.logger.debug(__stop_msg__)
    self.logger.close()
Close the Pea

This method makes sure that the `Process/thread` is properly finished and its resources properly released
def close(self) -> None:
    'Close the Pea\n\n        This method makes sure that the `Process/thread` is properly finished and its resources properly released\n        '
    self.logger.debug('waiting for ready or shutdown signal from runtime')
    if (self.is_ready.is_set() and (not self.is_shutdown.is_set())):
        try:
            self._cancel_runtime()
            if (not self.is_shutdown.wait(timeout=self._timeout_ctrl)):
                self.terminate()
                time.sleep(0.1)
                raise Exception(f'Shutdown signal was not received for {self._timeout_ctrl}')
        except Exception as ex:
            self.logger.error(((f'{ex!r} during {self.close!r}' + f'
 add "--quiet-error" to suppress the exception details') if (not self.args.quiet_error) else ), exc_info=(not self.args.quiet_error))
        if (not self.args.daemon):
            self.join()
    elif self.is_shutdown.is_set():
        pass
    else:
        self.logger.warning('Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start')
        _timeout = self.args.timeout_ready
        if (_timeout <= 0):
            _timeout = None
        else:
            _timeout /= 1000.0
        self.logger.debug('waiting for ready or shutdown signal from runtime')
        if self._wait_for_ready_or_shutdown(_timeout):
            if (not self.is_shutdown.is_set()):
                self._cancel_runtime(skip_deactivate=True)
                if (not self.is_shutdown.wait(timeout=self._timeout_ctrl)):
                    self.terminate()
                    time.sleep(0.1)
                    raise Exception(f'Shutdown signal was not received for {self._timeout_ctrl}')
        else:
            self.logger.warning('Terminating process after waiting for readiness signal for graceful shutdown')
            self.terminate()
            time.sleep(0.1)
    self.logger.debug(__stop_msg__)
    self.logger.close()