From 10dac6741c3aa216e3114b0fc3abd1e6e57426c2 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Fri, 6 Dec 2019 00:22:30 -0800 Subject: [PATCH] move plasma subprocesses to top level functions --- python/pyarrow/tests/test_plasma.py | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/python/pyarrow/tests/test_plasma.py b/python/pyarrow/tests/test_plasma.py index f41adbd37d8ec..658d0439b7b22 100644 --- a/python/pyarrow/tests/test_plasma.py +++ b/python/pyarrow/tests/test_plasma.py @@ -860,18 +860,18 @@ def test_use_full_memory(self): self.plasma_client2.create( object_id, DEFAULT_PLASMA_STORE_MEMORY + SMALL_OBJECT_SIZE) - def test_client_death_during_get(self): + @staticmethod + def _client_blocked_in_get(plasma_store_name, object_id): import pyarrow.plasma as plasma + client = plasma.connect(plasma_store_name) + # Try to get an object ID that doesn't exist. This should block. + client.get([object_id]) + def test_client_death_during_get(self): object_id = random_object_id() - def client_blocked_in_get(plasma_store_name): - client = plasma.connect(self.plasma_store_name) - # Try to get an object ID that doesn't exist. This should block. - client.get([object_id]) - - p = multiprocessing.Process(target=client_blocked_in_get, - args=(self.plasma_store_name, )) + p = multiprocessing.Process(target=self._client_blocked_in_get, + args=(self.plasma_store_name, object_id)) p.start() # Make sure the process is running. time.sleep(0.2) @@ -889,18 +889,18 @@ def client_blocked_in_get(plasma_store_name): # the store is dead. self.plasma_client.contains(random_object_id()) - def test_client_getting_multiple_objects(self): + @staticmethod + def _client_get_multiple(plasma_store_name, object_ids): import pyarrow.plasma as plasma + client = plasma.connect(plasma_store_name) + # Try to get an object ID that doesn't exist. This should block. + client.get(object_ids) + def test_client_getting_multiple_objects(self): object_ids = [random_object_id() for _ in range(10)] - def client_get_multiple(plasma_store_name): - client = plasma.connect(self.plasma_store_name) - # Try to get an object ID that doesn't exist. This should block. - client.get(object_ids) - - p = multiprocessing.Process(target=client_get_multiple, - args=(self.plasma_store_name, )) + p = multiprocessing.Process(target=self._client_get_multiple, + args=(self.plasma_store_name, object_ids)) p.start() # Make sure the process is running. time.sleep(0.2)