Skip to content

Commit c044954

Browse files
committed
add documentation
1 parent eb9694a commit c044954

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

python/pyarrow/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@
9292
from pyarrow.lib import (deserialize_from, deserialize,
9393
serialize, serialize_to, read_serialized,
9494
SerializedPyObject,
95-
SerializationException, DeserializationException,
96-
# This is temporary
97-
register_type, type_to_type_id, whitelisted_types,
98-
types_to_pickle, custom_serializers, custom_deserializers)
95+
SerializationException, DeserializationException)
9996

10097
from pyarrow.filesystem import FileSystem, LocalFileSystem
10198

python/pyarrow/plasma.pyx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def connect(store_socket_name, manager_socket_name, int release_delay,
585585
The maximum number of objects that the client will keep and
586586
delay releasing (for caching reasons).
587587
num_retries : int, default -1
588-
Number of times tor ty to connect to plasma store. Default value of -1
588+
Number of times to try to connect to plasma store. Default value of -1
589589
uses the default (50)
590590
"""
591591
cdef PlasmaClient result = PlasmaClient()
@@ -599,6 +599,23 @@ def connect(store_socket_name, manager_socket_name, int release_delay,
599599
return result
600600

601601
def put(PlasmaClient client, value, object_id=None):
602+
"""
603+
Store a Python value into the object store.
604+
605+
Parameters
606+
----------
607+
client : PlasmaClient
608+
The client connected to the object store we put the value in.
609+
value : object
610+
A Python object to store.
611+
object_id : ObjectID, default None
612+
If this is provided, the specified object ID will be used to refer
613+
to the object.
614+
615+
Returns
616+
-------
617+
The object ID associated to the Python object.
618+
"""
602619
cdef ObjectID id = object_id if object_id else ObjectID.from_random()
603620
cdef SerializedPyObject serialized = pyarrow.serialize(value)
604621
buffer = client.create(id, serialized.total_bytes)
@@ -609,6 +626,26 @@ def put(PlasmaClient client, value, object_id=None):
609626
return id
610627

611628
def get(PlasmaClient client, object_ids, timeout_ms=-1):
629+
"""
630+
Get one or more Python values from the object store.
631+
632+
Parameters
633+
----------
634+
client : PlasmaClient
635+
The client connected to the object store we get objects from.
636+
object_ids : list
637+
The list of object IDs associated to the values we get from the store.
638+
timeout_ms : int, default -1
639+
The number of milliseconds that the get call should block before
640+
timing out and returning. Pass -1 if the call should block and 0
641+
if the call should return immediately.
642+
643+
Returns
644+
-------
645+
list
646+
List of Python values for the data associated with the object_ids
647+
and ObjectNotAvailable if the object was not available.
648+
"""
612649
results = []
613650
buffers = client.get(object_ids, timeout_ms)
614651
for i in range(len(object_ids)):

python/pyarrow/tests/test_plasma.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ def test_put_and_get(self):
279279
[result] = pa.plasma.get(self.plasma_client, [object_id])
280280
assert result == value
281281

282+
object_id = pa.plasma.ObjectID(np.bytes.random(20))
283+
[result] = pa.plasma.get(self.plasma_client, [object_id], timeout_ms=0)
284+
assert result == pa.plasma.ObjectNotAvailable
285+
282286
def test_store_arrow_objects(self):
283287
data = np.random.randn(10, 4)
284288
# Write an arrow object.

0 commit comments

Comments
 (0)