Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all config constants into single file. #1192

Merged
merged 18 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes
  • Loading branch information
robertnishihara committed Nov 8, 2017
commit f354ed331021b0e43af8e2b5aa814808520e545b
30 changes: 29 additions & 1 deletion src/common/lib/python/config_extension.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <Python.h>
#include "bytesobject.h"

#include "common.h"
#include "state/config.h"
#include "config_extension.h"

PyObject *PyRayConfig_make() {
Expand Down Expand Up @@ -106,6 +106,34 @@ PyObject *PyRayConfig_kL3CacheSizeBytes(PyObject *self) {
return PyLong_FromLongLong(kL3CacheSizeBytes);
}

static PyMethodDef PyRayConfig_methods[] = {
{"kRayProtocolVersion", (PyCFunction) PyRayConfig_kRayProtocolVersion, METH_NOARGS, "Return kRayProtocolVersion"},
{"kHeartbeatTimeoutMilliseconds", (PyCFunction) PyRayConfig_kHeartbeatTimeoutMilliseconds, METH_NOARGS, "Return kHeartbeatTimeoutMilliseconds"},
{"kNumHeartbeatsTimeout", (PyCFunction) PyRayConfig_kNumHeartbeatsTimeout, METH_NOARGS, "Return kNumHeartbeatsTimeout"},
{"kGetTimeoutMilliseconds", (PyCFunction) PyRayConfig_kGetTimeoutMilliseconds, METH_NOARGS, "Return kGetTimeoutMilliseconds"},
{"kNumBindAttempts", (PyCFunction) PyRayConfig_kNumBindAttempts, METH_NOARGS, "Return kNumBindAttempts"},
{"kBindTimeoutMilliseconds", (PyCFunction) PyRayConfig_kBindTimeoutMilliseconds, METH_NOARGS, "Return kBindTimeoutMilliseconds"},
{"kNumConnectAttempts", (PyCFunction) PyRayConfig_kNumConnectAttempts, METH_NOARGS, "Return kNumConnectAttempts"},
{"kConnectTimeoutMilliseconds", (PyCFunction) PyRayConfig_kConnectTimeoutMilliseconds, METH_NOARGS, "Return kConnectTimeoutMilliseconds"},
{"kLocalSchedulerFetchTimeoutMilliseconds", (PyCFunction) PyRayConfig_kLocalSchedulerFetchTimeoutMilliseconds, METH_NOARGS, "Return kLocalSchedulerFetchTimeoutMilliseconds"},
{"kLocalSchedulerReconstructionTimeoutMilliseconds", (PyCFunction) PyRayConfig_kLocalSchedulerReconstructionTimeoutMilliseconds, METH_NOARGS, "Return kLocalSchedulerReconstructionTimeoutMilliseconds"},
{"kKillWorkerTimeoutMilliseconds", (PyCFunction) PyRayConfig_kKillWorkerTimeoutMilliseconds, METH_NOARGS, "Return kKillWorkerTimeoutMilliseconds"},
{"kDefaultNumCPUs", (PyCFunction) PyRayConfig_kDefaultNumCPUs, METH_NOARGS, "Return kDefaultNumCPUs"},
{"kDefaultNumGPUs", (PyCFunction) PyRayConfig_kDefaultNumGPUs, METH_NOARGS, "Return kDefaultNumGPUs"},
{"kDefaultNumCustomResource", (PyCFunction) PyRayConfig_kDefaultNumCustomResource, METH_NOARGS, "Return kDefaultNumCustomResource"},
{"kManagerTimeoutMilliseconds", (PyCFunction) PyRayConfig_kManagerTimeoutMilliseconds, METH_NOARGS, "Return kManagerTimeoutMilliseconds"},
{"kBufSize", (PyCFunction) PyRayConfig_kBufSize, METH_NOARGS, "Return kBufSize"},
{"kMaxTimeForHandlerMilliseconds", (PyCFunction) PyRayConfig_kMaxTimeForHandlerMilliseconds, METH_NOARGS, "Return kMaxTimeForHandlerMilliseconds"},
{"kSizeLimit", (PyCFunction) PyRayConfig_kSizeLimit, METH_NOARGS, "Return kSizeLimit"},
{"kNumElementsLimit", (PyCFunction) PyRayConfig_kNumElementsLimit, METH_NOARGS, "Return kNumElementsLimit"},
{"kMaxTimeForLoop", (PyCFunction) PyRayConfig_kMaxTimeForLoop, METH_NOARGS, "Return kMaxTimeForLoop"},
{"kRedisDBConnectRetries", (PyCFunction) PyRayConfig_kRedisDBConnectRetries, METH_NOARGS, "Return kRedisDBConnectRetries"},
{"kRedisDBConnectWaitMilliseconds", (PyCFunction) PyRayConfig_kRedisDBConnectWaitMilliseconds, METH_NOARGS, "Return kRedisDBConnectWaitMilliseconds"},
{"kPlasmaDefaultReleaseDelay", (PyCFunction) PyRayConfig_kPlasmaDefaultReleaseDelay, METH_NOARGS, "Return kPlasmaDefaultReleaseDelay"},
{"kL3CacheSizeBytes", (PyCFunction) PyRayConfig_kL3CacheSizeBytes, METH_NOARGS, "Return kL3CacheSizeBytes"},
{NULL} /* Sentinel */
};

PyTypeObject PyRayConfigType = {
PyVarObject_HEAD_INIT(NULL, 0) /* ob_size */
"common.RayConfig", /* tp_name */
Expand Down
28 changes: 0 additions & 28 deletions src/common/lib/python/config_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,4 @@ PyObject *PyRayConfig_kRedisDBConnectWaitMilliseconds(PyObject *self);
PyObject *PyRayConfig_kPlasmaDefaultReleaseDelay(PyObject *self);
PyObject *PyRayConfig_kL3CacheSizeBytes(PyObject *self);

static PyMethodDef PyRayConfig_methods[] = {
{"kRayProtocolVersion", (PyCFunction) PyRayConfig_kRayProtocolVersion, METH_NOARGS, "Return kRayProtocolVersion"},
{"kHeartbeatTimeoutMilliseconds", (PyCFunction) PyRayConfig_kHeartbeatTimeoutMilliseconds, METH_NOARGS, "Return kHeartbeatTimeoutMilliseconds"},
{"kNumHeartbeatsTimeout", (PyCFunction) PyRayConfig_kNumHeartbeatsTimeout, METH_NOARGS, "Return kNumHeartbeatsTimeout"},
{"kGetTimeoutMilliseconds", (PyCFunction) PyRayConfig_kGetTimeoutMilliseconds, METH_NOARGS, "Return kGetTimeoutMilliseconds"},
{"kNumBindAttempts", (PyCFunction) PyRayConfig_kNumBindAttempts, METH_NOARGS, "Return kNumBindAttempts"},
{"kBindTimeoutMilliseconds", (PyCFunction) PyRayConfig_kBindTimeoutMilliseconds, METH_NOARGS, "Return kBindTimeoutMilliseconds"},
{"kNumConnectAttempts", (PyCFunction) PyRayConfig_kNumConnectAttempts, METH_NOARGS, "Return kNumConnectAttempts"},
{"kConnectTimeoutMilliseconds", (PyCFunction) PyRayConfig_kConnectTimeoutMilliseconds, METH_NOARGS, "Return kConnectTimeoutMilliseconds"},
{"kLocalSchedulerFetchTimeoutMilliseconds", (PyCFunction) PyRayConfig_kLocalSchedulerFetchTimeoutMilliseconds, METH_NOARGS, "Return kLocalSchedulerFetchTimeoutMilliseconds"},
{"kLocalSchedulerReconstructionTimeoutMilliseconds", (PyCFunction) PyRayConfig_kLocalSchedulerReconstructionTimeoutMilliseconds, METH_NOARGS, "Return kLocalSchedulerReconstructionTimeoutMilliseconds"},
{"kKillWorkerTimeoutMilliseconds", (PyCFunction) PyRayConfig_kKillWorkerTimeoutMilliseconds, METH_NOARGS, "Return kKillWorkerTimeoutMilliseconds"},
{"kDefaultNumCPUs", (PyCFunction) PyRayConfig_kDefaultNumCPUs, METH_NOARGS, "Return kDefaultNumCPUs"},
{"kDefaultNumGPUs", (PyCFunction) PyRayConfig_kDefaultNumGPUs, METH_NOARGS, "Return kDefaultNumGPUs"},
{"kDefaultNumCustomResource", (PyCFunction) PyRayConfig_kDefaultNumCustomResource, METH_NOARGS, "Return kDefaultNumCustomResource"},
{"kManagerTimeoutMilliseconds", (PyCFunction) PyRayConfig_kManagerTimeoutMilliseconds, METH_NOARGS, "Return kManagerTimeoutMilliseconds"},
{"kBufSize", (PyCFunction) PyRayConfig_kBufSize, METH_NOARGS, "Return kBufSize"},
{"kMaxTimeForHandlerMilliseconds", (PyCFunction) PyRayConfig_kMaxTimeForHandlerMilliseconds, METH_NOARGS, "Return kMaxTimeForHandlerMilliseconds"},
{"kSizeLimit", (PyCFunction) PyRayConfig_kSizeLimit, METH_NOARGS, "Return kSizeLimit"},
{"kNumElementsLimit", (PyCFunction) PyRayConfig_kNumElementsLimit, METH_NOARGS, "Return kNumElementsLimit"},
{"kMaxTimeForLoop", (PyCFunction) PyRayConfig_kMaxTimeForLoop, METH_NOARGS, "Return kMaxTimeForLoop"},
{"kRedisDBConnectRetries", (PyCFunction) PyRayConfig_kRedisDBConnectRetries, METH_NOARGS, "Return kRedisDBConnectRetries"},
{"kRedisDBConnectWaitMilliseconds", (PyCFunction) PyRayConfig_kRedisDBConnectWaitMilliseconds, METH_NOARGS, "Return kRedisDBConnectWaitMilliseconds"},
{"kPlasmaDefaultReleaseDelay", (PyCFunction) PyRayConfig_kPlasmaDefaultReleaseDelay, METH_NOARGS, "Return kPlasmaDefaultReleaseDelay"},
{"kL3CacheSizeBytes", (PyCFunction) PyRayConfig_kL3CacheSizeBytes, METH_NOARGS, "Return kL3CacheSizeBytes"},
{NULL} /* Sentinel */
};

#endif /* CONFIG_EXTENSION_H */
4 changes: 2 additions & 2 deletions src/local_scheduler/local_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ LocalSchedulerState *LocalSchedulerState_init(
if (plasma_manager_socket_name != NULL) {
ARROW_CHECK_OK(state->plasma_conn->Connect(plasma_store_socket_name,
plasma_manager_socket_name,
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
} else {
ARROW_CHECK_OK(state->plasma_conn->Connect(plasma_store_socket_name, "",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
}
/* Subscribe to notifications about sealed objects. */
int plasma_fd;
Expand Down
2 changes: 1 addition & 1 deletion src/plasma/plasma_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ PlasmaManagerState *PlasmaManagerState_init(const char *store_socket_name,
state->loop = event_loop_create();
state->plasma_conn = new plasma::PlasmaClient();
ARROW_CHECK_OK(state->plasma_conn->Connect(store_socket_name, "",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
if (redis_primary_addr) {
/* Get the manager port as a string. */
std::string manager_address_str =
Expand Down
22 changes: 11 additions & 11 deletions src/plasma/test/client_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ SUITE(plasma_client_tests);
TEST plasma_status_tests(void) {
PlasmaClient client1;
ARROW_CHECK_OK(client1.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
PlasmaClient client2;
ARROW_CHECK_OK(client2.Connect("/tmp/store2", "/tmp/manager2",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid1 = ObjectID::from_random();

/* Test for object non-existence. */
Expand Down Expand Up @@ -55,10 +55,10 @@ TEST plasma_status_tests(void) {
TEST plasma_fetch_tests(void) {
PlasmaClient client1;
ARROW_CHECK_OK(client1.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
PlasmaClient client2;
ARROW_CHECK_OK(client2.Connect("/tmp/store2", "/tmp/manager2",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid1 = ObjectID::from_random();

/* Test for object non-existence. */
Expand Down Expand Up @@ -128,7 +128,7 @@ bool is_equal_data_123(uint8_t *data1, uint8_t *data2, uint64_t size) {
TEST plasma_nonblocking_get_tests(void) {
PlasmaClient client;
ARROW_CHECK_OK(client.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid = ObjectID::from_random();
ObjectID oid_array[1] = {oid};
ObjectBuffer obj_buffer;
Expand Down Expand Up @@ -160,10 +160,10 @@ TEST plasma_nonblocking_get_tests(void) {
TEST plasma_wait_for_objects_tests(void) {
PlasmaClient client1;
ARROW_CHECK_OK(client1.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
PlasmaClient client2;
ARROW_CHECK_OK(client2.Connect("/tmp/store2", "/tmp/manager2",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid1 = ObjectID::from_random();
ObjectID oid2 = ObjectID::from_random();
#define NUM_OBJ_REQUEST 2
Expand Down Expand Up @@ -232,9 +232,9 @@ TEST plasma_wait_for_objects_tests(void) {
TEST plasma_get_tests(void) {
PlasmaClient client1, client2;
ARROW_CHECK_OK(client1.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ARROW_CHECK_OK(client2.Connect("/tmp/store2", "/tmp/manager2",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid1 = ObjectID::from_random();
ObjectID oid2 = ObjectID::from_random();
ObjectBuffer obj_buffer;
Expand Down Expand Up @@ -273,9 +273,9 @@ TEST plasma_get_tests(void) {
TEST plasma_get_multiple_tests(void) {
PlasmaClient client1, client2;
ARROW_CHECK_OK(client1.Connect("/tmp/store1", "/tmp/manager1",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ARROW_CHECK_OK(client2.Connect("/tmp/store2", "/tmp/manager2",
kPlasmaDefaultReleaseDelay));
PLASMA_DEFAULT_RELEASE_DELAY));
ObjectID oid1 = ObjectID::from_random();
ObjectID oid2 = ObjectID::from_random();
ObjectID obj_ids[NUM_OBJ_REQUEST];
Expand Down
2 changes: 1 addition & 1 deletion src/plasma/test/manager_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ plasma_mock *init_plasma_mock(plasma_mock *remote_mock) {
wait_for_pollin(mock->manager_remote_fd);
mock->read_conn =
ClientConnection_listen(mock->loop, mock->manager_remote_fd,
mock->state, kPlasmaDefaultReleaseDelay);
mock->state, PLASMA_DEFAULT_RELEASE_DELAY);
} else {
mock->write_conn = NULL;
mock->read_conn = NULL;
Expand Down