You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2022/02/09 16:39:48 UTC
[arrow-cookbook] branch main updated: [Python] Make Flight tests idempotent (#145)
This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-cookbook.git
The following commit(s) were added to refs/heads/main by this push:
new eabb691 [Python] Make Flight tests idempotent (#145)
eabb691 is described below
commit eabb6916328e24e7a3dab9aa6325b86c99e1cb4e
Author: David Li <li...@gmail.com>
AuthorDate: Wed Feb 9 11:39:45 2022 -0500
[Python] Make Flight tests idempotent (#145)
Use a temporary directory instead of the current working directory.
Also, remove calls to FlightServerBase.serve() (they're unnecessary
since the server is active as soon as it's created).
---
python/source/flight.rst | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/python/source/flight.rst b/python/source/flight.rst
index 354ccf5..d865902 100644
--- a/python/source/flight.rst
+++ b/python/source/flight.rst
@@ -119,11 +119,9 @@ Our server can then be started with
# Code block to start for real a server in background
# and wait for it to be available.
# Previous code block is just to show to user how to start it.
- import threading
- server = FlightServer()
- server._repo.mkdir(exist_ok=True)
- t = threading.Thread(target=server.serve)
- t.start()
+ import tempfile
+ repo = tempfile.TemporaryDirectory(prefix="arrow-cookbook-flight")
+ server = FlightServer(repo=pathlib.Path(repo.name))
pa.flight.connect("grpc://0.0.0.0:8815").wait_for_available()
@@ -225,6 +223,7 @@ we might list all parquet files that are currently stored by the server:
# Shutdown the server
server.shutdown()
+ repo.cleanup()
Streaming Parquet Storage Service
=================================
@@ -335,11 +334,9 @@ Let's give the server a spin. As before, we'll start the server:
# Code block to start for real a server in background
# and wait for it to be available.
# Previous code block is just to show to user how to start it.
- import threading
- server = FlightServer()
- server._repo.mkdir(exist_ok=True)
- t = threading.Thread(target=server.serve)
- t.start()
+ import tempfile
+ repo = tempfile.TemporaryDirectory(prefix="arrow-cookbook-flight")
+ server = FlightServer(repo=pathlib.Path(repo.name))
pa.flight.connect("grpc://0.0.0.0:8815").wait_for_available()
@@ -387,3 +384,4 @@ stream as it arrives, instead of reading them all into a table:
# Shutdown the server
server.shutdown()
+ repo.cleanup()