Package ai.djl.serving.wlm
Class Job<I,O>
java.lang.Object
ai.djl.serving.wlm.Job<I,O>
A class represents an inference job.
-
Constructor Summary
ConstructorsConstructorDescriptionJob(WorkerPoolConfig<I, O> wpc, I input) Constructs a newJobinstance.Job(WorkerPoolConfig<I, O> wpc, I input, JobFunction<I, O> runner) Constructs a newJobinstance. -
Method Summary
Modifier and TypeMethodDescriptiongetInput()Returns the input data.Returns the output data.Returns the task to run for the job.longReturns the wait time of this job.getWpc()Returns the worker pool config that is associated with this job.static <I,O> void runAll(List<Job<I, O>> jobs, JobFunction<I, O> f) Runs aJobFunctionon a batch of jobs and sets the result in their output.static voidsetFailOutput(Job<ai.djl.modality.Input, ai.djl.modality.Output> job, int code, String message) Sets aJoboutput to a failure.voidSets the output of the job.
-
Constructor Details
-
Job
Constructs a newJobinstance.- Parameters:
wpc- the model to run the jobinput- the input data
-
Job
Constructs a newJobinstance.- Parameters:
wpc- the model to run the jobinput- the input datarunner- the function to run on worker
-
-
Method Details
-
runAll
public static <I,O> void runAll(List<Job<I, O>> jobs, JobFunction<I, throws ai.djl.translate.TranslateExceptionO> f) Runs aJobFunctionon a batch of jobs and sets the result in their output.- Type Parameters:
I- the input typeO- the output type- Parameters:
jobs- the jobs to run and updatef- the function to run- Throws:
ai.djl.translate.TranslateException- if the jobs fail to run
-
setFailOutput
public static void setFailOutput(Job<ai.djl.modality.Input, ai.djl.modality.Output> job, int code, String message) Sets aJoboutput to a failure.- Parameters:
job- the job to set the output oncode- the failure codemessage- the failure message
-
getWpc
Returns the worker pool config that is associated with this job.- Returns:
- the worker pool config that is associated with this job
-
getInput
Returns the input data.- Returns:
- the input data
-
getOutput
Returns the output data.- Returns:
- the output data
-
setOutput
Sets the output of the job.- Parameters:
output- the job output
-
getWaitingMicroSeconds
public long getWaitingMicroSeconds()Returns the wait time of this job.- Returns:
- the wait time of this job in mirco seconds
-
getRunner
Returns the task to run for the job.- Returns:
- the task to run for the job
-