Package org.cytoscape.jobs
Interface CyJobExecutionService
-
public interface CyJobExecutionServiceTheCyJobExecutionServiceis 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 appropriateCyJobDataServiceto handle marshalling and unmarshalling of data. It is usually the case that the impelementors of theCyJobExecutionServicewill also provide implementations ofCyJob
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CyJobStatuscancelJob(CyJob job)Cancel a running job.CyJobStatuscheckJobStatus(CyJob job)Check on the status of a running job.CyJobcreateCyJob(String name)Create an empty (unsubmitted)CyJobCyJobStatusexecuteJob(CyJob job, String basePath, Map<String,Object> configuration, CyJobData inputData)Submit aCyJobfor remote execution.CyJobStatusfetchResults(CyJob job, CyJobData data)After aCyJobstatus returnsCyJobStatus.Status.FINISHED, this method is used to fetch the results from the job execution.CyJobDataServicegetDataService()Return theCyJobDataServicethat is used by service to marshall and unmarshall data for the remote service.StringgetServiceName()The name of the service.CyJobrestoreJobFromSession(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 Detail
-
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
CyJob createCyJob(String name)
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
CyJobStatus checkJobStatus(CyJob job)
Check on the status of a running job.- Parameters:
job- the submitted job to be checked- Returns:
- the
CyJobStatusof the running job.
-
cancelJob
CyJobStatus cancelJob(CyJob job)
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
CyJobStatus fetchResults(CyJob job, CyJobData data)
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
void saveJobInSession(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. It should not be called directly by client apps.- Parameters:
job- the job to be saved in the sesion filesessionFile-
-
restoreJobFromSession
CyJob restoreJobFromSession(CySession session, File sessionFile)
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
-
-