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)CyJobSubmit aCyJobfor remote execution.fetchResults(CyJob job, CyJobData data) After aCyJobstatus returnsCyJobStatus.Status.FINISHED, this method is used to fetch the results from the job execution.Return theCyJobDataServicethat 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 theCyJobManagerto restore the job and reestablish the job with the remote service.voidsaveJobInSession(CyJob job, File sessionFile) This is method is called by theCyJobManagerto 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 theCyJobDataServicethat 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 aCyJobfor remote execution. If provided, basePath will override the path defined by theCyJob. The configurationMapprovides 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- aMapwith all of the configuration parameters necessary to submit the jobinputData- the data to be sent to the remote service.- Returns:
- the
CyJobStatusthat results from the submission. If everything is successful, this should returnCyJobStatus.Status.SUBMITTED. If an error occured, the return status should beCyJobStatus.Status.ERRORandCyJobStatus.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
CyJobStatusof the running job.
-
cancelJob
Cancel a running job.- Parameters:
job- the submitted job to be cancelled- Returns:
- the
CyJobStatusof the job after being cancelled. If everything is successful, this should returnCyJobStatus.Status#CANCELLED. If an error occured, the return status should beCyJobStatus.Status.ERRORandCyJobStatus.getMessage()method will return the error message.
-
fetchResults
After aCyJobstatus returnsCyJobStatus.Status.FINISHED, this method is used to fetch the results from the job execution.- Parameters:
job- the completed jobdata- an emptyCyJobDataobject 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.ERRORandCyJobStatus.getMessage()will return the error message.
-
saveJobInSession
This is method is called by theCyJobManagerto 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 theCyJobManagerto 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- theFilethat was written by thesaveJobInSession(CyJob, File)method described above.- Returns:
- the restored job
-