MCPcopy Create free account
hub / github.com/apache/arrow / SlowFlightServer

Class SlowFlightServer

python/pyarrow/tests/test_flight.py:387–405  ·  view source on GitHub ↗

A Flight server that delays its responses to test timeouts.

Source from the content-addressed store, hash-verified

385
386
387class SlowFlightServer(FlightServerBase):
388 """A Flight server that delays its responses to test timeouts."""
389
390 def do_get(self, context, ticket):
391 return flight.GeneratorStream(pa.schema([('a', pa.int32())]),
392 self.slow_stream())
393
394 def do_action(self, context, action):
395 time.sleep(0.5)
396 return []
397
398 @staticmethod
399 def slow_stream():
400 data1 = [pa.array([-10, -5, 0, 5, 10], type=pa.int32())]
401 yield pa.Table.from_arrays(data1, names=['a'])
402 # The second message should never get sent; the client should
403 # cancel before we send this
404 time.sleep(10)
405 yield pa.Table.from_arrays(data1, names=['a'])
406
407
408class ErrorFlightServer(FlightServerBase):

Callers 2

test_timeout_firesFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_timeout_firesFunction · 0.68