Package dev.dokimos.core
Interface AsyncTask
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A non-blocking task that produces a
TaskResult asynchronously.
It returns a CompletableFuture so suspend-based or reactive callers (for example Koog
agents or Reactor pipelines) can drive an experiment without blocking a thread per example. The
completed future carries a TaskResult, so call metrics flow through to each
ItemResult as they do for MeasuredTask.
Set an async task on an experiment via Experiment.Builder.asyncTask(AsyncTask). When an
async task is configured the experiment runs through a dedicated bounded async execution path
(see Experiment.Builder.parallelism(int) for the in-flight cap); otherwise the
synchronous sequential or parallel paths are used.
-
Method Summary
Modifier and TypeMethodDescriptionRuns the task on the givenExampleand returns a future of its result.
-
Method Details
-
run
Runs the task on the givenExampleand returns a future of its result.- Parameters:
example- the example containing inputs and expected outputs- Returns:
- a future that completes with the task result, or completes exceptionally if the task
fails (a failed future is isolated as a failed
ItemResult, the run continues)
-