Better organize ray_common module (#4898)

This commit is contained in:
Hao Chen
2019-06-04 23:19:09 -07:00
committed by Robert Nishihara
parent c2253d2313
commit d106283769
61 changed files with 102 additions and 103 deletions
+15 -15
View File
@@ -281,16 +281,13 @@ cc_library(
name = "ray_util",
srcs = glob(
[
"src/ray/*.cc",
"src/ray/util/*.cc",
],
exclude = [
"src/ray/util/logging_test.cc",
"src/ray/util/signal_test.cc",
"src/ray/util/*_test.cc",
],
),
hdrs = glob([
"src/ray/*.h",
"src/ray/util/*.h",
]),
copts = COPTS,
@@ -306,22 +303,25 @@ cc_library(
cc_library(
name = "ray_common",
srcs = [
"src/ray/common/client_connection.cc",
"src/ray/common/common_protocol.cc",
],
hdrs = [
"src/ray/common/buffer.h",
"src/ray/common/client_connection.h",
"src/ray/common/common_protocol.h",
],
srcs = glob(
[
"src/ray/common/*.cc",
],
exclude = [
"src/ray/common/*_test.cc",
],
),
hdrs = glob(
[
"src/ray/common/*.h",
],
),
copts = COPTS,
includes = [
"src/ray/gcs/format",
],
deps = [
":gcs_fbs",
":node_manager_fbs",
":ray_util",
"@boost//:asio",
"@plasma//:plasma_client",
@@ -468,7 +468,7 @@ cc_binary(
srcs = [
"src/ray/raylet/lib/java/org_ray_runtime_raylet_RayletClientImpl.h",
"src/ray/raylet/lib/java/org_ray_runtime_raylet_RayletClientImpl.cc",
"src/ray/id.h",
"src/ray/common/id.h",
"src/ray/raylet/raylet_client.h",
"src/ray/util/logging.h",
"@bazel_tools//tools/jdk:jni_header",
@@ -13,7 +13,7 @@ import org.ray.api.id.UniqueId;
/**
* Helper method for different Ids.
* Note: any changes to these methods must be synced with C++ helper functions
* in src/ray/id.h
* in src/ray/common/id.h
*/
public class IdUtil {
public static final int OBJECT_INDEX_POS = 16;
@@ -161,7 +161,7 @@ public class IdUtil {
}
/**
* This method is the same as `Hash()` method of `ID` class in ray/src/ray/id.h
* This method is the same as `Hash()` method of `ID` class in ray/src/ray/common/id.h
*/
private static long murmurHash64A(byte[] data, int length, int seed) {
final long m = 0xc6a4a7935bd1e995L;
+3 -3
View File
@@ -12,7 +12,7 @@ from ray.includes.unique_ids cimport (
)
cdef extern from "ray/status.h" namespace "ray" nogil:
cdef extern from "ray/common/status.h" namespace "ray" nogil:
cdef cppclass StatusCode:
pass
@@ -68,7 +68,7 @@ cdef extern from "ray/status.h" namespace "ray" nogil:
cdef CRayStatus RayStatus_Invalid "Status::Invalid"()
cdef extern from "ray/status.h" namespace "ray::StatusCode" nogil:
cdef extern from "ray/common/status.h" namespace "ray::StatusCode" nogil:
cdef StatusCode StatusCode_OK "OK"
cdef StatusCode StatusCode_OutOfMemory "OutOfMemory"
cdef StatusCode StatusCode_KeyError "KeyError"
@@ -80,7 +80,7 @@ cdef extern from "ray/status.h" namespace "ray::StatusCode" nogil:
cdef StatusCode StatusCode_RedisError "RedisError"
cdef extern from "ray/id.h" namespace "ray" nogil:
cdef extern from "ray/common/id.h" namespace "ray" nogil:
const CTaskID GenerateTaskId(const CDriverID &driver_id,
const CTaskID &parent_task_id,
int parent_task_counter)
+1 -1
View File
@@ -3,7 +3,7 @@ from libcpp.string cimport string as c_string
from libcpp.unordered_map cimport unordered_map
cdef extern from "ray/ray_config.h" nogil:
cdef extern from "ray/common/ray_config.h" nogil:
cdef cppclass RayConfig "RayConfig":
@staticmethod
RayConfig &instance()
+2 -2
View File
@@ -2,7 +2,7 @@ from libcpp cimport bool as c_bool
from libcpp.string cimport string as c_string
from libc.stdint cimport uint8_t, int64_t
cdef extern from "ray/id.h" namespace "ray" nogil:
cdef extern from "ray/common/id.h" namespace "ray" nogil:
cdef cppclass CBaseID[T]:
@staticmethod
T from_random()
@@ -113,7 +113,7 @@ cdef extern from "ray/id.h" namespace "ray" nogil:
c_bool is_put()
int64_t ObjectIndex() const
int64_t ObjectIndex() const
CTaskID TaskId() const
+4 -4
View File
@@ -34,7 +34,7 @@ def check_id(b, size=kUniqueIDSize):
str(size))
cdef extern from "ray/constants.h" nogil:
cdef extern from "ray/common/constants.h" nogil:
cdef int64_t kUniqueIDSize
cdef int64_t kMaxTaskPuts
@@ -109,7 +109,7 @@ cdef class UniqueID(BaseID):
def nil(cls):
return cls(CUniqueID.Nil().Binary())
@classmethod
def from_random(cls):
return cls(os.urandom(CUniqueID.Size()))
@@ -122,7 +122,7 @@ cdef class UniqueID(BaseID):
def hex(self):
return decode(self.data.Hex())
def is_nil(self):
return self.data.IsNil()
@@ -148,7 +148,7 @@ cdef class ObjectID(BaseID):
def hex(self):
return decode(self.data.Hex())
def is_nil(self):
return self.data.IsNil()
+1 -2
View File
@@ -4,8 +4,7 @@
#include <boost/bind.hpp>
#include <sstream>
#include "ray/ray_config.h"
#include "ray/raylet/format/node_manager_generated.h"
#include "ray/common/ray_config.h"
#include "ray/util/util.h"
namespace ray {
+2 -2
View File
@@ -8,8 +8,8 @@
#include <boost/asio/error.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
namespace ray {
+1 -1
View File
@@ -5,7 +5,7 @@
#include <unordered_map>
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/util/logging.h"
/// Convert an unique ID to a flatbuffer string.
+4 -4
View File
@@ -1,4 +1,4 @@
#include "ray/id.h"
#include "ray/common/id.h"
#include <limits.h>
@@ -6,11 +6,11 @@
#include <mutex>
#include <random>
#include "ray/constants.h"
#include "ray/status.h"
#include "ray/common/constants.h"
#include "ray/common/status.h"
extern "C" {
#include "thirdparty/sha256.h"
#include "ray/thirdparty/sha256.h"
}
// Definitions for computing hash digests.
+1 -1
View File
@@ -11,7 +11,7 @@
#include <string>
#include "plasma/common.h"
#include "ray/constants.h"
#include "ray/common/constants.h"
#include "ray/util/logging.h"
#include "ray/util/visibility.h"
@@ -12,7 +12,7 @@
// Adapted from Apache Arrow, Apache Kudu, TensorFlow
#include "ray/status.h"
#include "ray/common/status.h"
#include <assert.h>
+1 -1
View File
@@ -4,7 +4,7 @@
#include <string>
#include "ray/common/buffer.h"
#include "ray/id.h"
#include "ray/common/id.h"
namespace ray {
+1 -1
View File
@@ -1,7 +1,7 @@
#include "object_interface.h"
#include "context.h"
#include "core_worker.h"
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
namespace ray {
+2 -2
View File
@@ -4,8 +4,8 @@
#include "common.h"
#include "plasma/client.h"
#include "ray/common/buffer.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
namespace ray {
+1 -1
View File
@@ -3,7 +3,7 @@
#include "common.h"
#include "ray/common/buffer.h"
#include "ray/status.h"
#include "ray/common/status.h"
namespace ray {
+2 -2
View File
@@ -3,8 +3,8 @@
#include "common.h"
#include "ray/common/buffer.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
namespace ray {
+1 -1
View File
@@ -1,7 +1,7 @@
#include "ray/gcs/client.h"
#include "ray/common/ray_config.h"
#include "ray/gcs/redis_context.h"
#include "ray/ray_config.h"
static void GetRedisShards(redisContext *context, std::vector<std::string> &addresses,
std::vector<int> &ports) {
+2 -2
View File
@@ -4,10 +4,10 @@
#include <map>
#include <string>
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/gcs/asio.h"
#include "ray/gcs/tables.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/util/logging.h"
namespace ray {
+1 -1
View File
@@ -5,9 +5,9 @@ extern "C" {
#include "ray/thirdparty/hiredis/hiredis.h"
}
#include "ray/common/ray_config.h"
#include "ray/gcs/client.h"
#include "ray/gcs/tables.h"
#include "ray/ray_config.h"
namespace ray {
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
}
// TODO(pcm): Integrate into the C++ tree.
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
namespace {
+2 -2
View File
@@ -5,8 +5,8 @@
#include <memory>
#include <unordered_map>
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/util/logging.h"
#include "ray/gcs/format/gcs_generated.h"
+2 -2
View File
@@ -2,9 +2,9 @@
#include <sstream>
#include "ray/common/common_protocol.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/gcs/format/gcs_generated.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/util/logging.h"
#include "redis_string.h"
#include "redismodule.h"
+1 -1
View File
@@ -1,8 +1,8 @@
#include "ray/gcs/tables.h"
#include "ray/common/common_protocol.h"
#include "ray/common/ray_config.h"
#include "ray/gcs/client.h"
#include "ray/ray_config.h"
#include "ray/util/util.h"
namespace {
+3 -3
View File
@@ -6,9 +6,9 @@
#include <unordered_map>
#include <unordered_set>
#include "ray/constants.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/constants.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/util/logging.h"
#include "ray/gcs/format/gcs_generated.h"
+2 -2
View File
@@ -12,8 +12,8 @@
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include <mutex>
#include "ray/object_manager/format/object_manager_generated.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#include "ray/object_manager/object_buffer_pool.h"
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/util/logging.h"
namespace ray {
+2 -2
View File
@@ -12,8 +12,8 @@
#include "plasma/client.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
namespace ray {
+2 -2
View File
@@ -9,10 +9,10 @@
#include "plasma/client.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/gcs/client.h"
#include "ray/id.h"
#include "ray/object_manager/format/object_manager_generated.h"
#include "ray/status.h"
namespace ray {
+2 -2
View File
@@ -16,8 +16,8 @@
#include "plasma/client.h"
#include "ray/common/client_connection.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/object_manager/connection_pool.h"
#include "ray/object_manager/format/object_manager_generated.h"
@@ -11,8 +11,8 @@
#include <boost/enable_shared_from_this.hpp>
#include "ray/common/client_connection.h"
#include "ray/id.h"
#include "ray/ray_config.h"
#include "ray/common/id.h"
#include "ray/common/ray_config.h"
namespace ray {
@@ -5,7 +5,7 @@
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/common/common_protocol.h"
#include "ray/object_manager/object_store_notification_manager.h"
@@ -11,8 +11,8 @@
#include "plasma/client.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
#include "ray/object_manager/object_directory.h"
@@ -5,7 +5,7 @@
#include "gtest/gtest.h"
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/object_manager/object_manager.h"
@@ -3,14 +3,14 @@
#include "gtest/gtest.h"
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/object_manager/object_manager.h"
namespace {
std::string store_executable;
int64_t wait_timeout_ms;
}
} // namespace
namespace ray {
+1 -1
View File
@@ -3,8 +3,8 @@
#include <unordered_map>
#include "ray/common/id.h"
#include "ray/gcs/format/gcs_generated.h"
#include "ray/id.h"
#include "ray/raylet/task.h"
namespace ray {
@@ -2,7 +2,7 @@
#include <jni.h>
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/raylet/raylet_client.h"
#include "ray/util/logging.h"
+2 -2
View File
@@ -8,8 +8,8 @@
#include "ray/common/common_protocol.h"
#include "ray/raylet/task.h"
#include "ray/gcs/tables.h"
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
// clang-format on
namespace ray {
+2 -2
View File
@@ -1,9 +1,9 @@
#include <iostream>
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
#include "ray/common/status.h"
#include "ray/raylet/raylet.h"
#include "ray/stats/stats.h"
#include "ray/status.h"
#include "gflags/gflags.h"
+2 -2
View File
@@ -12,8 +12,8 @@
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include "ray/id.h"
#include "ray/status.h"
#include "ray/common/id.h"
#include "ray/common/status.h"
namespace ray {
+2 -2
View File
@@ -1,7 +1,7 @@
#include "ray/raylet/monitor.h"
#include "ray/ray_config.h"
#include "ray/status.h"
#include "ray/common/ray_config.h"
#include "ray/common/status.h"
#include "ray/util/util.h"
namespace ray {
+1 -1
View File
@@ -4,8 +4,8 @@
#include <memory>
#include <unordered_set>
#include "ray/common/id.h"
#include "ray/gcs/client.h"
#include "ray/id.h"
namespace ray {
+1 -1
View File
@@ -1,6 +1,6 @@
#include <iostream>
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
#include "ray/raylet/monitor.h"
#include "ray/util/util.h"
+2 -2
View File
@@ -2,10 +2,10 @@
#include <fstream>
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/common/common_protocol.h"
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/raylet/format/node_manager_generated.h"
#include "ray/stats/stats.h"
@@ -3,7 +3,7 @@
#include "gtest/gtest.h"
#include "ray/status.h"
#include "ray/common/status.h"
#include "ray/raylet/raylet.h"
+2 -2
View File
@@ -5,7 +5,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
#include "ray/status.h"
#include "ray/common/status.h"
namespace {
@@ -37,7 +37,7 @@ static const std::vector<std::string> object_manager_message_enum =
GenerateEnumNames(ray::object_manager::protocol::EnumNamesMessageType(),
static_cast<int>(ray::object_manager::protocol::MessageType::MIN),
static_cast<int>(ray::object_manager::protocol::MessageType::MAX));
}
} // namespace
namespace ray {
+1 -1
View File
@@ -13,7 +13,7 @@
#include <sys/un.h>
#include "ray/common/common_protocol.h"
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
#include "ray/raylet/format/node_manager_generated.h"
#include "ray/raylet/task_spec.h"
#include "ray/util/logging.h"
+1 -1
View File
@@ -6,8 +6,8 @@
#include <unordered_map>
#include <vector>
#include "ray/common/status.h"
#include "ray/raylet/task_spec.h"
#include "ray/status.h"
using ray::ActorCheckpointID;
using ray::ActorID;
+1 -1
View File
@@ -7,8 +7,8 @@
#include <boost/asio.hpp>
#include "ray/common/id.h"
#include "ray/gcs/tables.h"
#include "ray/id.h"
#include "ray/util/util.h"
#include "ray/object_manager/object_directory.h"
+1 -1
View File
@@ -2,8 +2,8 @@
#include <sstream>
#include "ray/common/status.h"
#include "ray/stats/stats.h"
#include "ray/status.h"
namespace {
+1 -1
View File
@@ -2,7 +2,7 @@
#define RAY_RAYLET_TASK_DEPENDENCY_MANAGER_H
// clang-format off
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/raylet/task.h"
#include "ray/object_manager/object_manager.h"
#include "ray/raylet/reconstruction_policy.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#include <vector>
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/raylet/format/node_manager_generated.h"
namespace ray {
+1 -1
View File
@@ -6,8 +6,8 @@
#include <unordered_map>
#include <vector>
#include "ray/common/id.h"
#include "ray/gcs/format/gcs_generated.h"
#include "ray/id.h"
#include "ray/raylet/scheduling_resources.h"
extern "C" {
+1 -1
View File
@@ -4,7 +4,7 @@
#include <memory>
#include "ray/common/client_connection.h"
#include "ray/id.h"
#include "ray/common/id.h"
#include "ray/raylet/scheduling_resources.h"
namespace ray {
+2 -2
View File
@@ -5,9 +5,9 @@
#include <algorithm>
#include <thread>
#include "ray/ray_config.h"
#include "ray/common/ray_config.h"
#include "ray/common/status.h"
#include "ray/stats/stats.h"
#include "ray/status.h"
#include "ray/util/logging.h"
namespace {
+1 -1
View File
@@ -4,7 +4,7 @@
#include <boost/system/error_code.hpp>
#include <chrono>
#include "ray/status.h"
#include "ray/common/status.h"
/// Return the number of milliseconds since the steady clock epoch. NOTE: The
/// returned timestamp may be used for accurately measuring intervals but has