public class ComputeUtils extends Object
Constructor and Description |
---|
ComputeUtils() |
Modifier and Type | Method and Description |
---|---|
static <R> Collection<R> |
affinityCallWithRetries(Ignite ignite,
Collection<String> cacheNames,
IgniteFunction<Integer,R> fun,
int retries,
DeployingContext deployingContext)
Calls the specified
fun function on all partitions so that is't guaranteed that partitions with the same
index of all specified caches will be placed on the same node and will not be moved before computation is
finished. |
static <R> Collection<R> |
affinityCallWithRetries(Ignite ignite,
Collection<String> cacheNames,
IgniteFunction<Integer,R> fun,
int retries,
int interval,
DeployingContext deployingContext)
Calls the specified
fun function on all partitions so that is't guaranteed that partitions with the same
index of all specified caches will be placed on the same node and will not be moved before computation is
finished. |
static <C extends Serializable> |
getContext(Ignite ignite,
String datasetCacheName,
int part)
Extracts partition
context from the Ignite Cache. |
static <K,V,C extends Serializable,D extends AutoCloseable> |
getData(Ignite ignite,
String upstreamCacheName,
IgniteBiPredicate<K,V> filter,
UpstreamTransformerBuilder transformerBuilder,
String datasetCacheName,
UUID datasetId,
PartitionDataBuilder<K,V,C,D> partDataBuilder,
LearningEnvironment env,
boolean isKeepBinary)
Extracts partition
data from the local storage, if it's not found in local storage recovers this data from a partition upstream and context . |
static LearningEnvironment |
getLearningEnvironment(Ignite ignite,
UUID datasetId,
int part,
LearningEnvironmentBuilder envBuilder)
Gets learning environment for given partition.
|
static <K,V,C extends Serializable> |
initContext(Ignite ignite,
String upstreamCacheName,
UpstreamTransformerBuilder transformerBuilder,
IgniteBiPredicate<K,V> filter,
String datasetCacheName,
PartitionContextBuilder<K,V,C> ctxBuilder,
LearningEnvironmentBuilder envBuilder,
int retries,
int interval,
boolean isKeepBinary,
DeployingContext deployingContext)
Initializes partition
context by loading it from a partition upstream . |
static void |
removeData(Ignite ignite,
UUID datasetId)
Remove data from local cache by Dataset ID.
|
static void |
removeLearningEnv(Ignite ignite,
UUID datasetId)
Remove learning environment from local cache by Dataset ID.
|
static <C extends Serializable> |
saveContext(Ignite ignite,
String datasetCacheName,
int part,
C ctx)
Saves the specified partition
context into the Ignite Cache. |
public static <R> Collection<R> affinityCallWithRetries(Ignite ignite, Collection<String> cacheNames, IgniteFunction<Integer,R> fun, int retries, int interval, DeployingContext deployingContext)
fun
function on all partitions so that is't guaranteed that partitions with the same
index of all specified caches will be placed on the same node and will not be moved before computation is
finished. If partitions are placed on different nodes then call will be retried, but not more than retries
times with interval
interval specified in milliseconds.R
- Type of a result.ignite
- Ignite instance.cacheNames
- Collection of cache names.fun
- Function to be applied on all partitions.retries
- Number of retries for the case when one of partitions not found on the node.interval
- Interval of retries for the case when one of partitions not found on the node.deployingContext
- Deploy context of user-defined classes for peer class loading.public static <R> Collection<R> affinityCallWithRetries(Ignite ignite, Collection<String> cacheNames, IgniteFunction<Integer,R> fun, int retries, DeployingContext deployingContext)
fun
function on all partitions so that is't guaranteed that partitions with the same
index of all specified caches will be placed on the same node and will not be moved before computation is
finished. If partitions are placed on different nodes then call will be retried, but not more than retries
times.R
- Type of a result.ignite
- Ignite instance.cacheNames
- Collection of cache names.fun
- Function to be applied on all partitions.retries
- Number of retries for the case when one of partitions not found on the node.deployingContext
- Deploy context.public static LearningEnvironment getLearningEnvironment(Ignite ignite, UUID datasetId, int part, LearningEnvironmentBuilder envBuilder)
LearningEnvironmentBuilder
.ignite
- Ignite instance.datasetId
- Dataset id.part
- Partition index.envBuilder
- LearningEnvironmentBuilder
.public static <K,V,C extends Serializable,D extends AutoCloseable> D getData(Ignite ignite, String upstreamCacheName, IgniteBiPredicate<K,V> filter, UpstreamTransformerBuilder transformerBuilder, String datasetCacheName, UUID datasetId, PartitionDataBuilder<K,V,C,D> partDataBuilder, LearningEnvironment env, boolean isKeepBinary)
data
from the local storage, if it's not found in local storage recovers this data
from a partition upstream
and context
. Be aware that this method should be called from
the node where partition is placed.K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.C
- Type of a partition context
.D
- Type of a partition data
.ignite
- Ignite instance.upstreamCacheName
- Name of an upstream
cache.filter
- Filter for upstream
data.transformerBuilder
- Builder of upstream transformers.datasetCacheName
- Name of a partition context
cache.datasetId
- Dataset ID.partDataBuilder
- Partition data builder.env
- Learning environment.data
.public static void removeData(Ignite ignite, UUID datasetId)
ignite
- Ignite instance.datasetId
- Dataset ID.public static void removeLearningEnv(Ignite ignite, UUID datasetId)
ignite
- Ingnite instance.datasetId
- Dataset ID.public static <K,V,C extends Serializable> void initContext(Ignite ignite, String upstreamCacheName, UpstreamTransformerBuilder transformerBuilder, IgniteBiPredicate<K,V> filter, String datasetCacheName, PartitionContextBuilder<K,V,C> ctxBuilder, LearningEnvironmentBuilder envBuilder, int retries, int interval, boolean isKeepBinary, DeployingContext deployingContext)
context
by loading it from a partition upstream
.K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.C
- Type of a partition context
.ignite
- Ignite instance.upstreamCacheName
- Name of an upstream
cache.filter
- Filter for upstream
data.transformerBuilder
- Upstream transformer builder.ctxBuilder
- Partition context
builder.envBuilder
- Environment builder.isKeepBinary
- Support of binary objects.deployingContext
- Deploy context.public static <C extends Serializable> C getContext(Ignite ignite, String datasetCacheName, int part)
context
from the Ignite Cache.C
- Type of a partition context
.ignite
- Ignite instance.datasetCacheName
- Dataset cache names.part
- Partition index.context
.public static <C extends Serializable> void saveContext(Ignite ignite, String datasetCacheName, int part, C ctx)
context
into the Ignite Cache.C
- Type of a partition context
.ignite
- Ignite instance.datasetCacheName
- Dataset cache name.part
- Partition index.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024