Package ai.djl.serving.workflow
Class Workflow
java.lang.Object
ai.djl.serving.workflow.Workflow
- All Implemented Interfaces:
AutoCloseable
A flow of executing
Model
s and custom functions.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An argument that is passed to aWorkflowFunction
.final class
An executor is a session for a runningWorkflow
. -
Field Summary
-
Constructor Summary
ConstructorDescriptionWorkflow
(ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input, ai.djl.modality.Output> wpc) Constructs a workflow containing only a single workerPoolConfig.Workflow
(String name, String version, Map<String, ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input, ai.djl.modality.Output>> wpcs, Map<String, WorkflowExpression> expressions, Map<String, Map<String, Object>> configs, Map<String, WorkflowFunction> funcs) Constructs a workflow. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
CompletableFuture<ai.djl.modality.Output>
execute
(ai.djl.serving.wlm.WorkLoadManager wlm, ai.djl.modality.Input input) Executes a workflow with an input.getName()
Returns the workflow name.Returns the workflow version.Returns the wpc map in the workflow.Collection<ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input,
ai.djl.modality.Output>> getWpcs()
Returns theWorkerPoolConfig
s used in the workflow.int
hashCode()
void
prepare
(ai.djl.serving.wlm.WorkLoadManager wlm) Prepares this workflow for use.toString()
-
Field Details
-
IN
- See Also:
-
OUT
- See Also:
-
-
Constructor Details
-
Workflow
public Workflow(ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input, ai.djl.modality.Output> wpc) Constructs a workflow containing only a single workerPoolConfig.- Parameters:
wpc
- the workerPoolConfig for the workflow
-
Workflow
public Workflow(String name, String version, Map<String, ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input, ai.djl.modality.Output>> wpcs, Map<String, WorkflowExpression> expressions, Map<String, Map<String, Object>> configs, Map<String, WorkflowFunction> funcs) Constructs a workflow.- Parameters:
name
- workflow nameversion
- workflow versionwpcs
- a map of executableNames for a wpc (how it is referred to in theWorkflowExpression
s to modelexpressions
- a map of names to refer to an expression to the expressionconfigs
- the configuration objectsfuncs
- the custom functions used in the workflow
-
-
Method Details
-
getWpcs
public Collection<ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input,ai.djl.modality.Output>> getWpcs()Returns theWorkerPoolConfig
s used in the workflow.- Returns:
- the wpcs used in the workflow
-
getWpcMap
public Map<String,ai.djl.serving.wlm.WorkerPoolConfig<ai.djl.modality.Input, getWpcMap()ai.djl.modality.Output>> Returns the wpc map in the workflow.- Returns:
- the wpc map in the workflow
-
prepare
public void prepare(ai.djl.serving.wlm.WorkLoadManager wlm) Prepares this workflow for use.This is idempotent and can be safely re-called if this is already prepared. It should re-call to ensure preparedness.
- Parameters:
wlm
- the wlm to prepare with
-
execute
public CompletableFuture<ai.djl.modality.Output> execute(ai.djl.serving.wlm.WorkLoadManager wlm, ai.djl.modality.Input input) Executes a workflow with an input.- Parameters:
wlm
- the wlm to run the workflow withinput
- the input- Returns:
- a future of the result of the execution
-
getName
Returns the workflow name.- Returns:
- the workflow name
-
getVersion
Returns the workflow version.- Returns:
- the workflow version
-
equals
-
hashCode
public int hashCode() -
toString
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-