Call remote tasks of service workspace #75

Closed
winter-yuki wants to merge 25 commits from winter-yuki/distributed into 0.6
2 changed files with 9 additions and 10 deletions
Showing only changes of commit 230a3f1e22 - Show all commits

View File

@ -5,6 +5,7 @@ import io.lambdarpc.coding.CodingContext
import io.lambdarpc.transport.grpc.Entity
import io.lambdarpc.transport.serialization.Entity
import io.lambdarpc.transport.serialization.RawData
import kotlinx.coroutines.runBlocking
import java.nio.charset.Charset
internal object DataSetCoder : Coder<SerializableDataSet<Any>> {
@ -15,7 +16,7 @@ internal object DataSetCoder : Coder<SerializableDataSet<Any>> {
}
override fun encode(value: SerializableDataSet<Any>, context: CodingContext): Entity {
val prototype = DataSetPrototype.of(value)
val prototype = runBlocking { DataSetPrototype.of(value) } // TODO update LambdaRPC and remove blocking
val string = prototype.toJson()
return Entity(RawData.copyFrom(string, Charset.defaultCharset()))
}

View File

@ -2,11 +2,11 @@ package space.kscience.dataforge.distributed.serialization
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.serializer
@ -29,13 +29,13 @@ internal data class DataSetPrototype(val data: Map<String, DataPrototype>) {
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
fun toJson(): String = Json.encodeToString(serializer(), this)
companion object {
fun <T : Any> of(dataSet: DataSet<T>): DataSetPrototype = runBlocking {
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
suspend fun <T : Any> of(dataSet: DataSet<T>): DataSetPrototype = coroutineScope {
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
val serializer = serializer(dataSet.dataType)
val map = mutableListOf<Pair<String, Deferred<DataPrototype>>>()
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
val flow = mutableListOf<Pair<String, Deferred<DataPrototype>>>()
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
dataSet.flowData().map { (name, data) ->
name.toString() to async { DataPrototype.of(data, serializer) }
}.toList(map)
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
DataSetPrototype(map.associate { (name, deferred) -> name to deferred.await() })
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
}.toList(flow)
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
DataSetPrototype(flow.associate { (name, deferred) -> name to deferred.await() })
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
}
fun fromJson(string: String): DataSetPrototype = Json.decodeFromString(serializer(), string)
@ -68,8 +68,6 @@ private class SerializableDataSetImpl(private val prototype: DataSetPrototype) :
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
/**
* Trivial named data implementation.
*/
private class SimpleNamedData(
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
override val name: Name,
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
override val data: Data<Any>,
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
) : NamedData<Any>, Data<Any> by data
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
private class SimpleNamedData(override val name: Name, override val data: Data<Any>) :
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
NamedData<Any>, Data<Any> by data
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
}

altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
altavir commented 2022-05-24 12:42:07 +03:00 (Migrated from github.com)
Review

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.

Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
winter-yuki commented 2022-05-25 20:53:44 +03:00 (Migrated from github.com)
Review

When ServiceWorkspace.execute returns result to the client, it do not know yet about serializer for the T. Then RemoteTask uses serializer to deserialize DataSet from prototype.

When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.