mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 13:32:36 +08:00
Cross language serialization for primitive types (#7711)
* Cross language serialization for Java and Python * Use strict types when Python serializing * Handle recursive objects in Python; Pin msgpack >= 0.6.0, < 1.0.0 * Disable gc for optimizing msgpack loads * Fix merge bug * Java call Python use returnType; Fix ClassLoaderTest * Fix RayMethodsTest * Fix checkstyle * Fix lint * prepare_args raises exception if try to transfer a non-deserializable object to another language * Fix CrossLanguageInvocationTest.java, Python msgpack treat float as double * Minor fixes * Fix compile error on linux * Fix lint in java/BUILD.bazel * Fix test_failure * Fix lint * Class<?> to Class<T>; Refine metadata bytes. * Rename FST to Fst; sort java dependencies * Change Class<?>[] to Optional<Class<?>>; sort requirements in setup.py * Improve CrossLanguageInvocationTest * Refactor MessagePackSerializer.java * Refactor MessagePackSerializer.java; Refine CrossLanguageInvocationTest.java * Remove unnecessary dependencies for Java; Add getReturnType() for RayFunction in Java * Fix bug * Remove custom cross language type support * Replace Serializer.Meta with MutableBoolean * Remove @SuppressWarnings support from checkstyle.xml; Add null test in CrossLanguageInvocationTest.java * Refine MessagePackSerializer.pack * Ray.get support RayObject as input * Improve comments and error info * Remove classLoader argument from serializer * Separate msgpack from pickle5 in Python * Pair<byte[], MutableBoolean> to Pair<byte[], Boolean> * Remove public static <T> T get(RayObject<T> object), use RayObject.get() instead * Refine test * small fixes Co-authored-by: 刘宝 <po.lb@antfin.com> Co-authored-by: Hao Chen <chenh1024@gmail.com>
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@ package org.ray.streaming.runtime.core.collector;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import org.ray.runtime.util.Serializer;
|
||||
import org.ray.runtime.serializer.Serializer;
|
||||
import org.ray.streaming.api.collector.Collector;
|
||||
import org.ray.streaming.api.partition.Partition;
|
||||
import org.ray.streaming.message.Record;
|
||||
@@ -31,7 +31,7 @@ public class OutputCollector implements Collector<Record> {
|
||||
@Override
|
||||
public void collect(Record record) {
|
||||
int[] partitions = this.partition.partition(record, outputQueues.length);
|
||||
ByteBuffer msgBuffer = ByteBuffer.wrap(Serializer.encode(record));
|
||||
ByteBuffer msgBuffer = ByteBuffer.wrap(Serializer.encode(record).getLeft());
|
||||
for (int partition : partitions) {
|
||||
writer.write(outputQueues[partition], msgBuffer);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package org.ray.streaming.runtime.worker.tasks;
|
||||
|
||||
import org.ray.runtime.util.Serializer;
|
||||
import org.ray.runtime.serializer.Serializer;
|
||||
import org.ray.streaming.runtime.core.processor.Processor;
|
||||
import org.ray.streaming.runtime.transfer.Message;
|
||||
import org.ray.streaming.runtime.worker.JobWorker;
|
||||
@@ -28,7 +28,7 @@ public abstract class InputStreamTask extends StreamTask {
|
||||
if (item != null) {
|
||||
byte[] bytes = new byte[item.body().remaining()];
|
||||
item.body().get(bytes);
|
||||
Object obj = Serializer.decode(bytes);
|
||||
Object obj = Serializer.decode(bytes, Object.class);
|
||||
processor.process(obj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user