Ejemplo n.º 1
0
 def _do_evaluate(self, wxf, future, result_update_callback):
     start = time.perf_counter()
     self.kernel_socket_out.send(zmq.Frame(wxf))
     if logger.isEnabledFor(logging.DEBUG):
         logger.debug("Expression sent to kernel in %.06fsec", time.perf_counter() - start)
         start = time.perf_counter()
     wxf_eval_data = self.kernel_socket_in.recv_abortable(copy=False)
     if logger.isEnabledFor(logging.DEBUG):
         logger.debug(
             "Expression received from kernel after %.06fsec", time.perf_counter() - start
         )
     self.evaluation_count += 1
     result = WolframKernelEvaluationResult(wxf_eval_data.buffer, consumer=self.consumer)
     if logger.isEnabledFor(logging.WARNING):
         for msg in result.iter_messages():
             logger.warning(msg)
     if result_update_callback:
         result = result_update_callback(result)
     future.set_result(result)
 def write(self, bytes):
     self.socket.send(zmq.Frame(bytes))