Interface CyJobManager


  • public interface CyJobManager
    CyJobManager is responsible for managing all currently running CyJobs, including polling for changes in the Status of the job and notifying the CyJobMonitor provided by the App of the change in status. The CyJobManager also is responsible for calling CyJobExecutionService.saveJobInSession(CyJob, java.io.File) as part of session saving and CyJobExecutionService.restoreJobFromSession(org.cytoscape.session.CySession, java.io.File) when a session is loaded.

    Module: jobs-api

    To use this in your app, include the following dependency in your POM:

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>jobs-api</artifactId>
    </dependency>

    Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
    • Method Detail

      • getJobs

        List<CyJob> getJobs()
        Return the list of CyJobs currently managed by the CyJobManager.
        Returns:
        the list of CyJobs
      • cancelJob

        CyJobStatus cancelJob​(CyJob job)
        Cancel the specified job
        Parameters:
        job - the job to be canceled
        Returns:
        the job status of the canceled job
      • addJob

        void addJob​(CyJob job,
                    CyJobMonitor jobMonitor,
                    int pollInterval)
        Add a job to be managed by the job manager. If the jobMonitor is specified, then that jobMonitor will be called if the job completes or fails
        Parameters:
        job - the CyJob to add to the list of managed jobs
        jobMonitor - the CyJobMonitor to be called if this job completes or fails. If this is null, the name of the job handler defined in the job is used (through OSGi services)
        pollInterval - the number of seconds between poll attempts. If 0 or -1 the pollInterval defined in the job is used.
      • removeJob

        void removeJob​(CyJob job)
        Remove a job from being managed by the job manager.
        Parameters:
        job - the CyJob to remove from the list of managed jobs
      • associateMonitor

        void associateMonitor​(CyJob job,
                              CyJobMonitor jobMonitor,
                              int pollInterval)
        Associate a monitor with a job. This method is used primarily by apps to reassociate with jobs after session loading.
        Parameters:
        job - the job to associate to
        jobMonitor - the job monitor that should be called when the job completes
        pollInterval - the polling interval. If this is -1, the polling interval from the CyJob will be used.
      • associateMonitor

        void associateMonitor​(CyJob job,
                              String jobMonitorName,
                              int pollInterval)
        Associate a handler with a job. This method is used primarily by CyJobExecutionServices to reassociate with jobs after session loading.
        Parameters:
        job - the job to associate to
        jobMonitorName - the name of the job handler that should be called when the job completes
        pollInterval - the polling interval. If this is -1, the polling interval from the CyJob will be used.