public class Job extends Object implements Comparable<Job>
Modifier and Type | Class and Description |
---|---|
static class |
Job.Priority |
static class |
Job.Status |
Constructor and Description |
---|
Job()
Create an empty representation of a job.
|
Job(Job oldJob,
JobStorage newStorage)
Creates a new job based on an old job.
|
Job(Node jobXml)
Parse the job described by the provided XML document/node.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Job o) |
Argument |
getArgument(String name) |
List<Argument> |
getArguments()
Get all arguments, both inputs and outputs.
|
String |
getBatchId() |
List<Callback> |
getCallback() |
String |
getDescription() |
String |
getHref() |
String |
getId() |
List<Argument> |
getInputs() |
JobStorage |
getJobStorage() |
String |
getLogHref() |
List<Message> |
getMessages()
Get a list of all messages for the job.
|
List<Message> |
getMessages(int maxDepth)
Get a list of all messages for the job.
|
String |
getNicename() |
List<Argument> |
getOutputs() |
Job.Priority |
getPriority() |
BigDecimal |
getProgress() |
double |
getProgressEstimate()
Get the estimated job progress in between server updates as a percentage.
|
double |
getProgressEstimate(Integer timeUntilUpdateRequest) |
double |
getProgressFrom()
Get the job progress as a percentage.
|
Long |
getProgressFromTime()
Get the time when the most up to date progress information from the server was received.
|
double |
getProgressTo()
Get the end of the current progress interval as a percentage.
|
double |
getProgressTo(Integer timeUntilUpdateRequest) |
Integer |
getQueuePosition() |
Result |
getResult()
Get the main Result object.
|
Result |
getResult(String argumentName)
Get the Result representing the argument with the given name.
|
Result |
getResult(String argumentName,
String href)
Get the Result representing the file with the given name from the argument with the given name.
|
static Result |
getResultFromHref(Node resultsXml,
String href)
Given the absolute href for the result, get the result without parsing the entire jobXml.
|
Result |
getResultFromHref(String href)
Get a result object for the result with the given absolute or relative href.
|
SortedMap<Result,List<Result>> |
getResults()
Get a map of all the Result objects.
|
List<Result> |
getResults(String argumentName)
Get the list of Results for the argument with the given name.
|
Script |
getScript() |
String |
getScriptHref() |
Job.Status |
getStatus() |
void |
joinMessages(Job jobUpdate)
Update this job's messages with a list of new messages from a job update.
|
static List<Job> |
parseJobsXml(Node jobsXml)
Parse the list of jobs described by the provided XML document/node.
|
void |
setBatchId(String batchId) |
void |
setCallback(List<Callback> callback) |
void |
setDescription(String description) |
void |
setHref(String href) |
void |
setId(String id) |
void |
setInputs(List<Argument> argumentInputs) |
void |
setJobStorage(JobStorage storage) |
void |
setJobXml(Node jobXml)
Set job XML and re-enable lazy loading for the new XML.
|
void |
setLogHref(String logHref) |
void |
setNicename(String nicename) |
void |
setOutputs(List<Argument> argumentOutputs) |
void |
setPriority(Job.Priority priority) |
void |
setProgress(BigDecimal progress) |
void |
setQueuePosition(Integer queuePosition) |
void |
setResults(Result result,
SortedMap<Result,List<Result>> results) |
void |
setScript(Script script) |
void |
setScriptHref(String scriptHref) |
void |
setStatus(Job.Status status) |
Document |
toJobRequestXml(boolean absoluteUris)
Create jobRequest XML.
|
String |
toString() |
Document |
toXml() |
String |
validate()
Check that all the inputs and options is filled out properly.
|
String |
validate(String name)
Check that the argument with then provided name is filled out properly.
|
public Job()
public Job(Node jobXml) throws Pipeline2Exception
jobXml
- The XMLPipeline2Exception
- thrown when an error occurspublic Job(Job oldJob, JobStorage newStorage) throws Pipeline2Exception
oldJob
- The old job where arguments will be copied fromnewStorage
- The new job storage where files will be storedPipeline2Exception
public static Result getResultFromHref(Node resultsXml, String href)
resultsXml
- The XMLhref
- The hrefpublic List<Message> getMessages()
public List<Message> getMessages(int maxDepth)
maxDepth
- Don't return messages deeper than this levelpublic Result getResult()
public Result getResult(String argumentName)
argumentName
- The name of the argumentpublic Result getResult(String argumentName, String href)
argumentName
- The name of the argumenthref
- filename with path relative to the argument.public List<Result> getResults(String argumentName)
argumentName
- The name of the argumentpublic SortedMap<Result,List<Result>> getResults()
public static List<Job> parseJobsXml(Node jobsXml) throws Pipeline2Exception
jobsXml
- The XMLPipeline2Exception
- thrown when an error occurspublic String validate()
public String validate(String name)
name
- The name of the parameter to validatepublic String getId()
public String getHref()
public Job.Status getStatus()
public Job.Priority getPriority()
public Integer getQueuePosition()
public String getNicename()
public String getDescription()
public String getBatchId()
public Script getScript()
public String getScriptHref()
public BigDecimal getProgress()
public String getLogHref()
public JobStorage getJobStorage()
public void setId(String id)
public void setHref(String href)
public void setStatus(Job.Status status)
public void setPriority(Job.Priority priority)
public void setQueuePosition(Integer queuePosition)
public void setNicename(String nicename)
public void setDescription(String description)
public void setBatchId(String batchId)
public void setScript(Script script)
public void setScriptHref(String scriptHref)
public void setProgress(BigDecimal progress)
public void setLogHref(String logHref)
public void setJobStorage(JobStorage storage)
public void joinMessages(Job jobUpdate)
public void setJobXml(Node jobXml)
jobXml
- The XMLpublic int compareTo(Job o)
compareTo
in interface Comparable<Job>
public Result getResultFromHref(String href)
href
- if relative, must be relative to the top-level `…/results/` URL segment.public Document toXml()
public Document toJobRequestXml(boolean absoluteUris)
absoluteUris
- base directory for filespublic List<Argument> getArguments()
public double getProgressFrom()
public Long getProgressFromTime()
public double getProgressTo()
public double getProgressTo(Integer timeUntilUpdateRequest)
timeUntilUpdateRequest
- The time until the next update request is expected, in nanoseconds.public double getProgressEstimate()
public double getProgressEstimate(Integer timeUntilUpdateRequest)
timeUntilUpdateRequest
- The time until the next update request is expected, in nanoseconds.Copyright © 2012–2022 The DAISY Consortium. All rights reserved.