From a93c6b7596678b2ae5eccc8a10679b9b6cfa0454 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Tue, 22 Nov 2016 13:31:22 -0800 Subject: [PATCH] Quick workaround for ray.wait bug. (#42) --- lib/python/ray/worker.py | 2 +- src/plasma/lib/python/plasma.py | 2 +- src/plasma/plasma_extension.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/python/ray/worker.py b/lib/python/ray/worker.py index 160fd18ca..3fbb5f1f3 100644 --- a/lib/python/ray/worker.py +++ b/lib/python/ray/worker.py @@ -1005,7 +1005,7 @@ def wait(object_ids, num_returns=1, timeout=None, worker=global_worker): """ check_connected(worker) object_id_strs = [object_id.id() for object_id in object_ids] - timeout = timeout if timeout is not None else 2 ** 36 + timeout = timeout if timeout is not None else 2 ** 30 ready_ids, remaining_ids = worker.plasma_client.wait(object_id_strs, timeout, num_returns) ready_ids = [photon.ObjectID(object_id) for object_id in ready_ids] remaining_ids = [photon.ObjectID(object_id) for object_id in remaining_ids] diff --git a/src/plasma/lib/python/plasma.py b/src/plasma/lib/python/plasma.py index e35225e8f..7ff8c4200 100644 --- a/src/plasma/lib/python/plasma.py +++ b/src/plasma/lib/python/plasma.py @@ -6,7 +6,7 @@ import time import libplasma PLASMA_ID_SIZE = 20 -PLASMA_WAIT_TIMEOUT = 2 ** 36 +PLASMA_WAIT_TIMEOUT = 2 ** 30 class PlasmaBuffer(object): """This is the type of objects returned by calls to get with a PlasmaClient. diff --git a/src/plasma/plasma_extension.c b/src/plasma/plasma_extension.c index 8bc9b527c..aa6152c0b 100644 --- a/src/plasma/plasma_extension.c +++ b/src/plasma/plasma_extension.c @@ -189,6 +189,12 @@ PyObject *PyPlasma_wait(PyObject *self, PyObject *args) { "The argument num_returns cannot be greater than len(object_ids)"); return NULL; } + int64_t threshold = 1 << 30; + if (timeout > threshold) { + PyErr_SetString(PyExc_RuntimeError, + "The argument timeout cannot be greater than 2 ** 30."); + return NULL; + } object_id *object_ids = malloc(sizeof(object_id) * n); for (int i = 0; i < n; ++i) {