Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 0 additions & 25 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -367,29 +367,6 @@ cc_library(
],
)

# This header is used to warp some streaming code so we can reduce suspicious
# symbols export.
cc_library(
name = "exported_streaming_internal",
srcs = glob(
[
"src/ray/streaming/streaming.cc",
],
),
hdrs = glob(
[
"src/ray/streaming/streaming.h",
],
),
copts = COPTS,
strip_include_prefix = "src",
visibility = ["//visibility:public"],
deps = [
":core_worker_lib",
],
alwayslink = 1,
)

cc_binary(
name = "raylet",
srcs = ["src/ray/raylet/main.cc"],
Expand Down Expand Up @@ -1725,7 +1702,6 @@ pyx_library(
),
deps = [
"//:core_worker_lib",
"//:exported_streaming_internal",
"//:global_state_accessor_lib",
"//:ray_util",
"//:raylet_lib",
Expand Down Expand Up @@ -1780,7 +1756,6 @@ cc_binary(
visibility = ["//java:__subpackages__"],
deps = [
"//:core_worker_lib",
"//:exported_streaming_internal",
"//:global_state_accessor_lib",
"//:src/ray/ray_exported_symbols.lds",
"//:src/ray/ray_version_script.lds",
Expand Down
43 changes: 20 additions & 23 deletions src/ray/common/id.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ class BaseID {
protected:
BaseID(const std::string &binary) {
RAY_CHECK(binary.size() == Size() || binary.size() == 0)
<< "expected size is " << Size() << ", but got data " << binary << " of size "
<< binary.size();
<< "expected size is " << Size() << ", but got " << binary.size();
std::memcpy(const_cast<uint8_t *>(this->Data()), binary.data(), binary.size());
}
// All IDs are immutable for hash evaluations. MutableData is only allow to use
Expand Down Expand Up @@ -342,25 +341,24 @@ std::ostream &operator<<(std::ostream &os, const TaskID &id);
std::ostream &operator<<(std::ostream &os, const ObjectID &id);
std::ostream &operator<<(std::ostream &os, const PlacementGroupID &id);

#define DEFINE_UNIQUE_ID(type) \
class RAY_EXPORT type : public UniqueID { \
public: \
explicit type(const UniqueID &from) { \
std::memcpy(&id_, from.Data(), kUniqueIDSize); \
} \
type() : UniqueID() {} \
static type FromRandom() { return type(UniqueID::FromRandom()); } \
static type FromBinary(const std::string &binary) { return type(binary); } \
static type Nil() { return type(UniqueID::Nil()); } \
static size_t Size() { return kUniqueIDSize; } \
\
private: \
explicit type(const std::string &binary) { \
RAY_CHECK(binary.size() == Size() || binary.size() == 0) \
<< "expected size is " << Size() << ", but got data " << binary << " of size " \
<< binary.size(); \
std::memcpy(&id_, binary.data(), binary.size()); \
} \
#define DEFINE_UNIQUE_ID(type) \
class RAY_EXPORT type : public UniqueID { \
public: \
explicit type(const UniqueID &from) { \
std::memcpy(&id_, from.Data(), kUniqueIDSize); \
} \
type() : UniqueID() {} \
static type FromRandom() { return type(UniqueID::FromRandom()); } \
static type FromBinary(const std::string &binary) { return type(binary); } \
static type Nil() { return type(UniqueID::Nil()); } \
static size_t Size() { return kUniqueIDSize; } \
\
private: \
explicit type(const std::string &binary) { \
RAY_CHECK(binary.size() == Size() || binary.size() == 0) \
<< "expected size is " << Size() << ", but got " << binary.size(); \
std::memcpy(&id_, binary.data(), binary.size()); \
} \
};

#include "ray/common/id_def.h"
Expand All @@ -387,8 +385,7 @@ T BaseID<T>::FromRandom() {
template <typename T>
T BaseID<T>::FromBinary(const std::string &binary) {
RAY_CHECK(binary.size() == T::Size() || binary.size() == 0)
<< "expected size is " << T::Size() << ", but got data " << binary << " of size "
<< binary.size();
<< "expected size is " << T::Size() << ", but got " << binary.size();
T t;
std::memcpy(t.MutableData(), binary.data(), binary.size());
return t;
Expand Down
2 changes: 1 addition & 1 deletion src/ray/common/task/task_spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ObjectID TaskSpecification::ReturnId(size_t return_index) const {
}

bool TaskSpecification::ArgByRef(size_t arg_index) const {
return message_->args(arg_index).has_object_ref();
return message_->args(arg_index).object_ref().object_id() != "";
}

ObjectID TaskSpecification::ArgId(size_t arg_index) const {
Expand Down
2 changes: 1 addition & 1 deletion src/ray/common/task/task_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TaskArgByValue : public TaskArg {
///
/// \param[in] value Value of the argument.
/// \return The task argument.
explicit TaskArgByValue(const std::shared_ptr<RayObject> &value) : value_(value) {
TaskArgByValue(const std::shared_ptr<RayObject> &value) : value_(value) {
RAY_CHECK(value) << "Value can't be null.";
}

Expand Down
2 changes: 1 addition & 1 deletion src/ray/core_worker/transport/dependency_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void InlineDependencies(
if (!it->second->IsInPlasmaError()) {
// The object has not been promoted to plasma. Inline the object by
// clearing the reference and replacing it with the raw value.
mutable_arg->clear_object_ref();
mutable_arg->mutable_object_ref()->Clear();
if (it->second->HasData()) {
const auto &data = it->second->GetData();
mutable_arg->set_data(data->Data(), data->Size());
Expand Down
2 changes: 0 additions & 2 deletions src/ray/ray_exported_symbols.lds
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
*ray*TaskID*
*ray*ActorID*
*ray*ObjectID*
*ray*ObjectReference*
# Others
*ray*CoreWorker*
*PyInit*
*init_raylet*
*Java*
*JNI_*
*ray*streaming*
2 changes: 0 additions & 2 deletions src/ray/ray_version_script.lds
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ VERSION_1.0 {
*ray*TaskID*;
*ray*ActorID*;
*ray*ObjectID*;
*ray*ObjectReference*;
# Others
*ray*CoreWorker*;
*PyInit*;
*init_raylet*;
*Java*;
*JNI_*;
*ray*streaming*;
local: *;
};
34 changes: 0 additions & 34 deletions src/ray/streaming/streaming.cc

This file was deleted.

21 changes: 0 additions & 21 deletions src/ray/streaming/streaming.h

This file was deleted.

10 changes: 0 additions & 10 deletions streaming/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ cc_binary(
deps = ["//:core_worker_lib"],
)

cc_binary(
name = "exported_streaming_internal.so",
copts = COPTS,
linkshared = 1,
deps = ["//:exported_streaming_internal"],
)

cc_library(
name = "streaming_util",
srcs = glob([
Expand Down Expand Up @@ -153,7 +146,6 @@ cc_library(
],
"//conditions:default": [
"core_worker_lib.so",
"exported_streaming_internal.so",
],
}),
)
Expand Down Expand Up @@ -241,7 +233,6 @@ cc_library(
)

test_common_deps = [
"//:exported_streaming_internal",
":streaming_lib",
"//:ray_common",
"//:ray_util",
Expand Down Expand Up @@ -357,7 +348,6 @@ genrule(
GENERATED_DIR="streaming/python/generated"
mkdir -p "$$GENERATED_DIR"
touch "$$GENERATED_DIR/__init__.py"
# Use this `sed` command to change the import path in the generated file.
sed -i -E 's/from streaming.src.protobuf/from ./' "$$GENERATED_DIR/remote_call_pb2.py"
sed -i -E 's/from protobuf/from ./' "$$GENERATED_DIR/remote_call_pb2.py"
date > $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -39,25 +37,4 @@ public static void loadNativeLibraries() {
JniUtils.loadLibrary("streaming_java");
}

/**
* Execute an external command.
*
* @return Whether the command succeeded.
*/
public static boolean executeCommand(List<String> command, int waitTimeoutSeconds) {
try {
ProcessBuilder processBuilder = new ProcessBuilder(command)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT);
Process process = processBuilder.start();
boolean exit = process.waitFor(waitTimeoutSeconds, TimeUnit.SECONDS);
if (!exit) {
process.destroyForcibly();
}
return process.exitValue() == 0;
} catch (Exception e) {
throw new RuntimeException("Error executing command " + String.join(" ", command), e);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.ray.streaming.runtime.util;

import com.sun.management.OperatingSystemMXBean;
import io.ray.api.id.UniqueId;
import io.ray.streaming.runtime.core.resource.Container;
import io.ray.streaming.runtime.core.resource.ContainerId;
import java.io.BufferedInputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package io.ray.streaming.runtime.demo;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import io.ray.api.Ray;
import io.ray.streaming.api.context.StreamingContext;
import io.ray.streaming.api.function.impl.FilterFunction;
import io.ray.streaming.api.function.impl.MapFunction;
import io.ray.streaming.api.function.impl.SinkFunction;
import io.ray.streaming.api.stream.DataStreamSource;
import io.ray.streaming.runtime.util.EnvUtil;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -45,8 +42,6 @@ public boolean filter(Object value) throws Exception {
@Test(timeOut = 60000)
public void testHybridDataStream() throws Exception {
Ray.shutdown();
Preconditions.checkArgument(
EnvUtil.executeCommand(ImmutableList.of("ray", "stop"), 5));
String sinkFileName = "/tmp/testHybridDataStream.txt";
Files.deleteIfExists(Paths.get(sinkFileName));

Expand Down
36 changes: 12 additions & 24 deletions streaming/python/tests/test_hybrid_stream.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import json
import os
import subprocess

import ray
from ray.streaming import StreamingContext
from ray.test_utils import wait_for_condition
import subprocess
import os


def map_func1(x):
Expand Down Expand Up @@ -34,9 +32,9 @@ def test_hybrid_stream():
print("java_worker_options", java_worker_options)
assert not ray.is_initialized()
ray.init(
_load_code_from_local=True,
_include_java=True,
_java_worker_options=java_worker_options,
load_code_from_local=True,
include_java=True,
java_worker_options=java_worker_options,
_system_config={"num_workers_per_process_java": 1})

sink_file = "/tmp/ray_streaming_test_hybrid_stream.txt"
Expand All @@ -47,7 +45,6 @@ def sink_func(x):
print("HybridStreamTest", x)
with open(sink_file, "a") as f:
f.write(str(x))
f.flush()

ctx = StreamingContext.Builder().build()
ctx.from_values("a", "b", "c") \
Expand All @@ -57,23 +54,14 @@ def sink_func(x):
.as_python_stream() \
.sink(sink_func)
ctx.submit("HybridStreamTest")

def check_succeed():
if os.path.exists(sink_file):
import time
time.sleep(3) # Wait all data be written
with open(sink_file, "r") as f:
result = f.read()
assert "a" in result
assert "b" not in result
assert "c" in result
print("Execution succeed")
return True
return False

wait_for_condition(check_succeed, timeout=60, retry_interval_ms=1000)
print("Execution succeed")
import time
time.sleep(3)
ray.shutdown()
with open(sink_file, "r") as f:
result = f.read()
assert "a" in result
assert "b" not in result
assert "c" in result


if __name__ == "__main__":
Expand Down
Loading