def _server_ready(self, server):
        """
        Responds to asynchronous callbacks during :meth:`execute` to run cases
        retrieved from `self._iter`.  Results are processed by `recorder`.
        Returns True if this server is still in use.
        """
        state = server.state
        self._logger.debug('server %r state %s', server.name, state)
        in_use = True

        if state == _LOADING:
            if server.exception is None:
                in_use = self._start_next_case(server)
            else:
                typ, exc, tback = server.exception
                self._logger.debug('    exception while loading: %r', exc)
                if self.error_policy == 'ABORT':
                    if self._abort_exc is None:
                        self._abort_exc = server.exception
                    self._stop = True
                    server.state = _EMPTY
                    in_use = False
                else:
                    server.load_failures += 1
                    if server.load_failures < 3:
                        in_use = self._start_processing(server)
                    else:
                        self._logger.debug('    too many load failures')
                        server.state = _EMPTY
                        in_use = False

        elif state == _EXECUTING:
            case = server.case
            server.case = None
            if server.exception is None:
                # Grab the results from the model and record.
                try:
                    self._record_case(server.top, case)
                except Exception as exc:
                    msg = 'Exception recording case: %s' % exc
                    self._logger.debug('    %s', msg)
                    self._logger.debug('%s', case)
                    case.msg = '%s: %s' % (self.get_pathname(), msg)
            else:
                self._logger.debug('    exception while executing: %r', server.exception[1])
                case.exc = server.exception

            if case.exc is not None:
                if self.error_policy == 'ABORT':
                    if self._abort_exc is None:
                        self._abort_exc = case.exc
                    self._stop = True
                elif case.retries < self.max_retries:
                    case.exc = None
                    case.retries += 1
                    self._rerun.append(case)
                else:
                    self._logger.error('Too many retries for %s', case)

            # Set up for next case.
            in_use = self._start_processing(server, reload=True)

        elif state == _EMPTY:
            if server.name is None or server.queue is not None:
                if self._more_to_go():
                    if server.queue is not None:
                        self._logger.debug('    load_model')
                        server.load_failures = 0
                        self._load_model(server)
                    server.state = _LOADING
                else:
                    self._logger.debug('    no more cases')
                    in_use = False
            # Difficult to force startup failure.
            else:  # pragma nocover
                in_use = False  # Never started.

        # Just being defensive, should never happen.
        else:  # pragma no cover
            msg = 'unexpected state %r for server %r' % (state, server.name)
            self._logger.error(msg)
            if self.error_policy == 'ABORT':
                if self._abort_exc is None:
                    try:
                        raise RuntimeError(msg)
                    except __HOLE__:
                        self._abort_exc = sys.exc_info()
                self._stop = True
            in_use = False

        return in_use
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/drivers/caseiterdriver.py/CaseIteratorDriver._server_ready