Working on action builders
This commit is contained in:
parent
4e31bef631
commit
0ddf64a423
@ -3,7 +3,9 @@ package hep.dataforge.data
|
|||||||
import hep.dataforge.meta.Laminate
|
import hep.dataforge.meta.Laminate
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.meta.MetaBuilder
|
import hep.dataforge.meta.MetaBuilder
|
||||||
|
import hep.dataforge.meta.builder
|
||||||
import hep.dataforge.names.Name
|
import hep.dataforge.names.Name
|
||||||
|
import hep.dataforge.names.toName
|
||||||
import java.util.stream.Collectors
|
import java.util.stream.Collectors
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
@ -84,9 +86,8 @@ class JoinAction<T : Any, R : Any>(
|
|||||||
val laminate = Laminate(group.meta, meta)
|
val laminate = Laminate(group.meta, meta)
|
||||||
|
|
||||||
val goalMap: Map<String, Goal<T>> = group.node
|
val goalMap: Map<String, Goal<T>> = group.node
|
||||||
.dataStream()
|
.dataSequence()
|
||||||
.filter { it.isValid }
|
.associate { it.first to it.second.goal }
|
||||||
.collect(Collectors.toMap({ it.name }, { it.goal }))
|
|
||||||
|
|
||||||
val groupName: String = group.name;
|
val groupName: String = group.name;
|
||||||
|
|
||||||
@ -94,14 +95,7 @@ class JoinAction<T : Any, R : Any>(
|
|||||||
throw AnonymousNotAlowedException("Anonymous groups are not allowed");
|
throw AnonymousNotAlowedException("Anonymous groups are not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
val env = ActionEnv(
|
val env = ActionEnv(groupName.toName(), laminate.builder())
|
||||||
context,
|
|
||||||
groupName,
|
|
||||||
laminate.builder,
|
|
||||||
context.history.getChronicle(Name.joinString(groupName, name))
|
|
||||||
)
|
|
||||||
|
|
||||||
val dispatcher = context + getExecutorService(context, group.meta).asCoroutineDispatcher()
|
|
||||||
|
|
||||||
val goal = goalMap.join(dispatcher) { group.result.invoke(env, it) }
|
val goal = goalMap.join(dispatcher) { group.result.invoke(env, it) }
|
||||||
val res = NamedData(env.name, outputType, goal, env.meta)
|
val res = NamedData(env.name, outputType, goal, env.meta)
|
||||||
|
Loading…
Reference in New Issue
Block a user