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

Streaming data transfer and python integration #6185

Merged
merged 323 commits into from Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
323 commits
Select commit Hold shift + click to select a range
50a7daa
refactor streaming python to use queue for communication
chaokunyang Nov 7, 2019
d0db596
use a separate thread to process task
chaokunyang Nov 7, 2019
5320bb0
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 7, 2019
ada98d1
return None only when all input channels of task return None
chaokunyang Nov 7, 2019
9d7c086
fix streaming java bazel gen_maven_deps
chaokunyang Nov 7, 2019
27da3a1
ignore streaming native lib and generated files
chaokunyang Nov 7, 2019
9f6c2c3
adjust comments style
ashione Nov 7, 2019
fb5b15b
add flatbuffer deps and fix generated java file package
chaokunyang Nov 7, 2019
de4197f
fix crash with testPassActorAsParameter where the callback for the sa…
zhijunfu Nov 7, 2019
f19d336
cp native_dependencies to jar as resources
chaokunyang Nov 7, 2019
d5108c8
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 7, 2019
076f848
Merge branch 'fix-java-build' into streaming_data_transfer
Nov 7, 2019
e9a6234
lint
ashione Nov 7, 2019
c2cd3cd
load resource file as native lib in java by create tmp file
chaokunyang Nov 7, 2019
64fe401
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 7, 2019
859d035
move streaming runtime to runtime package
chaokunyang Nov 7, 2019
d7f8a53
fix streaming ignore
chaokunyang Nov 7, 2019
b2985e1
fix package
chaokunyang Nov 7, 2019
0c04144
remove batched_queue
chaokunyang Nov 7, 2019
c587146
load native library when needed
chaokunyang Nov 7, 2019
4b7ca7e
transfer consumed tests
ashione Nov 7, 2019
9afb720
rename jni files name
chaokunyang Nov 7, 2019
0c1a97e
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 8, 2019
9d771f5
fix jni function name
Nov 8, 2019
cb8edc7
fix jni compile
Nov 8, 2019
965195a
streaming cython implementation
chaokunyang Nov 8, 2019
d4ca30f
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 8, 2019
9d29e81
add CoreWorker in pxd to expose corker_worker ptr to cython
chaokunyang Nov 11, 2019
271ed33
java worker test
Nov 11, 2019
079e0d2
fix
Nov 11, 2019
2d9bbe4
fix test
Nov 11, 2019
3908300
add _raylet.pxd to share Extension types
chaokunyang Nov 11, 2019
049980f
include streaming cython into raylet
chaokunyang Nov 11, 2019
5056090
streaming python flatbuffer generated files rule
chaokunyang Nov 11, 2019
c0ad460
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 11, 2019
09f8edf
queue consumer implementation
chaokunyang Nov 11, 2019
24dcdff
refactor execution graph build
chaokunyang Nov 12, 2019
ec6a552
refactor DataChannel to get actor id in DataInput/DataOutput
chaokunyang Nov 12, 2019
fe8957d
fix cyclic reference serialization error
chaokunyang Nov 12, 2019
7302267
fix serialization
chaokunyang Nov 12, 2019
64c1f87
share ActorID definition
chaokunyang Nov 12, 2019
d206909
fix java wordcount
Nov 12, 2019
6a28767
Merge branch 'streaming_data_transfer' of github.com:ant-tech-allianc…
Nov 12, 2019
526e488
fix build.sh
Nov 12, 2019
600ecbe
adapt native queue to python
chaokunyang Nov 12, 2019
b56f474
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 12, 2019
a3ef084
remove clear
Nov 12, 2019
bbabab0
Merge branch 'streaming_data_transfer' of github.com:ant-tech-allianc…
Nov 12, 2019
e0648cc
fix cython type declaration
chaokunyang Nov 12, 2019
edf4e6b
object QueueID
chaokunyang Nov 12, 2019
22b3718
fix qid_bytes_to_str
chaokunyang Nov 12, 2019
c4e5fe7
Merge branch 'streaming_data_transfer' of https://github.com/ant-tech…
chaokunyang Nov 12, 2019
34016db
fix register_custom_serializer exception in local mode
chaokunyang Nov 12, 2019
19cebb1
fix input/output gate
chaokunyang Nov 12, 2019
5b5d3c0
on_streaming_transfer/on_streaming_transfer_sync
chaokunyang Nov 13, 2019
c18dadc
set num_workers_per_process_java=1
chaokunyang Nov 13, 2019
676ab7d
fix QueueID and log
chaokunyang Nov 13, 2019
ea3b550
fix function descriptor
chaokunyang Nov 13, 2019
bf8d9aa
create actor with direct call
chaokunyang Nov 13, 2019
84d470b
add job worker and remove operator instance actor
chaokunyang Nov 14, 2019
0d6f4f0
fix cython compile error
chaokunyang Nov 15, 2019
42daab1
rm doc/streaming-doxy-config
Nov 15, 2019
d79d770
revert java code
Nov 15, 2019
31a1b56
revert bzl
Nov 15, 2019
7a5b521
rm jni
Nov 15, 2019
e30ee6a
rm useless code
Nov 15, 2019
dafe1f0
add DUMMY meta for __RAY_DUMMY__ positional args
chaokunyang Nov 17, 2019
c34f3a6
support bytes in direct call
chaokunyang Nov 17, 2019
d4e9e41
add DUMMY argument in streaming queue
chaokunyang Nov 17, 2019
68ae536
fix LocalMemoryBuffer can't be size of 0
chaokunyang Nov 17, 2019
95f3768
add explict and override
chaokunyang Nov 17, 2019
aa41229
release gil to avoid direct call deadlock with user thread
chaokunyang Nov 17, 2019
4b8e8e8
convert Buffer to bytes
chaokunyang Nov 17, 2019
e492c10
fix reader typo error
chaokunyang Nov 17, 2019
132d0d8
streaming queu remove pull data
Nov 17, 2019
bea5a35
remove utility join & split functions
ashione Nov 15, 2019
a15c6cb
streaming queu remove get last msg id
Nov 17, 2019
3902f03
revert check and remove useless code
Nov 17, 2019
bc016ba
remove test_direct_call.py
Nov 17, 2019
8d8bdd1
remove useless
Nov 17, 2019
50d097c
remove
Nov 17, 2019
4a164d5
use cloud pickle to serialize user function
chaokunyang Nov 17, 2019
3775ad7
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 17, 2019
2c534e4
revert some java changes
Nov 18, 2019
71d46b7
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 18, 2019
7c48d1c
revert .gitignore
Nov 18, 2019
b15d260
fix streaming python tests and await_finish
chaokunyang Nov 18, 2019
b1f1373
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
d3ce797
remove useless interface
Nov 18, 2019
96e7b82
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 18, 2019
c99c388
bazel lint
chaokunyang Nov 18, 2019
03f0e89
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
51fd36c
fix cpp test
Nov 18, 2019
71b1a5b
add test in .travis.yml
Nov 18, 2019
a7cbb19
fix wait_finish
chaokunyang Nov 18, 2019
3d852fd
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
00a2ccb
fix .travis.yml
Nov 18, 2019
e8e0f0e
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 18, 2019
8de4710
optimize import
chaokunyang Nov 18, 2019
3e8a4f3
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
29f8682
move queue exception to queue_interface.py
chaokunyang Nov 18, 2019
3f43ee3
move queue to runtime package
chaokunyang Nov 18, 2019
07d1723
rm _streaming.pyx
chaokunyang Nov 18, 2019
d4bccde
add cloudpickle dependence
chaokunyang Nov 18, 2019
bb7bc9e
Revert "Merge branch 'fix-java-build' into streaming_data_transfer"
Nov 18, 2019
8257808
Revert "fix java worker build failure"
Nov 18, 2019
c38a31b
fix _CLOSE_FLAG conflict
chaokunyang Nov 18, 2019
1be7f43
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
ea5de84
fix close flag
chaokunyang Nov 18, 2019
1a5d581
fix close flag
chaokunyang Nov 18, 2019
5aa7990
revert useless change
Nov 18, 2019
47b9840
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 18, 2019
2632f5f
remove unused config
ashione Nov 18, 2019
9224428
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
ashione Nov 18, 2019
68914f4
fix remove BatchedQueue
chaokunyang Nov 18, 2019
e524830
Merge branch 'streaming_data_transfer_python' of https://github.com/a…
chaokunyang Nov 18, 2019
62706a4
streaming queue python test
chaokunyang Nov 19, 2019
ac9b906
use CamelCaseStyle instead
ashione Nov 19, 2019
5a45806
fix crash
Nov 19, 2019
d34561a
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 19, 2019
a41487a
fix README
chaokunyang Nov 20, 2019
2fcfe8f
add brief intruducation of message & bundle protocol
ashione Nov 20, 2019
09f568c
move streaming.fbs from streaming/src/format to streaming/src
chaokunyang Nov 20, 2019
c400d35
refactor some codes
Nov 20, 2019
c2ced9d
Merge branch 'streaming_data_transfer_python' of github.com:ant-tech-…
Nov 20, 2019
944f8fa
replace streaming flatbuffer by proto buffer
chaokunyang Nov 20, 2019
9f7bc1c
fix streaming python protobuffer
chaokunyang Nov 20, 2019
220dfb0
build python conf
chaokunyang Nov 20, 2019
66ef601
streaming queue pb
Nov 20, 2019
bbd7327
namespace
Nov 21, 2019
b11e1ed
Update python/ray/_raylet.pyx
chaokunyang Nov 22, 2019
d344038
refine streaming config
chaokunyang Nov 22, 2019
a238932
clean code & comment
Nov 22, 2019
a94f7e0
add comments for queue_interface
chaokunyang Nov 22, 2019
c5a6995
refactor ray streaming structure
chaokunyang Nov 22, 2019
f99e3c4
fix compile
Nov 22, 2019
84b3f5d
clean queue_interface
Nov 22, 2019
b291ebd
refactor queue interface, remove QueueWriter QueueReader in queue_man…
Nov 22, 2019
042b3b5
fix run_streaming_common_tests
Nov 22, 2019
c4f85cc
rm TODO
Nov 25, 2019
0107bfe
streaming merger queue to message priority queue
ashione Nov 25, 2019
d90f852
rm CreateQueueReader and CreateQueueWriter
Nov 25, 2019
b17a784
remove all `streaming` prefix
chaokunyang Nov 25, 2019
b450c99
fix queue_interface.h
chaokunyang Nov 25, 2019
cdcb54e
add comments
Nov 25, 2019
08c778e
refactor streaming common to runtime context
ashione Nov 25, 2019
037e8b2
rebase
ashione Nov 25, 2019
418bb13
refine python directory structure and bazel file
chaokunyang Nov 25, 2019
a71a008
fix mock_actor.cc
chaokunyang Nov 25, 2019
0499dbd
replace transfer by channel
ashione Nov 25, 2019
708f423
rename StreamingReader/Writer to DataReader/Writer
chaokunyang Nov 25, 2019
0da2921
remove InitTransfer
chaokunyang Nov 25, 2019
7b7f6d2
fix cython
chaokunyang Nov 25, 2019
30e9bc1
move mock_transfer code to channel to avoid circular deps
chaokunyang Nov 25, 2019
b5ea294
google-style python comments
chaokunyang Nov 25, 2019
0fbe421
separate streaming shared library
chaokunyang Nov 26, 2019
37a9496
remove serializable macro from message & message bundle
ashione Nov 26, 2019
a0d468f
rm StreamingSerializable
Nov 26, 2019
3718fb6
refactor streamingqueue
Nov 26, 2019
8b8a7fb
remove useless
Nov 26, 2019
e03622c
remove queue_id in interface
Nov 26, 2019
a3cd7ed
remove queue_interface
Nov 27, 2019
b7ec477
refactor streaming cython
chaokunyang Nov 27, 2019
6fe7928
add comment
Nov 29, 2019
059a47b
add comments for data reader & data writer
ashione Nov 29, 2019
2b81da6
fix compile error
ashione Nov 29, 2019
547fe73
channel comments
ashione Nov 29, 2019
37232fe
add comment
Nov 30, 2019
8e7296f
remove queue and add streaming python channel
chaokunyang Dec 1, 2019
dcf8c76
add comment
Dec 2, 2019
226f818
fix error in sys.excepthook
chaokunyang Dec 2, 2019
59a9bed
fix
Dec 2, 2019
44677de
use ASCII meta for __RAY_DUMMY__
chaokunyang Dec 2, 2019
609da4a
add comment
Dec 2, 2019
d2d642b
Merge remote-tracking branch 'ray/master' into streaming_data_transfe…
chaokunyang Dec 2, 2019
07d8971
Merge remote-tracking branch 'origin/streaming_data_transfer_python' …
chaokunyang Dec 2, 2019
2612c9f
fix bazel
chaokunyang Dec 2, 2019
9da12d6
remove useless comment
Dec 2, 2019
081a86a
fix compile
Dec 2, 2019
eac1d4f
fix node_manager_port in streaming tests
Dec 2, 2019
3fe9da2
test travis
Dec 2, 2019
c52c773
test travis
Dec 2, 2019
60e5fda
Revert "test travis"
Dec 2, 2019
c72cf5c
streaming travis multi os
Dec 2, 2019
4ee2a33
Revert "streaming travis multi os"
Dec 2, 2019
2236b49
fix ci
Dec 2, 2019
cbffdcf
make ray._raylet.Buffer as raw data
chaokunyang Dec 2, 2019
fbd2ff0
comment
Dec 2, 2019
c361755
fix ci
Dec 2, 2019
c4b331f
remove queue concept
chaokunyang Dec 2, 2019
179073c
add pip install
Dec 2, 2019
a692a9e
fix
Dec 2, 2019
5b747cd
fix cyclic import
chaokunyang Dec 2, 2019
29c9828
fix
Dec 2, 2019
3486c04
travis_wait
Dec 2, 2019
953c011
fix channel test
chaokunyang Dec 3, 2019
64c9554
lint queue code
Dec 3, 2019
4f020e8
fix lint
Dec 3, 2019
b8c2f04
fix core_worker.cc compile
Dec 3, 2019
4bf93dc
Expose ray related symbols using RTLD_GLOBAL in linux
chaokunyang Dec 3, 2019
0dfeeb7
add streaming python tests
chaokunyang Dec 3, 2019
81724e1
remove proto conf
chaokunyang Dec 3, 2019
9b424f0
add comments
chaokunyang Dec 3, 2019
571f974
polish comments for channel & ringbuffer
ashione Dec 3, 2019
abe80f6
remove useless comment in data writer & reader
ashione Dec 3, 2019
727a6be
fix travis ci
chaokunyang Dec 4, 2019
120afa5
fix ci
chaokunyang Dec 4, 2019
4df003d
fix bazel
chaokunyang Dec 4, 2019
7c3b2a4
clean code
chaokunyang Dec 4, 2019
721a946
fix readme
chaokunyang Dec 4, 2019
7d78593
fix readme
chaokunyang Dec 4, 2019
a40db1f
change class name
Dec 4, 2019
f45cf07
fix ci
chaokunyang Dec 4, 2019
aedff91
Hide protobuf symbols to avoid symbols conflict crash
chaokunyang Dec 5, 2019
49a93db
lint
Dec 6, 2019
844772a
rename channel.py to transfer.py
chaokunyang Dec 6, 2019
86bafad
fix .gitignore
chaokunyang Dec 6, 2019
f9de1be
bazel lint
chaokunyang Dec 6, 2019
c720763
lint
chaokunyang Dec 6, 2019
b16d974
Merge remote-tracking branch 'ray/master' into streaming_data_transfe…
chaokunyang Dec 6, 2019
c2afe43
rename native_channel.pxi to transfer.pxi
chaokunyang Dec 6, 2019
2baa184
revert run_streamingqueue_test.sh
chaokunyang Dec 6, 2019
2544c34
Merge remote-tracking branch 'ray/master' into streaming_data_transfe…
chaokunyang Dec 6, 2019
515e0f5
make direct call buffer to bytes
chaokunyang Dec 6, 2019
13f5e42
add hide symbols comments
chaokunyang Dec 6, 2019
62d5dc7
add exclude symbols comments
chaokunyang Dec 6, 2019
382d607
removed assci meta type
chaokunyang Dec 6, 2019
327364f
fixed streaming conf proto
chaokunyang Dec 6, 2019
e7a02f4
refine
Dec 6, 2019
fef493a
lint
Dec 6, 2019
5f88645
fix typo or polish comments for data reader and writer
ashione Dec 6, 2019
ef66487
fix comment
Dec 6, 2019
27dbff5
explicit delete local reference in `task_execution_callback` for garb…
kfstorm Dec 6, 2019
7d87d04
Expanded with new pages for getting started, etc. Blog links unchange…
deanwampler Dec 6, 2019
2c281c4
[tune] Fixed bug in PBT where initial trial result is empty. (#6351)
visatish Dec 6, 2019
636e6dd
[Java] Add java exception check in JNI (#6378)
kfstorm Dec 7, 2019
22bd41d
[Java] Fix `instanceof RayPyActor` (#6377)
kfstorm Dec 7, 2019
f773a40
remove useless code
chaokunyang Dec 7, 2019
bce36e2
use bytes as raw data
chaokunyang Dec 7, 2019
79741a7
Merge remote-tracking branch 'ray/master' into streaming_data_transfe…
chaokunyang Dec 8, 2019
803d7c0
fix deserialize args
chaokunyang Dec 8, 2019
b618772
test determine_tests_to_run.py
chaokunyang Dec 9, 2019
d166435
use -Wl,--version-script to expose ABI
chaokunyang Dec 9, 2019
ab57ef9
fix ray.ldvs
chaokunyang Dec 9, 2019
230a74d
fix symbols conflict
chaokunyang Dec 10, 2019
62b4bf7
ray export symbols
chaokunyang Dec 10, 2019
dbe7c0f
remove useless imports
chaokunyang Dec 10, 2019
8b37cff
refine comments
chaokunyang Dec 10, 2019
7335cf8
fix python2 module init function export
chaokunyang Dec 10, 2019
c426737
fix lint
chaokunyang Dec 10, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -130,6 +130,7 @@ scripts/nodes.txt

# Pytest Cache
**/.pytest_cache
**/.cache
.benchmarks

# Vscode
Expand All @@ -145,6 +146,9 @@ java/**/.classpath
java/**/.project
java/runtime/native_dependencies/

# streaming/python
streaming/python/generated/

# python virtual env
venv

Expand Down
17 changes: 16 additions & 1 deletion .travis.yml
Expand Up @@ -34,6 +34,21 @@ matrix:
- if [ $RAY_CI_JAVA_AFFECTED != "1" ]; then exit; fi
- ./java/test.sh

- os: linux
env: BAZEL_PYTHON_VERSION=PY3 PYTHON=3.5 PYTHONWARNINGS=ignore TESTSUITE=streaming
install:
- python $TRAVIS_BUILD_DIR/ci/travis/determine_tests_to_run.py
- eval `python $TRAVIS_BUILD_DIR/ci/travis/determine_tests_to_run.py`
- if [ $RAY_CI_STREAMING_PYTHON_AFFECTED != "1" ]; then exit; fi
- ./ci/suppress_output ./ci/travis/install-bazel.sh
- ./ci/suppress_output ./ci/travis/install-dependencies.sh
- export PATH="$HOME/miniconda/bin:$PATH"
- ./ci/suppress_output ./ci/travis/install-ray.sh
script:
# Streaming cpp test.
- if [ $RAY_CI_STREAMING_CPP_AFFECTED == "1" ]; then ./ci/suppress_output bash streaming/src/test/run_streaming_queue_test.sh; fi
- if [ RAY_CI_STREAMING_PYTHON_AFFECTED == "1" ]; then python -m pytest -v --durations=5 --timeout=300 python/ray/streaming/tests/; fi

- os: linux
env: LINT=1 PYTHONWARNINGS=ignore
before_install:
Expand All @@ -51,7 +66,7 @@ matrix:
- sphinx-build -W -b html -d _build/doctrees source _build/html
- cd ..
# Run Python linting, ignore dict vs {} (C408), others are defaults
- flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605
- flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605
- ./ci/travis/format.sh --all
# Make sure that the README is formatted properly.
- cd python
Expand Down
67 changes: 66 additions & 1 deletion BUILD.bazel
Expand Up @@ -7,6 +7,28 @@ load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:cython_library.bzl", "pyx_library")
load("@rules_proto_grpc//python:defs.bzl", "python_grpc_compile")
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("//bazel:ray.bzl", "if_linux_x86_64")

config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
visibility = ["//visibility:public"],
)

config_setting(
name = "macos",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "linux_x86_64",
values = {"cpu": "k8"},
visibility = ["//visibility:public"],
)

# TODO(mehrdadn): (How to) support dynamic linking?
PROPAGATED_WINDOWS_DEFINES = ["RAY_STATIC"]
Expand Down Expand Up @@ -219,6 +241,7 @@ cc_library(
includes = [
"@boost//:asio",
],
visibility = ["//visibility:public"],
deps = [
":common_cc_proto",
":gcs_cc_proto",
Expand Down Expand Up @@ -327,6 +350,7 @@ cc_library(
"-lpthread",
],
}),
visibility = ["//streaming:__subpackages__"],
deps = [
":common_cc_proto",
":gcs",
Expand Down Expand Up @@ -373,6 +397,7 @@ cc_library(
"src/ray/core_worker/transport/*.h",
]),
copts = COPTS,
visibility = ["//visibility:public"],
deps = [
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
Expand Down Expand Up @@ -659,6 +684,7 @@ cc_library(
includes = [
"src",
],
visibility = ["//visibility:public"],
deps = [
":sha256",
"@com_github_google_glog//:glog",
Expand Down Expand Up @@ -782,15 +808,51 @@ pyx_library(
name = "_raylet",
srcs = glob([
"python/ray/__init__.py",
"python/ray/_raylet.pxd",
"python/ray/_raylet.pyx",
"python/ray/includes/*.pxd",
"python/ray/includes/*.pxi",
]),
copts = COPTS,
# Export ray ABI symbols, which can then be used by _streaming.so.
# We need to dlopen this lib with RTLD_GLOBAL to use ABI in this
# shared lib, see python/ray/__init__.py.
cc_kwargs = {
"linkstatic": 1,
# see https://github.com/tensorflow/tensorflow/blob/r2.1/tensorflow/lite/BUILD#L444
"linkopts": select({
"//:macos": [
"-Wl,-exported_symbols_list,$(location //:src/ray/ray_exported_symbols.lds)",
],
"//:windows": [],
"//conditions:default": [
"-Wl,--version-script,$(location //:src/ray/ray_version_script.lds)",
],
}),
},
copts = COPTS + if_linux_x86_64(["-fno-gnu-unique"]),
deps = [
"//:core_worker_lib",
"//:raylet_lib",
"//:serialization_cc_proto",
"//:src/ray/ray_exported_symbols.lds",
"//:src/ray/ray_version_script.lds",
],
)

pyx_library(
name = "_streaming",
srcs = glob([
"python/ray/streaming/_streaming.pyx",
"python/ray/__init__.py",
"python/ray/_raylet.pxd",
"python/ray/includes/*.pxd",
"python/ray/includes/*.pxi",
"python/ray/streaming/__init__.pxd",
"python/ray/streaming/includes/*.pxd",
"python/ray/streaming/includes/*.pxi",
]),
deps = [
"//streaming:streaming_lib",
],
)

Expand Down Expand Up @@ -922,6 +984,7 @@ genrule(
name = "ray_pkg",
srcs = [
"python/ray/_raylet.so",
"python/ray/streaming/_streaming.so",
"//:python_sources",
"//:all_py_proto",
"//:redis-server",
Expand All @@ -930,12 +993,14 @@ genrule(
"//:raylet",
"//:raylet_monitor",
"@plasma//:plasma_store_server",
"//streaming:copy_streaming_py_proto",
],
outs = ["ray_pkg.out"],
cmd = """
set -x &&
WORK_DIR=$$(pwd) &&
cp -f $(location python/ray/_raylet.so) "$$WORK_DIR/python/ray" &&
cp -f $(location python/ray/streaming/_streaming.so) $$WORK_DIR/python/ray/streaming &&
mkdir -p "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&
cp -f $(location //:redis-server) "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&
cp -f $(location //:redis-cli) "$$WORK_DIR/python/ray/core/src/ray/thirdparty/redis/src/" &&
Expand Down
6 changes: 6 additions & 0 deletions bazel/ray.bzl
Expand Up @@ -64,3 +64,9 @@ def define_java_module(
"{auto_gen_header}": "<!-- This file is auto-generated by Bazel from pom_template.xml, do not modify it. -->",
},
)

def if_linux_x86_64(a):
return select({
"//:linux_x86_64": a,
"//conditions:default": [],
})
3 changes: 2 additions & 1 deletion ci/travis/bazel-format.sh
Expand Up @@ -44,6 +44,7 @@ while [[ $# > 0 ]]; do
done

pushd $ROOT_DIR/../..
BAZEL_FILES="bazel/BUILD bazel/BUILD.plasma bazel/ray.bzl BUILD.bazel WORKSPACE"
BAZEL_FILES="bazel/BUILD bazel/BUILD.plasma bazel/ray.bzl BUILD.bazel
streaming/BUILD.bazel WORKSPACE"
buildifier -mode=$RUN_TYPE -diff_command="diff -u" $BAZEL_FILES
popd
16 changes: 16 additions & 0 deletions ci/travis/determine_tests_to_run.py
Expand Up @@ -38,6 +38,8 @@ def list_changed_files(commit_range):
RAY_CI_PYTHON_AFFECTED = 0
RAY_CI_LINUX_WHEELS_AFFECTED = 0
RAY_CI_MACOS_WHEELS_AFFECTED = 0
RAY_CI_STREAMING_CPP_AFFECTED = 0
RAY_CI_STREAMING_PYTHON_AFFECTED = 0

if os.environ["TRAVIS_EVENT_TYPE"] == "pull_request":

Expand Down Expand Up @@ -71,6 +73,7 @@ def list_changed_files(commit_range):
RAY_CI_PYTHON_AFFECTED = 1
RAY_CI_LINUX_WHEELS_AFFECTED = 1
RAY_CI_MACOS_WHEELS_AFFECTED = 1
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
elif changed_file.startswith("java/"):
RAY_CI_JAVA_AFFECTED = 1
elif any(
Expand All @@ -86,6 +89,13 @@ def list_changed_files(commit_range):
RAY_CI_PYTHON_AFFECTED = 1
RAY_CI_LINUX_WHEELS_AFFECTED = 1
RAY_CI_MACOS_WHEELS_AFFECTED = 1
RAY_CI_STREAMING_CPP_AFFECTED = 1
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
elif changed_file.startswith("streaming/src"):
RAY_CI_STREAMING_CPP_AFFECTED = 1
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
elif changed_file.startswith("streaming/python"):
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
else:
RAY_CI_TUNE_AFFECTED = 1
RAY_CI_RLLIB_AFFECTED = 1
Expand All @@ -94,6 +104,7 @@ def list_changed_files(commit_range):
RAY_CI_PYTHON_AFFECTED = 1
RAY_CI_LINUX_WHEELS_AFFECTED = 1
RAY_CI_MACOS_WHEELS_AFFECTED = 1
RAY_CI_STREAMING_CPP_AFFECTED = 1
else:
RAY_CI_TUNE_AFFECTED = 1
RAY_CI_RLLIB_AFFECTED = 1
Expand All @@ -102,6 +113,7 @@ def list_changed_files(commit_range):
RAY_CI_PYTHON_AFFECTED = 1
RAY_CI_LINUX_WHEELS_AFFECTED = 1
RAY_CI_MACOS_WHEELS_AFFECTED = 1
RAY_CI_STREAMING_CPP_AFFECTED = 1

# Log the modified environment variables visible in console.
for output_stream in [sys.stdout, sys.stderr]:
Expand All @@ -116,3 +128,7 @@ def list_changed_files(commit_range):
.format(RAY_CI_LINUX_WHEELS_AFFECTED))
_print("export RAY_CI_MACOS_WHEELS_AFFECTED={}"
.format(RAY_CI_MACOS_WHEELS_AFFECTED))
_print("export RAY_CI_STREAMING_CPP_AFFECTED={}"
.format(RAY_CI_STREAMING_CPP_AFFECTED))
_print("export RAY_CI_STREAMING_PYTHON_AFFECTED={}"
.format(RAY_CI_STREAMING_PYTHON_AFFECTED))
4 changes: 2 additions & 2 deletions ci/travis/format.sh
Expand Up @@ -79,14 +79,14 @@ format_changed() {
yapf --in-place "${YAPF_EXCLUDES[@]}" "${YAPF_FLAGS[@]}"
if which flake8 >/dev/null; then
git diff --name-only --diff-filter=ACRM "$MERGEBASE" -- '*.py' | xargs -P 5 \
flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605
flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605
fi
fi

if ! git diff --diff-filter=ACRM --quiet --exit-code "$MERGEBASE" -- '*.pyx' '*.pxd' '*.pxi' &>/dev/null; then
if which flake8 >/dev/null; then
git diff --name-only --diff-filter=ACRM "$MERGEBASE" -- '*.pyx' '*.pxd' '*.pxi' | xargs -P 5 \
flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E211,E225,E226,E227,E24,E704,E999,W503,W504,W605
flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E211,E225,E226,E227,E24,E704,E999,W503,W504,W605
fi
fi

Expand Down
9 changes: 9 additions & 0 deletions python/ray/__init__.py
Expand Up @@ -3,6 +3,7 @@
from __future__ import print_function

import os
from os.path import dirname
import sys

# MUST add pickle5 to the import path because it will be imported by some
Expand All @@ -19,6 +20,14 @@
os.path.abspath(os.path.dirname(__file__)), "pickle5_files")
sys.path.insert(0, pickle5_path)

# Expose ray ABI symbols which may be dependent by other shared
# libraries such as _streaming.so. See BUILD.bazel:_raylet
so_path = os.path.join(dirname(__file__), "_raylet.so")
if os.path.exists(so_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows use dll, and doesn't need to expose symbols, because it always expose symbols

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then maybe check the OS instead, in case the file name changes in the future.

import ctypes
from ctypes import CDLL
CDLL(so_path, ctypes.RTLD_GLOBAL)

# MUST import ray._raylet before pyarrow to initialize some global variables.
# It seems the library related to memory allocation in pyarrow will destroy the
# initialization of grpc if we import pyarrow at first.
Expand Down
70 changes: 70 additions & 0 deletions python/ray/_raylet.pxd
@@ -0,0 +1,70 @@
# cython: profile=False
# distutils: language = c++
# cython: embedsignature = True
# cython: language_level = 3

from libcpp cimport bool as c_bool
from libcpp.string cimport string as c_string
from libcpp.vector cimport vector as c_vector
from libcpp.memory cimport (
shared_ptr,
unique_ptr
)

from ray.includes.common cimport (
CBuffer,
CRayObject
)
from ray.includes.libcoreworker cimport CCoreWorker
from ray.includes.unique_ids cimport (
CObjectID,
CActorID
)

cdef class Buffer:
cdef:
shared_ptr[CBuffer] buffer
Py_ssize_t shape
Py_ssize_t strides

@staticmethod
cdef make(const shared_ptr[CBuffer]& buffer)

cdef class BaseID:
# To avoid the error of "Python int too large to convert to C ssize_t",
# here `cdef size_t` is required.
cdef size_t hash(self)

cdef class ObjectID(BaseID):
cdef:
CObjectID data
object buffer_ref
# Flag indicating whether or not this object ID was added to the set
# of active IDs in the core worker so we know whether we should clean
# it up.
c_bool in_core_worker

cdef CObjectID native(self)

cdef class ActorID(BaseID):
cdef CActorID data

cdef CActorID native(self)

cdef size_t hash(self)

cdef class CoreWorker:
cdef:
unique_ptr[CCoreWorker] core_worker
object async_thread
object async_event_loop

cdef _create_put_buffer(self, shared_ptr[CBuffer] &metadata,
size_t data_size, ObjectID object_id,
CObjectID *c_object_id, shared_ptr[CBuffer] *data)
# TODO: handle noreturn better
cdef store_task_outputs(
self, worker, outputs, const c_vector[CObjectID] return_ids,
c_vector[shared_ptr[CRayObject]] *returns)

cdef c_vector[c_string] string_vector_from_list(list string_list)