mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 09:41:11 +08:00
[Streaming] fix streaming ci (#9675)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import ray
|
||||
from ray.streaming import StreamingContext
|
||||
import subprocess
|
||||
import os
|
||||
from ray.test_utils import wait_for_condition
|
||||
|
||||
|
||||
def map_func1(x):
|
||||
@@ -32,9 +34,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"
|
||||
@@ -45,6 +47,7 @@ def test_hybrid_stream():
|
||||
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") \
|
||||
@@ -54,14 +57,23 @@ def test_hybrid_stream():
|
||||
.as_python_stream() \
|
||||
.sink(sink_func)
|
||||
ctx.submit("HybridStreamTest")
|
||||
import time
|
||||
time.sleep(3)
|
||||
|
||||
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")
|
||||
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__":
|
||||
|
||||
Reference in New Issue
Block a user