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

Class EchoFlightServer

python/pyarrow/tests/test_flight.py:213–231  ·  view source on GitHub ↗

A Flight server that returns the last data uploaded.

Source from the content-addressed store, hash-verified

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