Run a simple echo server.
(self, context, reader, writer)
| 499 | writer.write_metadata(str(num_batches).encode("utf-8")) |
| 500 | |
| 501 | def exchange_echo(self, context, reader, writer): |
| 502 | """Run a simple echo server.""" |
| 503 | assert reader.stats.num_messages == 0 |
| 504 | started = False |
| 505 | for chunk in reader: |
| 506 | if not started and chunk.data: |
| 507 | writer.begin(chunk.data.schema, options=self.options) |
| 508 | started = True |
| 509 | if chunk.app_metadata and chunk.data: |
| 510 | writer.write_with_metadata(chunk.data, chunk.app_metadata) |
| 511 | elif chunk.app_metadata: |
| 512 | writer.write_metadata(chunk.app_metadata) |
| 513 | elif chunk.data: |
| 514 | assert reader.stats.num_messages != 0 |
| 515 | writer.write_batch(chunk.data) |
| 516 | else: |
| 517 | assert False, "Should not happen" |
| 518 | |
| 519 | def exchange_transform(self, context, reader, writer): |
| 520 | """Sum rows in an uploaded table.""" |
no test coverage detected