Package org.cytoscape.jobs
Interface CyJobExecutionService
public interface CyJobExecutionService
The
CyJobExecutionService
is a stateless service that can be used to provide
remote job services, including the execution, cancellation, status checking, and retrieval
of results. Implementations of this service should also choose the appropriate
CyJobDataService
to handle marshalling and unmarshalling of data. It is usually
the case that the impelementors of the CyJobExecutionService
will also provide
implementations of CyJob
-
Method Summary
Modifier and TypeMethodDescriptionCancel a running job.checkJobStatus
(CyJob job) Check on the status of a running job.createCyJob
(String name) Create an empty (unsubmitted)CyJob
Submit aCyJob
for remote execution.fetchResults
(CyJob job, CyJobData data) After aCyJob
status returnsCyJobStatus.Status.FINISHED
, this method is used to fetch the results from the job execution.Return theCyJobDataService
that is used by service to marshall and unmarshall data for the remote service.The name of the service.restoreJobFromSession
(CySession session, File sessionFile) This is method is called by theCyJobManager
to restore the job and reestablish the job with the remote service.void
saveJobInSession
(CyJob job, File sessionFile) This is method is called by theCyJobManager
to save sufficient information as part of the session to be able to restore and reestablish the job with the remote service.
-
Method Details
-
getServiceName
String getServiceName()The name of the service. This is usually the classname and is the name that should be registered with OSGi.- Returns:
- the service name
-
getDataService
CyJobDataService getDataService()Return theCyJobDataService
that is used by service to marshall and unmarshall data for the remote service.- Returns:
- the data service used
-
createCyJob
Create an empty (unsubmitted)CyJob
- Parameters:
name
- the name of the job- Returns:
- the empty (not yet submitted)
CyJob
-
executeJob
CyJobStatus executeJob(CyJob job, String basePath, Map<String, Object> configuration, CyJobData inputData) Submit aCyJob
for remote execution. If provided, basePath will override the path defined by theCyJob
. The configurationMap
provides any arguments necessary to successfully submit the job with the appropriate inputData.- Parameters:
job
- the job to be submittedbasePath
- if provided, this will override the path defined by theCyJob
.configuration
- aMap
with all of the configuration parameters necessary to submit the jobinputData
- the data to be sent to the remote service.- Returns:
- the
CyJobStatus
that results from the submission. If everything is successful, this should returnCyJobStatus.Status.SUBMITTED
. If an error occured, the return status should beCyJobStatus.Status.ERROR
andCyJobStatus.getMessage()
method will return the error message.
-
checkJobStatus
Check on the status of a running job.- Parameters:
job
- the submitted job to be checked- Returns:
- the
CyJobStatus
of the running job.
-
cancelJob
Cancel a running job.- Parameters:
job
- the submitted job to be cancelled- Returns:
- the
CyJobStatus
of the job after being cancelled. If everything is successful, this should returnCyJobStatus.Status#CANCELLED
. If an error occured, the return status should beCyJobStatus.Status.ERROR
andCyJobStatus.getMessage()
method will return the error message.
-
fetchResults
After aCyJob
status returnsCyJobStatus.Status.FINISHED
, this method is used to fetch the results from the job execution.- Parameters:
job
- the completed jobdata
- an emptyCyJobData
object that will be filled with the results of the job execution.- Returns:
- the status after pulling the data back. If an error occured, the return status
should be
CyJobStatus.Status.ERROR
andCyJobStatus.getMessage()
will return the error message.
-
saveJobInSession
This is method is called by theCyJobManager
to save sufficient information as part of the session to be able to restore and reestablish the job with the remote service. It should not be called directly by client apps.- Parameters:
job
- the job to be saved in the sesion filesessionFile
-
-
restoreJobFromSession
This is method is called by theCyJobManager
to restore the job and reestablish the job with the remote service. It should not be called directly by client apps.- Parameters:
session
- the session that is being restoredsessionFile
- theFile
that was written by thesaveJobInSession(CyJob, File)
method described above.- Returns:
- the restored job
-