Package net.sf.basedb.opengrid.service
Interface JobCompletionHandler
- All Superinterfaces:
Action
Callback interface when a job has been completed on an Open Grid cluster.
The extension point is "net.sf.basedb.opengrid.job-complete". A typical
implementation need to implement this interface and also an
ActionFactory
.
The ActionFactory.prepareContext(InvokationContext)
method is called with only a
session control available (the ROOT user is logged in). The context may be used
for completing multiple jobs. The ActionFactory.getActions(InvokationContext)
may be called multiple times. The job is set as the current item, and the
JobStatus
is available as the "job-status" attribute. It is recommended
that the getAction()
method make some checks and only return
actions if the extension is actually going to handle the job. Note that
the extension point is called both for successful and failed jobs! Check
the JobStatus
before deciding what to do.
If the action factory create actions a new impersonated session control
is created. The logged in user is set to the owner of the job and
if the job has an active project it is activated. If the action need to
make changes to the database it must create a DbControl itself. The actions
SHOULD NOT change the job item since that will be handled by the service.- Since:
- 1.0
- Author:
- nicklas
-
Method Summary
Modifier and TypeMethodDescriptionjobCompleted
(SessionControl sc, OpenGridSession session, Job job, JobStatus status) Called when the job has been completed (successful or failed).
-
Method Details
-
jobCompleted
Called when the job has been completed (successful or failed). The handler should return a message with some useful information about the job. The handler may throw an exception in case there is a problem. If it do, the job status will be changed to ERROR and no more handlers are called.- Parameters:
sc
- A session control with the owner of the job logged in and the same project active (if any)session
- An open session to the cluster that executed the jobjob
- The job as it is represented in BASE (do not change!)status
- Status information about the job from the cluster- Returns:
- A status message the will be saved to
Job.getStatusMessage()
-