public abstract class TSetEnvironment
extends java.lang.Object
BatchEnvironment
or StreamingEnvironment
Modifier | Constructor and Description |
---|---|
protected |
TSetEnvironment()
Used to construct the TSet environment when in the connected data flow mode.
|
protected |
TSetEnvironment(WorkerEnvironment wEnv) |
Modifier and Type | Method and Description |
---|---|
void |
addInput(java.lang.String tSetID,
java.lang.String inputTSetID,
java.lang.String inputKey)
|
void |
close()
Close the environment
|
abstract BaseTSet<java.lang.Integer> |
createArrowSource(java.lang.String filePath,
int parallelism) |
abstract BaseTSet<java.lang.String[]> |
createCSVSource(java.lang.String filePath,
int dataSize,
int parallelism,
java.lang.String type) |
abstract <K,V> TupleTSet<K,V> |
createKeyedSource(SourceFunc<Tuple<K,V>> source,
int parallelism)
Creates a Keyed Source TSet based on the
SourceFunc that produces a Tuple |
abstract <K,V> TupleTSet<K,V> |
createKeyedSource(java.lang.String name,
SourceFunc<Tuple<K,V>> source,
int parallelism)
Same as above, but a source tset name can be provided at the instantiation
|
abstract <T> BaseTSet<T> |
createSource(SourceFunc<T> source,
int parallelism)
Creates a source TSet based on the
SourceFunc |
abstract <T> BaseTSet<T> |
createSource(java.lang.String name,
SourceFunc<T> source,
int parallelism)
Same as above, but a source tset name can be provided at the instantiation
|
abstract BaseTSet<java.lang.String> |
createTextSource(java.lang.String filePath,
int dataSize,
int parallelism,
java.lang.String type) |
protected void |
executeBuildContext(BuildContext buildContext)
Executes data flow graph wrapped by a
BuildContext |
Config |
getConfig()
returns the config object received from the iWorker Config
|
int |
getDefaultParallelism()
Default parallelism
|
TBaseGraph |
getGraph()
Returns the tset graph
|
java.util.Map<java.lang.String,java.lang.String> |
getInputs(java.lang.String tSetID)
Returns the map of inputs of a particular
TSet |
int |
getNoOfWorkers()
No of twister2 workers
|
abstract OperationMode |
getOperationMode()
Returns the
OperationMode |
TaskExecutor |
getTaskExecutor() |
TBaseGraph |
getTSetGraph() |
WorkerEnvironment |
getWorkerEnv() |
int |
getWorkerID()
Running worker ID
|
static BatchEnvironment |
initBatch(WorkerEnvironment wEnv)
initialize the Tset environment in batch
OperationMode |
static BatchChkPntEnvironment |
initCheckpointing(WorkerEnvironment wEnv)
initialize the Tset environment for checkpointing
OperationMode |
static StreamingEnvironment |
initStreaming(WorkerEnvironment wEnv)
initialize the Tset environment in streaming
OperationMode |
boolean |
isCheckpointingEnabled()
Checks if checkpointing is enabled
|
<T> BaseTSet<T> |
parallelize(java.util.List<T> list,
int parallelism)
This method will create a source based on the list and each source will read only a part
of the list specified.
|
<K extends java.lang.Comparable,V> |
parallelize(java.util.Map<K,V> map,
int parallelism) |
<K,V> TupleTSet<K,V> |
parallelize(java.util.Map<K,V> map,
int parallelism,
java.util.Comparator<K> keyComparator) |
<T> BaseTSet<T> |
parallelize(java.lang.String name,
java.util.List<T> list,
int parallelism)
This method will create a source based on the list and each source will read only a part
of the list specified.
|
void |
setDefaultParallelism(int newDefaultParallelism)
Overrides the default parallelism.
|
void |
settBaseGraph(TBaseGraph tBaseGraph)
Sets
TBaseGraph based on the OperationMode |
protected TSetEnvironment(WorkerEnvironment wEnv)
protected TSetEnvironment()
public WorkerEnvironment getWorkerEnv()
public abstract OperationMode getOperationMode()
OperationMode
public abstract <T> BaseTSet<T> createSource(SourceFunc<T> source, int parallelism)
SourceFunc
T
- data typesource
- source functionparallelism
- parallelismpublic abstract <T> BaseTSet<T> createSource(java.lang.String name, SourceFunc<T> source, int parallelism)
T
- data typename
- name for the tsetsource
- source functionparallelism
- parallelismpublic abstract BaseTSet<java.lang.String[]> createCSVSource(java.lang.String filePath, int dataSize, int parallelism, java.lang.String type)
public abstract BaseTSet<java.lang.String> createTextSource(java.lang.String filePath, int dataSize, int parallelism, java.lang.String type)
public abstract BaseTSet<java.lang.Integer> createArrowSource(java.lang.String filePath, int parallelism)
public <T> BaseTSet<T> parallelize(java.lang.String name, java.util.List<T> list, int parallelism)
T
- data type of the listname
- name of the tsetlist
- list to be parallelizedparallelism
- no of sources to be createdpublic <T> BaseTSet<T> parallelize(java.util.List<T> list, int parallelism)
T
- data type of the listlist
- list to be parallelizedparallelism
- no of sources to be createdpublic <K extends java.lang.Comparable,V> TupleTSet<K,V> parallelize(java.util.Map<K,V> map, int parallelism)
public <K,V> TupleTSet<K,V> parallelize(java.util.Map<K,V> map, int parallelism, java.util.Comparator<K> keyComparator)
public abstract <K,V> TupleTSet<K,V> createKeyedSource(SourceFunc<Tuple<K,V>> source, int parallelism)
SourceFunc
that produces a Tuple
K
- key typeV
- value typesource
- source functionparallelism
- parallelismpublic abstract <K,V> TupleTSet<K,V> createKeyedSource(java.lang.String name, SourceFunc<Tuple<K,V>> source, int parallelism)
K
- key typeV
- value typename
- name for the tsetsource
- source functionparallelism
- parallelismpublic TBaseGraph getGraph()
public void setDefaultParallelism(int newDefaultParallelism)
newDefaultParallelism
- new parallelismpublic int getDefaultParallelism()
public Config getConfig()
public int getWorkerID()
public int getNoOfWorkers()
public boolean isCheckpointingEnabled()
public void addInput(java.lang.String tSetID, java.lang.String inputTSetID, java.lang.String inputKey)
tSetID
- TSet IDinputTSetID
- input TSet IDinputKey
- key given to the input TSetpublic java.util.Map<java.lang.String,java.lang.String> getInputs(java.lang.String tSetID)
TSet
tSetID
- TSet IDpublic static BatchEnvironment initBatch(WorkerEnvironment wEnv)
OperationMode
wEnv
- worker environmentpublic static StreamingEnvironment initStreaming(WorkerEnvironment wEnv)
OperationMode
wEnv
- worker environmentpublic static BatchChkPntEnvironment initCheckpointing(WorkerEnvironment wEnv)
OperationMode
wEnv
- worker environmentpublic void settBaseGraph(TBaseGraph tBaseGraph)
TBaseGraph
based on the OperationMode
tBaseGraph
- TBase graphprotected void executeBuildContext(BuildContext buildContext)
BuildContext
buildContext
- data flow graph wrapped by BuildContext
public TBaseGraph getTSetGraph()
public TaskExecutor getTaskExecutor()
public void close()