The MoleQueue client used by Avogadro's input generators lives in
avogadrolibs/avogadro/molequeue/client/.
This document summarizes the JSON-RPC protocol so it can
be adapted to other queue systems.
- Wire: Qt
QLocalSocket(Unix domain socket / Windows named pipe), default nameMoleQueue. Seejsonrpcclient.cpp:35-58. - Framing:
QDataStream(Qt 4.8 version) writes the JSON document as a length-prefixedQByteArray— first 4 bytes are big-endian byte count, then the UTF-8 JSON bytes. A non-Qt client must replicate this framing. Seejsonrpcclient.cpp:83-93andjsonrpcclient.cpp:126-136. - Envelope: plain JSON-RPC 2.0. Every request is
{"jsonrpc":"2.0","id":<int>,"method":"<name>","params":{...}}; replies carryresultorerror. Theidis a per-client counter. Seejsonrpcclient.cpp:75-81.
All dispatched by client.cpp.
| Method | Params | Result |
|---|---|---|
listQueues |
none | { "<queueName>": ["program1", ...] } |
submitJob |
the JobObject (see below) | { "moleQueueId": <uint> } |
lookupJob |
{ "moleQueueId": <uint> } |
full job JSON |
cancelJob |
{ "moleQueueId": <uint> } |
{ "moleQueueId": <uint> } |
registerOpenWith |
file-handler registration | — |
listOpenWithNames |
none | array of handler names |
unregisterOpenWith |
{ "name": "<handlerName>" } |
— |
Server-pushed notification: jobStateChanged with
params = { moleQueueId, oldState, newState }.
Terminal job states (from molequeuewidget.h:71-81):
Finished, Error, Canceled.
Built up in jobobject.cpp and finalized in
molequeuewidget.cpp:134-165. All fields are optional unless the
server requires them; missing values get server defaults.
{
"queue": "<queueName from listQueues>",
"program": "<programName from listQueues>",
"description": "free-text job title",
"numberOfCores": 0,
"cleanRemoteFiles": false,
"hideFromGui": false,
"popupOnStateChange": false,
"inputFile": {
"filename": "job.inp",
"contents": "...full text of input file..."
},
"additionalInputFiles": [
{ "filename": "extra.dat", "contents": "..." },
{ "path": "/absolute/path/to/file" }
]
}A file spec is either {filename, contents} (inline payload) or
{path} (server-side absolute path) — see jobobject.cpp:111-125.
The "main" input is named by the input generator's mainFileName();
everything else goes into additionalInputFiles
(inputgeneratorwidget.cpp:318-330).
- Connect to the local socket.
listQueues→ populate UI; user picks aqueue/programpair.submitJobwith the JobObject → capture returnedmoleQueueId.- Listen for
jobStateChangednotifications (or polllookupJob) until terminal state. - On
Finished, fetch outputs. The input generator emitsopenJobOutput(job)and the app reads files from the job's working directory via the lookup result.
An adapter would need to provide:
- A socket (or HTTP) endpoint speaking JSON-RPC 2.0 with the seven
method names above — at minimum
listQueues,submitJob,lookupJob,cancelJob, plus thejobStateChangednotification. - Translation of the JobObject's
queue/program/numberOfCores/inputFile/additionalInputFilesinto whatever the target scheduler expects (Slurm/PBS submit script, REST payload, etc.). - Either keep the Qt length-prefixed framing (so
JsonRpcClientworks unchanged), or add a new transport at theJsonRpcClientlayer —Clientitself is transport-agnostic above that. - A mapping from scheduler-native states back to MoleQueue's
vocabulary (
Finished/Error/Canceledare the ones the UI checks).
avogadrolibs/avogadro/molequeue/client/jsonrpcclient.{h,cpp}— transport + framing.avogadrolibs/avogadro/molequeue/client/client.{h,cpp}— method dispatch and signal/slot API.avogadrolibs/avogadro/molequeue/client/jobobject.{h,cpp}— job payload builder.avogadrolibs/avogadro/molequeue/molequeuewidget.cpp— UI that produces the final JobObject.avogadrolibs/avogadro/molequeue/inputgeneratorwidget.cpp— input-generator → submission flow.