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 7 additions and 34 deletions
Showing only changes of commit 50a9e7d314 - Show all commits

View File

@ -1,15 +1,11 @@
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
package space.kscience.dataforge.distributed.serialization
import kotlinx.coroutines.CompletableDeferred
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import kotlinx.coroutines.CoroutineScope
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import kotlinx.coroutines.Deferred
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import space.kscience.dataforge.data.Data
import space.kscience.dataforge.data.Goal
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import space.kscience.dataforge.data.StaticData
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import space.kscience.dataforge.data.await
import space.kscience.dataforge.meta.Meta
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
import space.kscience.dataforge.meta.MetaSerializer
import kotlin.reflect.KType
@ -22,10 +18,10 @@ internal data class DataPrototype(
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
val data: String,
) {
fun <T : Any> toData(type: KType, serializer: KSerializer<T>): Data<T> =
SimpleData(
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
StaticData(
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
type = type,
value = Json.decodeFromString(serializer, data),
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
meta = Json.decodeFromString(MetaSerializer, meta),
data = Json.decodeFromString(serializer, data)
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
)
companion object {
@ -36,21 +32,3 @@ internal data class DataPrototype(
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
}
}
}
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
/**
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
* Trivial [Data] implementation.
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
*/
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
private class SimpleData<T : Any>(
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override val type: KType,
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override val meta: Meta,
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
val data: T,
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
) : Data<T> {
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override val dependencies: Collection<Goal<*>>
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
get() = emptyList()
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override val deferred: Deferred<T>
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
get() = CompletableDeferred(data)
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override fun async(coroutineScope: CoroutineScope): Deferred<T> = deferred
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
override fun reset() = Unit
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that
}
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that

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

There is existing class for that

There is existing class for that
altavir commented 2022-05-24 12:40:16 +03:00 (Migrated from github.com)
Review

There is existing class for that

There is existing class for that

View File

@ -10,6 +10,7 @@ import space.kscience.dataforge.data.NamedData
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 space.kscience.dataforge.data.asIterable
import space.kscience.dataforge.data.component1
import space.kscience.dataforge.data.component2
import space.kscience.dataforge.data.named
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 space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.names.Name
import kotlin.reflect.KType
@ -23,7 +24,7 @@ internal data class DataSetPrototype(val meta: Meta, val data: Map<String, DataP
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.
val data = data
.mapKeys { (name, _) -> Name.of(name) }
.mapValues { (_, dataPrototype) -> dataPrototype.toData(type, serializer) }
return SerializableDataSetImpl(type, data, meta)
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.
return SimpleDataSet(type, data, meta)
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.
}
companion object {
@ -40,22 +41,16 @@ internal data class DataSetPrototype(val meta: Meta, val data: Map<String, DataP
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 [DataSet] implementation.
*/
private class SerializableDataSetImpl<T : 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.
private class SimpleDataSet<T : 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.
override val dataType: KType,
private val data: Map<Name, Data<T>>,
override val meta: Meta,
) : DataSet<T> {
/**
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.
* Trivial named data implementation.
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.
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<T : Any>(override val name: Name, override val data: Data<T>) :
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<T>, Data<T> 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.
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 fun iterator(): Iterator<NamedData<T>> =
data
.asSequence()
.map { (name, data) -> SimpleNamedData(name, 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.
.map { (name, data) -> data.named(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.
.iterator()
override fun get(name: Name): Data<T>? = data[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.
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.