use of edu.iu.dsc.tws.tset.sets.batch.KeyedCheckpointedTSet in project twister2 by DSC-SPIDAL.
the class KeyedBatchIteratorLinkWrapper method persist.
@Override
public KeyedPersistedTSet<K, V> persist() {
// handling checkpointing
if (getTSetEnv().isCheckpointingEnabled()) {
String persistVariableName = this.getId() + "-persisted";
BatchChkPntEnvironment chkEnv = (BatchChkPntEnvironment) getTSetEnv();
Boolean persisted = chkEnv.initVariable(persistVariableName, false);
if (persisted) {
// create a source function with the capability to read from disk
DiskPartitionBackedSource<Tuple<K, V>> sourceFn = new DiskPartitionBackedSource<>(this.getId());
// pass the source fn to the checkpointed tset (that would create a source tset from the
// source function, the same way as a persisted tset. This preserves the order of tsets
// that are being created in the checkpointed env)
KeyedCheckpointedTSet<K, V> checkTSet = new KeyedCheckpointedTSet<>(getTSetEnv(), sourceFn, this.getTargetParallelism(), getSchema());
// adding checkpointed tset to the graph, so that the IDs would not change
addChildToGraph(checkTSet);
// run only the checkpointed tset so that it would populate the inputs in the executor
getTSetEnv().runOne(checkTSet);
return checkTSet;
} else {
KeyedPersistedTSet<K, V> storable = this.doPersist();
chkEnv.updateVariable(persistVariableName, true);
chkEnv.commit();
return storable;
}
}
return doPersist();
}
use of edu.iu.dsc.tws.tset.sets.batch.KeyedCheckpointedTSet in project twister2 by DSC-SPIDAL.
the class KeyedPipeTLink method persist.
@Override
public KeyedPersistedTSet<K, V> persist() {
// handling checkpointing
if (getTSetEnv().isCheckpointingEnabled()) {
String persistVariableName = this.getId() + "-persisted";
BatchChkPntEnvironment chkEnv = (BatchChkPntEnvironment) getTSetEnv();
Boolean persisted = chkEnv.initVariable(persistVariableName, false);
if (persisted) {
// create a source function with the capability to read from disk
DiskPartitionBackedSource<Tuple<K, V>> sourceFn = new DiskPartitionBackedSource<>(this.getId());
// pass the source fn to the checkpointed tset (that would create a source tset from the
// source function, the same way as a persisted tset. This preserves the order of tsets
// that are being created in the checkpointed env)
KeyedCheckpointedTSet<K, V> checkTSet = new KeyedCheckpointedTSet<>(getTSetEnv(), sourceFn, this.getTargetParallelism(), getSchema());
// adding checkpointed tset to the graph, so that the IDs would not change
addChildToGraph(checkTSet);
// run only the checkpointed tset so that it would populate the inputs in the executor
getTSetEnv().runOne(checkTSet);
return checkTSet;
} else {
KeyedPersistedTSet<K, V> storable = this.doPersist();
chkEnv.updateVariable(persistVariableName, true);
chkEnv.commit();
return storable;
}
}
return doPersist();
}
Aggregations