Like :meth:`call_async`, but do not wait for a return value, and inform
        the target context no reply is expected. If the call fails and
        pipelining is disabled, the exception will be logged to the target
        context's logging framework.
977711
def call_no_reply(self, fn, *args, **kwargs):
        
        LOG.debug('%r.call_no_reply(): %r', self, CallSpec(fn, args, kwargs))
        self.context.send(self.make_msg(fn, *args, **kwargs))
462187
def _handle_request(self, msg_id, method, params):
        """"""
        try:
            handler = self._dispatcher[method]
        except KeyError:
            raise JsonRpcMethodNotFound.of(method)

        handler_result = handler(params)

        if callable(handler_result):
            log.debug("Executing async request handler %s", handler_result)
            request_future = self._executor_service.submit(handler_result)
            self._client_request_futures[msg_id] = request_future
            request_future.add_done_callback(self._request_callback(msg_id))
        else:
            log.debug("Got result from synchronous request handler: %s", handler_result)
            self._consumer({
                'jsonrpc': JSONRPC_VERSION,
                'id': msg_id,
                'result': handler_result
            })
866849
def enable_thread_logging(exception_callback=None):
    
    global logged_thread_enabled, Thread
    LoggedThread.exception_callback = exception_callback
    Thread = threading.Thread = LoggedThread
    logged_thread_enabled = True
483973
def do_execute(self):
        
        result = None

        data = self.input.payload
        if isinstance(self._input.payload, Instance):
            inst = self.input.payload
            data = inst.dataset
        elif isinstance(self.input.payload, Instances):
            data = self.input.payload
            inst = None

        append = True
        if self._header is None or (self._header.equal_headers(data) is not None):
            self._header = Instances.template_instances(data, 0)
            outstr = str(data)
            append = False
        elif inst is not None:
            outstr = str(inst)
        else:
            outstr = str(data)

        f = None
        try:
            if append:
                f = open(str(self.resolve_option("output")), "a")
            else:
                f = open(str(self.resolve_option("output")), "w")
            f.write(outstr)
            f.write("\n")
        except Exception as e:
            result = self.full_name + "\n" + traceback.format_exc()
        finally:
            if f is not None:
                f.close()
        return result
1259416
public ChannelFuture respond() throws Exception {
        // For chunked response, this method is only called to respond the 1st chunk,
        // next chunks are responded directly by respondXXX

        if (nonChunkedResponseOrFirstChunkSent) throwDoubleResponseError();

        // Run after filter
        if (server.after() != null) {
            server.after().run(request, this);
        }

        ChannelFuture future = channel.writeAndFlush(response);

        // Do not handle keep alive:
        // * If XSendFile or XSendResource is used, because they will handle keep alive in their own way
        // * If the response is chunked, because respondLastChunk will be handle keep alive
        if (//!XSendFile.isHeaderSet(response) &&
            //!XSendResource.isHeaderSet(response) &&
                !HttpUtil.isTransferEncodingChunked(response)) {
            NoRealPipelining.if_keepAliveRequest_then_resumeReading_else_closeOnComplete(request, channel, future);
        }

        nonChunkedResponseOrFirstChunkSent = true;
        if (!HttpUtil.isTransferEncodingChunked(response)) {
            doneResponding = true;
        }

        return future;
    }
905175
def wrap_apply_async(apply_async_func):
    """"""

    def call(self, func, args=(), kwds={}, **kwargs):
        wrapped_func = wrap_task_func(func)
        _tracer = execution_context.get_opencensus_tracer()
        propagator = binary_format.BinaryFormatPropagator()

        wrapped_kwargs = {}
        wrapped_kwargs["span_context_binary"] = propagator.to_header(
            _tracer.span_context
        )
        wrapped_kwargs["kwds"] = kwds
        wrapped_kwargs["sampler"] = _tracer.sampler
        wrapped_kwargs["exporter"] = _tracer.exporter
        wrapped_kwargs["propagator"] = _tracer.propagator

        return apply_async_func(
            self, wrapped_func, args=args, kwds=wrapped_kwargs, **kwargs
        )

    return call
1027299
def do_callback(self, pkt):
        
        callback, parser = self.get_callback_parser(pkt)

        if asyncio.iscoroutinefunction(callback):
            self.loop.call_soon_threadsafe(self._do_async_callback,
                                           callback, parser)
        else:
            self.loop.call_soon(callback, parser)
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
1184864
def try_call(self, client_data=None, api_data=None, aux_data=None, *args, **kwargs):
        
        try:
            return self.call(client_data, api_data, aux_data, *args, **kwargs)
        except Exception as e:
            self.last_exception = RequestFailed(cause=e)
        return None
889328
def set_exception(self, exc_class, exc_info, exc_stack):
        

        if self.is_finished():
            raise InternalError("set_exception called on finished AsynchronousResponse",
                                result=self._result, exception=self._exception)

        self._exception = (exc_class, exc_info, exc_stack)
        self.finish()
1126132
def call(self, input_data=None, *args, **kwargs):
        
        self.build_request(input_data)
        self.caller = RequestCall(self.request)
        self.exception = None

        try:
            self.caller.call()
            self.response = self.caller.response
            self.decrypt_result()
            return self.decrypted

        except Exception as e:
            self.exception = e
            logger.info("Exception throw %s", e)
        pass
586909
async def retry_async(self, func, partition_id, retry_message,
                          final_failure_message, max_retries, host_id):
        
        created_okay = False
        retry_count = 0
        while not created_okay and retry_count <= max_retries:
            try:
                await func(partition_id)
                created_okay = True
            except Exception as err:  # pylint: disable=broad-except
                _logger.error("%r %r %r %r", retry_message, host_id, partition_id, err)
                retry_count += 1
        if not created_okay:
            raise Exception(host_id, final_failure_message)
434909
def _run_callback(
        self, callback: Callable, *args: Any, **kwargs: Any
    ) -> "Optional[Future[Any]]":
        
        try:
            result = callback(*args, **kwargs)
        except Exception:
            self.handler.log_exception(*sys.exc_info())
            self._abort()
            return None
        else:
            if result is not None:
                result = gen.convert_yielded(result)
                assert self.stream is not None
                self.stream.io_loop.add_future(result, lambda f: f.result())
            return result
649689
def exception(self, timeout=None):
        
        if not self._done.wait(timeout):
            raise Timeout('timeout waiting for future')
        if self._state == self.S_EXCEPTION:
            return self._result
768099
def _start_callbacks(self, result, exception):
        
        if self._cancelled:
            raise CancelledError()
        if self.called:
            raise AlreadyCalledError()

        self._result = result
        self._exception = exception
        if self._exception:
            self._tb_info = ''.join(traceback.format_tb(sys.exc_info()[2])) 
        self.called = True
        self._do_callbacks()
471892
def solveAsync(self, callback):
        
        def async_call():
            self._lock.acquire()
            try:
                self._impl.solve()
            except Exception:
                self._lock.release()
                raise
            else:
                self._lock.release()
                callback.run()
        Thread(target=async_call).start()
1043236
def waitResult(self):
    
    self.thread.execute_queue.join()
    try:
      e = self.thread.exception_queue[threading.get_ident()].get_nowait()
    except queue.Empty:
      return self.thread.result_queue[threading.get_ident()].get_nowait()
    else:
      raise e