Package org.opencastproject.job.api
Interface Job
- All Known Implementing Classes:
JobImpl
public interface Job
Represents a long running, asynchronous process. A Job may be used to track any task, whether it is queued to run in
the future, currently running, or has run in the past.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumReason for failurestatic enumThe status of the job that this receipt represents -
Method Summary
Modifier and TypeMethodDescriptionThe arguments passed to the service and operation.Gets the host that created this job.Gets the username of the subject responsible for creating the job initially.The date this job was completedThe date this job was created.The date this job was started.In the case of failure, returns whether the failure had to do with data or with processing.longgetId()Gets the job identifier.Gets the job's load.Gets the job type, which determines the type of service that runs the job.The operation type, which can be used by the service responsible for the job to determine the service method to execute.Returns the identifier of the organization that the creator is associated with.Gets the parent job identifier, or null if there is no parent.Gets the serialized output that was produced by this job, or null if nothing was produced, or if it has yet to be produced.Gets the host responsible for running this job.The number of milliseconds that this job has waited in a queue before execution.Gets the root job identifier, or null if this is the root job.The number of milliseconds that this job took to execute.intGets the receipt's currentJob.StatusgetUri()Gets the URI of this job, which can be used to check its status.longGets the version of this job.booleanGets whether this job may be dispatched.voidsetArguments(List<String> arguments) voidsetCreator(String creator) voidsetDateCompleted(Date dateCompleted) voidsetDateCreated(Date created) voidsetDateStarted(Date started) voidsetDispatchable(boolean dispatchable) voidsetJobLoad(Float load) voidsetJobType(String jobType) voidsetOperation(String operation) voidsetOrganization(String organization) voidsetParentJobId(Long parentJobId) voidsetPayload(String payload) voidsetProcessingHost(String processingHost) voidsetQueueTime(Long queueTime) voidsetRunTime(Long runTime) voidsetStatus(Job.Status status) voidsetStatus(Job.Status status, Job.FailureReason reason) Sets the receipt's currentJob.Statusalong with theJob.FailureReasonto indicate why - in the case of failure - the job failed.
-
Method Details
-
getId
long getId()Gets the job identifier.- Returns:
- the identifier
-
getCreator
String getCreator()Gets the username of the subject responsible for creating the job initially. This job will execute with this user's roles and permissions.- Returns:
- the username that created the job
-
setCreator
-
getOrganization
String getOrganization()Returns the identifier of the organization that the creator is associated with.- Returns:
- the organization
-
setOrganization
-
getVersion
long getVersion()Gets the version of this job. Each time the job is updated, the version number is incremented. If a process attempts to save a job that has been updated in another thread or on another host while the job was in memory, an optimistic locking exception will be thrown.- Returns:
- the version number of this job
-
getJobType
String getJobType()Gets the job type, which determines the type of service that runs the job.- Returns:
- the job type
-
setJobType
-
getOperation
String getOperation()The operation type, which can be used by the service responsible for the job to determine the service method to execute.- Returns:
- The operation
-
setOperation
-
getArguments
The arguments passed to the service and operation. Each argument must be serializable to a string.- Returns:
- the arguments passed to the service operation
-
setArguments
-
getStatus
Job.Status getStatus()Gets the receipt's currentJob.Status- Returns:
- the current status
-
setStatus
-
setStatus
Sets the receipt's currentJob.Statusalong with theJob.FailureReasonto indicate why - in the case of failure - the job failed.- Parameters:
status- the status to setreason- failure reason
-
getFailureReason
Job.FailureReason getFailureReason()In the case of failure, returns whether the failure had to do with data or with processing. Depending on the reason, processing services might be marked not to accept new jobs.- Returns:
- the failure reason
-
getCreatedHost
String getCreatedHost()Gets the host that created this job.- Returns:
- the server that originally created the job
-
getProcessingHost
String getProcessingHost()Gets the host responsible for running this job.- Returns:
- the server running the job, or null if the job hasn't yet started
-
setProcessingHost
-
getDateCreated
Date getDateCreated()The date this job was created.- Returns:
- the date the job was created
-
setDateCreated
-
getDateStarted
Date getDateStarted()The date this job was started. If the job was queued, this can be significantly later than the date created.- Returns:
- the date the job was started
-
setDateStarted
-
getQueueTime
Long getQueueTime()The number of milliseconds that this job has waited in a queue before execution. This value will be null if the job has not yet started execution.- Returns:
- the total run time
-
setQueueTime
-
getRunTime
Long getRunTime()The number of milliseconds that this job took to execute. This value will be null if the job has not yet finished execution.- Returns:
- the total run time
-
setRunTime
-
getDateCompleted
Date getDateCompleted()The date this job was completed- Returns:
- the date completed
-
setDateCompleted
-
getPayload
String getPayload()Gets the serialized output that was produced by this job, or null if nothing was produced, or if it has yet to be produced.- Returns:
- the output of the job
-
setPayload
-
getSignature
int getSignature()- Returns:
-
getParentJobId
Long getParentJobId()Gets the parent job identifier, or null if there is no parent.- Returns:
- the parent identifier
-
setParentJobId
-
getRootJobId
Long getRootJobId()Gets the root job identifier, or null if this is the root job.- Returns:
- the root job identifier
-
isDispatchable
boolean isDispatchable()Gets whether this job may be dispatched.- Returns:
- whether the job can be queued for dispatch or not
-
setDispatchable
void setDispatchable(boolean dispatchable) -
getUri
URI getUri()Gets the URI of this job, which can be used to check its status.- Returns:
- the job's URI
-
getJobLoad
Float getJobLoad()Gets the job's load. For example, a job which uses four cores would have a load of 4.0. This should be roughly the number of cores that this job occupies while running.- Returns:
- the job's load
-
setJobLoad
-