pvardanis commented on issue #34607:
URL: https://github.com/apache/arrow/issues/34607#issuecomment-1966898514

   @pitrou still that makes no different, I even tried for 10 requests and 
getting the same with a sequential call. Is there anything else I could do to 
help you both figure out what's the issue?
   
   Here's my `do_exchange()` implementation:
   ```python
   def do_exchange(
           self,
           context: flight.ServerCallContext,
           descriptor: flight.FlightDescriptor,
           reader: flight.FlightStreamReader,
           writer: flight.FlightStreamWriter,
       ) -> None:
           """This method implements the `do_exchange` method of the 
FlightServerBase
           class.
   
           :param context: A ServerCallContext object.
           :param descriptor: A FlightDescriptor object.
           :param reader: A FlightStreamReader object.
           :param writer: A FlightStreamWriter object.
           """
           is_first_batch = True
           while True:
               logger.info("Processing data...")
               (
                   writer,
                   reader,
                   is_first_batch,
               ) = self._foo(writer, reader, is_first_batch)
               logger.info("Output data ready to be consumed.")
   
   def _foo(
           self,
           writer: flight.FlightStreamWriter,
           reader: flight.FlightStreamReader,
           is_first_batch: bool,
       ) -> Tuple[flight.FlightStreamWriter, flight.FlightStreamReader, bool]:
           logger.debug("Starting batch processing...")
           for batch in reader.read_chunk():
               if batch is None:
                   break
               writer, is_first_batch = self._bar(  # type: ignore[no-redef]
                   batch, writer, is_first_batch
               )
           logger.debug("Batch processing finished.")
   
           writer.close()
   
           return (writer, reader, is_first_batch)
   
   def _bar(
           self,
           batch: pa.RecordBatch,
           writer: flight.MetadataRecordBatchWriter,
           is_first_batch: bool,
       ) -> Tuple[flight.FlightStreamWriter, bool]:
           result = self._run_inference_for_batch(batch)
           return self._write_result(writer, result, is_first_batch)  # type: 
ignore
   ```
   
   Can't provide more code unfortunately for confidentiality reasons.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to