Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit 6656df7

Browse files
authored
[Python]fix hybird stream test (#66)
* fix hybird stream test * hybirdtest * make workaround for hybirdstream test * fix pytest current all of running tests * check python test exit code * add java 11 compatible compiler arguments for sun.ni package * lint
1 parent 23d3a91 commit 6656df7

File tree

24 files changed

+112
-37
lines changed

24 files changed

+112
-37
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ Build
165165
----------------
166166

167167
Build from source code :
168+
168169
- Build a docker using docker/Dockerfile-env
169170
- Execute `scripts/install.sh`
170171

streaming/buildtest.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,12 @@ function test_streaming_python()
111111
fi
112112
#python3 -m pytest $script_dir/python/raystreaming/tests/simple --capture=no
113113
bazel build java:streaming_java_pkg
114-
python3 -m pytest "$script_dir"/python/raystreaming/tests/ > "$TMP_LOG_OUTPUT"/python-test/python-test.log 2>&1
115-
zip_and_upload_log "$TMP_LOG_OUTPUT"/python-test/ "${script_dir}/${ZIP_FILE}" "/${GITHUB_SHA}/${TIME}/${ZIP_FILE}"
116-
exit $?
114+
python3 -m pytest "$script_dir"/python/raystreaming/tests/ # > "$TMP_LOG_OUTPUT"/python-test/python-test.log 2>&1
115+
exit_code=$?
116+
echo "Running python test exit code : ${exit_code}"
117+
echo "[Disabled] Uploding output to remote file."
118+
#zip_and_upload_log "$TMP_LOG_OUTPUT"/python-test/ "${script_dir}/${ZIP_FILE}" "/${GITHUB_SHA}/${TIME}/${ZIP_FILE}"
119+
exit $exit_code
117120

118121
popd || exit
119122
}

streaming/java/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
<properties>
5858
<java.version>1.8</java.version>
59+
<java.new.version>11</java.new.version>
5960
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6061
<ray.version>2.9.3</ray.version>
6162
<streaming.version>0.0.1</streaming.version>
@@ -128,6 +129,22 @@
128129
</configuration>
129130
</plugin>
130131

132+
<plugin>
133+
<groupId>org.apache.maven.plugins</groupId>
134+
<artifactId>maven-compiler-plugin</artifactId>
135+
<version>3.6.1</version>
136+
<configuration>
137+
<source>${java.new.version}</source>
138+
<target>${java.new.version}</target>
139+
<encoding>${project.build.sourceEncoding}</encoding>
140+
<compilerArgs>
141+
<arg>--add-modules=jdk.unsupported</arg>
142+
<arg>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</arg>
143+
</compilerArgs>
144+
</configuration>
145+
</plugin>
146+
147+
131148
<plugin>
132149
<groupId>org.apache.maven.plugins</groupId>
133150
<artifactId>maven-source-plugin</artifactId>

streaming/java/streaming-api/src/main/java/io/ray/streaming/api/context/StreamingContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static StreamingContext buildContext() {
5656
public void execute(String jobName) {
5757
JobGraphBuilder jobGraphBuilder = new JobGraphBuilder(this.streamSinks, jobName);
5858
JobGraph originalJobGraph = jobGraphBuilder.build();
59+
originalJobGraph.printJobGraph();
5960
this.jobGraph = new JobGraphOptimizer(originalJobGraph).optimize();
6061
jobGraph.printJobGraph();
6162
LOG.info("JobGraph digraph\n{}", jobGraph.generateDigraph());

streaming/java/streaming-api/src/main/java/io/ray/streaming/api/partition/impl/PythonPartitionFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class PythonPartitionFunction implements Partition<Object> {
2323
public static final PythonPartitionFunction KeyPartition =
2424
new PythonPartitionFunction("raystreaming.partition", "KeyPartition");
2525
public static final PythonPartitionFunction RoundRobinPartition =
26-
new PythonPartitionFunction("raystreaming.partition", "RoundRobinPartitionFunction");
26+
new PythonPartitionFunction("raystreaming.partition", "RoundRobinPartition");
2727
public static final String FORWARD_PARTITION_CLASS = "ForwardPartition";
2828
public static final PythonPartitionFunction ForwardPartition =
2929
new PythonPartitionFunction("raystreaming.partition", FORWARD_PARTITION_CLASS);

streaming/java/streaming-api/src/main/java/io/ray/streaming/api/partition/impl/RoundRobinPartitionFunction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public int[] partition(T value, int currentIndex, int numPartition) {
2525

2626
@Override
2727
public int[] partition(T record, int numPartition) {
28-
// TODO
29-
return new int[0];
28+
seq = (seq + 1) % numPartition;
29+
partitions[0] = seq;
30+
return partitions;
3031
}
3132

3233
@Override

streaming/java/streaming-api/src/main/java/io/ray/streaming/operator/AbstractStreamOperator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void setFunction(F function) {
5454

5555
@Override
5656
public void open(List<Collector> collectorList, RuntimeContext runtimeContext) {
57+
LOG.info("Abstract {}, {} open : {}.", this.getId(), this.getName(), collectorList.size());
5758
this.collectorList = collectorList;
5859
this.runtimeContext = runtimeContext;
5960
if (runtimeContext != null && runtimeContext.getOpConfig() != null) {

streaming/java/streaming-api/src/main/java/io/ray/streaming/operator/chain/ChainedOperator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ChainedOperator(
5959
@Override
6060
public void open(List<Collector> collectorList, RuntimeContext runtimeContext) {
6161
// Dont' call super.open() as we `open` every operator separately.
62-
LOG.info("chainedOperator open.");
62+
LOG.info("ChainedOperator open.");
6363
for (int i = 0; i < operators.size(); i++) {
6464
StreamOperator operator = operators.get(i);
6565
List<Collector> succeedingCollectors = new ArrayList<>();
@@ -77,6 +77,14 @@ public void open(List<Collector> collectorList, RuntimeContext runtimeContext) {
7777
(collector.getId() == operator.getId()
7878
&& collector.getDownStreamOpId() == subOperator.getId()))
7979
.collect(Collectors.toList()));
80+
// FIXME(lingxuan.zlx): Workaround for edge mismatch, see more detail from
81+
// https://github.com/ray-project/mobius/issues/67.
82+
if (succeedingCollectors.isEmpty()) {
83+
succeedingCollectors.addAll(
84+
collectorList.stream()
85+
.filter(x -> (x.getDownStreamOpId() == subOperator.getId()))
86+
.collect(Collectors.toList()));
87+
}
8088
}
8189
});
8290
operator.open(succeedingCollectors, createRuntimeContext(runtimeContext, i));

streaming/java/streaming-runtime/src/main/java/io/ray/streaming/runtime/util/BinaryFileUtil.java renamed to streaming/java/streaming-common/src/main/java/io/ray/streaming/common/utils/BinaryFileUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.ray.streaming.runtime.util;
1+
package io.ray.streaming.common.utils;
22

33
import com.google.common.base.Preconditions;
44
import java.io.File;

streaming/java/streaming-common/src/main/java/io/ray/streaming/common/utils/JniUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.common.collect.Sets;
44
import com.sun.jna.NativeLibrary;
5-
import io.ray.runtime.util.BinaryFileUtil;
65
import java.io.File;
76
import java.io.IOException;
87
import java.nio.file.Files;

0 commit comments

Comments
 (0)