See: Description
Interface | Description |
---|---|
CyJob |
A
CyJob represents all of the state information necessary to
marshal and unmarshal data, submit jobs, query job status, and fetch
results. |
CyJobData |
CyJobData presents a general interface to sending data to and receiving
data from a job.
|
CyJobDataService |
The main interface for the marshalling and unmarshalling
of data to be exchanged with remote services.
|
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. |
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. |
CyJobMonitor |
Apps are expected to implement this interface to receive notifications
about job completions.
|
Class | Description |
---|---|
AbstractCyJob |
This can be used as a base class for custom implementations of
CyJob |
CyJobStatus |
This object stores information about the status of a
CyJob , including
the actual job status (CyJobStatus.Status ) and any message returned
from the remote execution. |
SUIDUtil |
This utility class provides methods to save and restore SUIDs that
are sent to remote execution environments across sessions.
|
Enum | Description |
---|---|
CyJobStatus.Status |
This enum contains the primary status returned from the remote execution.
|
There are three main components of an implementation of a remote job:
CyJobExecutionService
, which provides communication
with the remote service. The CyJobExecutionService
is responsible for
creating (and implementing) the CyJob
object, which is the object that maintains
the state of the remote job and gets serialized and deserialized in sessions. Implementations
of CyJobExecutionService
should store enough information in their CyJob
object to restore the state of the job across sessions. Note that
CyJobExecutionServices
are, in fact, services. That is, there is expected to be one service running for all
jobs and all uses. As such, implementations of CyJobExecutionService
should not
store any state.CyJobDataService
, which provides the marshalling and
unmarshalling of the data. The CyJobDataService
is responsible for
creating and implementing the CyJobData
object, which contains all of the
data to be sent to the remote service. Typically, a CyJobExecutionService
will use a particular CyJobDataService
that works with it's remote service.
A given CyJobDataService
might be used by multiple
CyJobExecutionServices
.
As noted above, implementations of CyJobDataService
are also services and should
not store any state. If the implementation provides methods to serialize
CyNetworks
,
CyTables
or
CyNetworkViews
, it may need to save the SUIDs of those
objects to be able to restore them after session restore (SUIDs are not preserved
across sessions). To assist with this, a utility class SUIDUtil
is provided.CyJobExecutionService
, implement a
org.cytoscape.jobs.CyJobHandler
to listen for status changes in jobs and when the job is complete
load the data and merge it into Cytoscape (if appropriate).CyJobExecutionService
it is interested
in utilizing.CyJob
by calling
getCyJob
method.org.cytoscape.jobs.CyJobHandler
to be
notified of changes in the job statusCyJobDataService
from the
CyJobExecutionService
and add any data necessary to submit the job.executeJob
,
where:
CyJob
is the empty job that was created in step #2String
, if not null will override the basePath
in the CyJob
for establishing a connection to the remote servicMap
contains any configuration information required to execute the
job. This might include authentication credentials or algorithm options.CyJobData
is the data to be serialized and sent as input
for the remote jobCyJobStatus
indicates that the submission was successful, the
job should be added to the CyJobManager
(org.cytoscape.jobs.CyJobManager#addJob(org.cytoscape.jobs.CyJob, org.cytoscape.jobs.CyJobHandler, int)
).CyJobManager
will call
CyJobExecutionService.checkJobStatus(org.cytoscape.jobs.CyJob)
and report the results to the App's org.cytoscape.jobs.CyJobHandler
Task
is executed
by the TaskManager
. The Task
will call
org.cytoscape.jobs.CyJobHandler#loadData(org.cytoscape.jobs.CyJob, org.cytoscape.work.TaskMonitor)
method to actually load the data. This is done within the context of a Cytoscape Task
so that the standard mechanisms in Cytoscape for reporting progress to the user and avoid threading issues are
utilized.
While the above describes the normal workflow, there are a couple of things that might happen that will deviate from this workflow:
CyJobStatus.Status
). The
CyJobManager
notes the error and the user is informed in GUI.CyJob
to be saved in the session by calling the
CyJobExecutionService.saveJobInSession(org.cytoscape.jobs.CyJob, java.io.File)
method.CyJobManager
will call
CyJobExecutionService.restoreJobFromSession(org.cytoscape.session.CySession, java.io.File)
method to restore the session, reestablish the org.cytoscape.jobs.CyJobHandler
(assuming that it's registered),
and resuming the polling of the job.
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.