MoleQueue JSON-RPC Implementation

From wiki.openchemistry.org
Revision as of 08:25, 4 May 2012 by Dlonie (talk | contribs) (Created page with "== Language, backends == The MoleQueue JSON-RPC implemention is written in C++, using the [http://jsoncpp.sourceforge.net/ JsonCpp] parsers. It exposes a [http://qt.nokia.com...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Language, backends

The MoleQueue JSON-RPC implemention is written in C++, using the JsonCpp parsers. It exposes a Qt 4 interface that provides interprocess communication through a local socket with a visible Qt signal/slot interface.

Components

The implementation consists of the following classes:

MoleQueue::JsonRpc

Internal class used to generate and handle JSON-RPC requests, responses, and notifications as described in the MoleQueue JSON-RPC Specification.

MoleQueue::MoleQueueClient

Client interface providing methods for requesting and monitoring calculations. This class generates and manages JobRequest objects, which are state objects that define a single job's configuration.

Methods:

  • JobRequest & newJobRequest(): Creates and registers a new JobRequest object with this client.
  • bool submitJobRequest(JobRequest &): Submit a JobRequest to the MoleQueue server.
  • bool cancelJobRequest(JobRequest &): Cancel a JobRequest that has been submitted to the MoleQueue server.

MoleQueue::JobRequest

Class describing a single job from the client's side.

Methods:

  • MoleQueueClient & client(): Return the parent MoleQueueClient.
  • size_t id() const: Unique identifier for this job request.
  • int jobId() const: If set, a queue specific job identifier.
  • Various setters/getters for file path, job options, etc.

Slots:

  • bool submit(): Equivalent to this->client.submitJobRequest(this).
  • bool cancel(): Equivalent to this->client.cancelJobRequest(this).
  • bool destroy(): Removes a JobRequest from the client. Otherwise the instance will persist for the lifetime of the MoleQueueClient.

Signals:

  • void stateChanged(JobState oldState, JobState newState): Emitted when the server indicates a change in the job's status.
  • void submitted(): Emitted when the job is successfully submitted to the MoleQueueServer.
  • void error(ErrorCode ec, const QString &err) Emitted if an error is encountered.
  • void finished(): Emitted when the job execution terminates.

ErrorCode values:

  • SUBMISSION_ERROR: Error submitting request to MoleQueueServer.

MoleQueue::MoleQueueServer

Server for handling requests from and sending notifications to MoleQueueClient instances. It holds a pointer to a QueueManager and directly sends requests to the appropriate Queue objects.

Methods:

  • setQueueManager(QueueManager *): Sets the QueueManager.
  • QueueManager * queueManager(): Get the current QueueManager instance.