OmeroBlitz API
Home Previous Up Next Index

omero::api::JobHandle

Overview

[ "ami", "amd" ] interface JobHandle extends StatefulServiceInterface

Allows submission of asynchronous jobs.

NOTE: The calling order for the service is as follows:

  1. {@code submit} or {@code attach}
  2. any of the other methods
  3. {@code close}

Calling {@code close} does not cancel or otherwise change the Job state. See {@code cancelJob}.

Operation Index

submit
Submits a model::Job and returns its database id.
attach
Returns the current model::JobStatus for the Job id.
getJob
Returns the current model::Job
jobStatus
Returns the current model::JobStatus.
jobFinished
Returns null if the model::Job is not finished, otherwise the RTime for when it completed.
jobMessage
Returns the current message for job.
jobRunning
Returns true if the model::Job is running, i.e.
jobError
Returns true if the model::Job has thrown an error.
cancelJob
Marks a job for cancellation.
setStatus
Updates the model::JobStatus for the current job.
setMessage
Sets the job's message string, and returns the previous value.
setStatusAndMessage
Like {@code setStatus} but also sets the message.

Operations

long submit(model::Job job) throws ServerError

Submits a model::Job and returns its database id. The only fields directly on status which are editable are message, scheduledFor and status. The latter two must be sensible.

Parameters

job
Not null

model::JobStatus attach(long jobId) throws ServerError

Returns the current model::JobStatus for the Job id.

Exceptions

ApiUsageException
if the model::Job does not exist.

model::Job getJob() throws ServerError

Returns the current model::Job

model::JobStatus jobStatus() throws ServerError

Returns the current model::JobStatus. Will never return null.

RTime jobFinished() throws ServerError

Returns null if the model::Job is not finished, otherwise the RTime for when it completed.

string jobMessage() throws ServerError

Returns the current message for job. May be set during processing.

bool jobRunning() throws ServerError

Returns true if the model::Job is running, i.e. has an attached process.

bool jobError() throws ServerError

Returns true if the model::Job has thrown an error.

void cancelJob() throws ServerError

Marks a job for cancellation. Not every processor will check for the cancelled flag for a running job, but no non-running job will start if it has been cancelled.

string setStatus(string status) throws ServerError

Updates the model::JobStatus for the current job. The previous status is returned as a string. If the status is {@code CANCELLED}, this method is equivalent to {@code cancelJob}.

string setMessage(string message) throws ServerError

Sets the job's message string, and returns the previous value.

Return Value

the previous message value

string setStatusAndMessage(string status, RString message) throws ServerError

Like {@code setStatus} but also sets the message.


Home Previous Up Next Index