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

Class SlowFlightServer

python/pyarrow/tests/test_flight.py:389–407  ·  view source on GitHub ↗

A Flight server that delays its responses to test timeouts.

Source from the content-addressed store, hash-verified

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

Callers 2

test_timeout_firesFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_timeout_firesFunction · 0.68