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

Class EchoFlightServer

python/pyarrow/tests/test_flight.py:215–233  ·  view source on GitHub ↗

A Flight server that returns the last data uploaded.

Source from the content-addressed store, hash-verified

213
214
215class EchoFlightServer(FlightServerBase):
216 """A Flight server that returns the last data uploaded."""
217
218 def __init__(self, location=None, expected_schema=None, **kwargs):
219 super().__init__(location, **kwargs)
220 self.last_message = None
221 self.expected_schema = expected_schema
222
223 def do_get(self, context, ticket):
224 return flight.RecordBatchStream(self.last_message)
225
226 def do_put(self, context, descriptor, reader, writer):
227 if self.expected_schema:
228 assert self.expected_schema == reader.schema
229 self.last_message = reader.read_all()
230
231 def do_exchange(self, context, descriptor, reader, writer):
232 for chunk in reader:
233 pass
234
235
236class EchoStreamFlightServer(EchoFlightServer):

Callers 3

test_flight_do_put_limitFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_flight_do_put_limitFunction · 0.68