Skip to content

Commit

Permalink
move plasma subprocesses to top level functions
Browse files Browse the repository at this point in the history
  • Loading branch information
terencehonles authored and kou committed Dec 6, 2019
1 parent da300ac commit 10dac67
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions python/pyarrow/tests/test_plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 10dac67

Please sign in to comment.