public class PersistingContext extends ForwardingEvalContext
EvalContext
that serializes and persist tasks. Any call to EvalContext.evaluate(Task)
will persist the task and recurse to also do so for all input tasks. No task in the dependency
tree will actually be invoked. Instead EvalContext.evaluate(Task)
will return a Value
that
always fails.
After the returned Value
has failed, all persisted file paths can be received through
getFiles()
.
EvalContext.Promise<T>, EvalContext.Value<T>
delegate
Constructor and Description |
---|
PersistingContext(Path basePath,
EvalContext delegate) |
Modifier and Type | Method and Description |
---|---|
<T> EvalContext.Value<T> |
evaluateInternal(Task<T> task,
EvalContext context)
A variant of
EvalContext.evaluate(Task) that allows the caller to specify the EvalContext
that should be used within the graph during evaluation. |
Map<TaskId,Path> |
getFiles() |
<T> EvalContext.Value<T> |
invokeProcessFn(TaskId taskId,
Fn<T> processFn)
Invoke the process function of a task.
|
immediateValue, listener, promise, value
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
async, currentTask, evaluate, sync
public PersistingContext(Path basePath, EvalContext delegate)
public <T> EvalContext.Value<T> evaluateInternal(Task<T> task, EvalContext context)
EvalContext
EvalContext.evaluate(Task)
that allows the caller to specify the EvalContext
that should be used within the graph during evaluation.
This is intended to be called from EvalContext
implementations that form a
composition of other contexts.
evaluateInternal
in interface EvalContext
evaluateInternal
in class ForwardingEvalContext
T
- The type of the task resulttask
- The task to evaluatecontext
- The context to use in further evaluationpublic <T> EvalContext.Value<T> invokeProcessFn(TaskId taskId, Fn<T> processFn)
EvalContext
This method will be called when the process function of a task is ready to be invoked. This
gives this EvalContext
the responsibility of invoking user code. By overriding this
method, one can intercept the evaluation flow just at the moment between inputs being ready
and when the user supplied function for task processing is being invoked.
The default implementation will simply invoke the function immediately inside a
EvalContext.Value
created by EvalContext.value(Fn)
.
invokeProcessFn
in interface EvalContext
invokeProcessFn
in class ForwardingEvalContext
T
- The task value typetaskId
- The id of the task being invokedprocessFn
- A lazily evaluated handle to the process functionCopyright © 2020. All rights reserved.