public abstract class MRTask2<T extends MRTask2<T>> extends DTask implements java.lang.Cloneable, jsr166y.ForkJoinPool.ManagedBlocker
map
and reduce
methods that can be
overriden to specify a computation. Several instances of this class will be
created to distribute the computation over F/J threads and machines. Non-transient
fields are copied and serialized to instances created for map invocations. Reduce
methods can store their results in fields. Results are serialized and reduced all the
way back to the invoking node. When the last reduce method has been called, fields
of the initial MRTask2 instance contains the computation results.
map
call taking required number of
NewChunks. MRTask2 will automatically close the new Appendable vecs and
produce an output frame with newly created Vecs.Modifier and Type | Field and Description |
---|---|
protected AppendableVec[] |
_appendables |
Frame |
_fr
The Vectors to work on.
|
protected Futures |
_fs
We can add more things to block on - in case we want a bunch of lazy
tasks produced by children to all end before this top-level task ends.
|
protected int |
_hi
Internal field to track a range of local Chunks to work on
|
protected T |
_left
Internal field to track the left & right sub-range of chunks to work on
|
protected int |
_lo
Internal field to track a range of local Chunks to work on
|
protected RPC<T> |
_nleft
Internal field to track the left & right remote nodes/JVMs to work on
|
protected long |
_nodes
Internal field to track a range of remote nodes/JVMs to work on
|
protected RPC<T> |
_nrite
Internal field to track the left & right remote nodes/JVMs to work on
|
protected T |
_rite
Internal field to track the left & right sub-range of chunks to work on
|
protected boolean |
_topLocal
Internal field to track if this is a top-level local call
|
_cls, _eFromNode, _exception, _fname, _lineNum, _msg, _mth
Constructor and Description |
---|
MRTask2() |
MRTask2(H2O.H2OCountedCompleter completer) |
Modifier and Type | Method and Description |
---|---|
boolean |
block()
Possibly blocks the current thread, for example waiting for
a lock or condition.
|
T |
clone()
Local Clone - setting final-field completer
|
protected void |
closeLocal()
Override to do any remote cleaning on the last remote instance of
this object, for disposing of node-local shared data structures.
|
void |
compute2()
Called from FJ threads to do local work.
|
T |
dfork(Frame fr) |
T |
dfork(int outputs,
Frame fr,
boolean run_local) |
T |
dfork(int outputs,
Vec... vecs) |
T |
dfork(Vec... vecs)
Invokes the map/reduce computation over the given Frame.
|
void |
dinvoke(H2ONode sender)
Called once on remote at top level, probably with a subset of the cloud.
|
T |
doAll(Frame fr) |
T |
doAll(Frame fr,
boolean run_local)
Invokes the map/reduce computation over the given Frame.
|
T |
doAll(int outputs,
Frame fr) |
T |
doAll(int outputs,
Frame fr,
boolean run_local) |
T |
doAll(int outputs,
Vec... vecs) |
T |
doAll(Vec... vecs)
Invokes the map/reduce computation over the given Vecs.
|
T |
getResult()
Block for & get any final results from a dfork'd MRTask2.
|
boolean |
isReleasable()
Returns
true if blocking is unnecessary. |
void |
map(Chunk c)
Override with your map implementation.
|
void |
map(Chunk[] cs)
Override with your map implementation.
|
void |
map(Chunk[] cs,
NewChunk nc) |
void |
map(Chunk[] cs,
NewChunk[] ncs) |
void |
map(Chunk[] cs,
NewChunk nc1,
NewChunk nc2) |
void |
map(Chunk c0,
Chunk c1)
Override with your map implementation.
|
void |
map(Chunk c0,
Chunk c1,
Chunk c2)
Override with your map implementation.
|
void |
map(Chunk c0,
Chunk c1,
Chunk c2,
NewChunk nc) |
void |
map(Chunk c0,
Chunk c1,
Chunk c2,
NewChunk nc1,
NewChunk nc2) |
void |
map(Chunk c0,
Chunk c1,
NewChunk nc) |
void |
map(Chunk c0,
Chunk c1,
NewChunk nc1,
NewChunk nc2) |
void |
map(Chunk c,
NewChunk nc) |
void |
onCompletion(jsr166y.CountedCompleter caller)
OnCompletion - reduce the left & right into self.
|
boolean |
onExceptionalCompletion(java.lang.Throwable ex,
jsr166y.CountedCompleter caller)
Cancel/kill all work as we can, then rethrow...
|
Frame |
outputFrame(Key key,
java.lang.String[] names,
java.lang.String[][] domains) |
Frame |
outputFrame(Key key,
java.lang.String[] names,
java.lang.String[][] domains,
Futures fs) |
Frame |
outputFrame(java.lang.String[] names,
java.lang.String[][] domains) |
protected void |
postGlobal() |
java.lang.String |
profString() |
void |
reduce(T mrt)
Override to combine results from 'mrt' into 'this' MRTask2.
|
protected void |
reduce4(T mrt)
Call user's reduction.
|
protected void |
setupLocal()
Override to do any remote initialization on the 1st remote instance of
this object, for initializing node-local shared data structures.
|
Vec |
vecs(int i)
Returns a Vec from the Frame.
|
copyOver, frozenType, getDException, hasException, logVerbose, newInstance, onAck, onAckAck, read, setException, toDocField, write, writeJSONFields
compute, priority
addToPendingCount, compareAndSetPendingCount, complete, exec, getCompleter, getPendingCount, getRawResult, setCompleter, setPendingCount, setRawResult, tryComplete
adapt, adapt, adapt, cancel, compareAndSetForkJoinTaskTag, completeExceptionally, fork, get, get, getException, getForkJoinTaskTag, getPool, getQueuedTaskCount, getSurplusQueuedTaskCount, helpQuiesce, inForkJoinPool, invoke, invokeAll, invokeAll, invokeAll, isCancelled, isCompletedAbnormally, isCompletedNormally, isDone, join, peekNextLocalTask, pollNextLocalTask, pollTask, quietlyComplete, quietlyInvoke, quietlyJoin, reinitialize, setForkJoinTaskTag, tryUnfork
public Frame _fr
protected AppendableVec[] _appendables
protected long _nodes
protected transient RPC<T extends MRTask2<T>> _nleft
protected transient RPC<T extends MRTask2<T>> _nrite
protected transient boolean _topLocal
protected transient int _lo
protected transient int _hi
protected transient T extends MRTask2<T> _left
protected transient T extends MRTask2<T> _rite
protected transient Futures _fs
public MRTask2()
public MRTask2(H2O.H2OCountedCompleter completer)
public Frame outputFrame(java.lang.String[] names, java.lang.String[][] domains)
public Frame outputFrame(Key key, java.lang.String[] names, java.lang.String[][] domains)
public Frame outputFrame(Key key, java.lang.String[] names, java.lang.String[][] domains, Futures fs)
public void map(Chunk c)
public void map(Chunk c0, Chunk c1)
public void map(Chunk c0, Chunk c1, Chunk c2)
public void map(Chunk[] cs)
public void reduce(T mrt)
protected void setupLocal()
protected void closeLocal()
public java.lang.String profString()
public final Vec vecs(int i)
public final T doAll(Vec... vecs)
public final T doAll(Frame fr, boolean run_local)
public final T dfork(Vec... vecs)
public final T getResult()
public boolean isReleasable()
jsr166y.ForkJoinPool.ManagedBlocker
true
if blocking is unnecessary.isReleasable
in interface jsr166y.ForkJoinPool.ManagedBlocker
public boolean block()
jsr166y.ForkJoinPool.ManagedBlocker
block
in interface jsr166y.ForkJoinPool.ManagedBlocker
true
if no additional blocking is necessary
(i.e., if isReleasable would return true)public final void dinvoke(H2ONode sender)
public final void compute2()
compute2
in class H2O.H2OCountedCompleter
public final void onCompletion(jsr166y.CountedCompleter caller)
onCompletion
in class jsr166y.CountedCompleter
caller
- the task invoking this method (which may
be this task itself).protected void postGlobal()
protected void reduce4(T mrt)
public final boolean onExceptionalCompletion(java.lang.Throwable ex, jsr166y.CountedCompleter caller)
onExceptionalCompletion
in class DTask
ex
- the exceptioncaller
- the task invoking this method (which may
be this task itself).public T clone()
clone
in class H2O.H2OCountedCompleter