The Client class is used by clients to submit jobs to a running MoleQueue server.
More...
#include <molequeue/client/client.h>
|
| Client (QObject *parent_=nullptr) |
|
bool | isConnected () const |
|
|
enum | MessageType {
Invalid = -1
,
ListQueues
,
SubmitJob
,
CancelJob
,
LookupJob
,
RegisterOpenWith
,
ListOpenWithNames
,
UnregisterOpenWith
} |
|
|
JsonRpcClient * | m_jsonRpcClient |
|
QHash< unsigned int, MessageType > | m_requests |
|
- Author
- Marcus D. Hanwell
Provides a simple Qt C++ API to use the MoleQueue JSON-RPC calls to submit and query the state of submitted jobs.
◆ isConnected()
bool isConnected |
( |
| ) |
const |
Query if the client is connected to a server.
- Returns
- True if connected, false if not.
◆ connectToServer
bool connectToServer |
( |
const QString & |
serverName = "MoleQueue" | ) |
|
|
slot |
Connect to the server.
- Parameters
-
serverName | Name of the socket to connect to, the default of "MoleQueue" is usually correct when connecting to the running MoleQueue. |
◆ requestQueueList
Request the list of queues and programs from the server. The signal queueListReceived() will be emitted once this has been received.
- Returns
- The local ID of the job submission request.
◆ submitJob
Submit a job to MoleQueue. If the returned local ID is retained the signal for a job submission will provide the MoleQueue ID along with the local ID.
- Parameters
-
job | The job specification to be submitted to MoleQueue. |
- Returns
- The local ID of the job submission request.
◆ lookupJob
int lookupJob |
( |
unsigned int |
moleQueueId | ) |
|
|
slot |
Request information about a job. You should supply the MoleQueue ID that was received in response to a job submission.
- Parameters
-
moleQueueId | The MoleQueue ID for the job. |
- Returns
- The local ID of the job submission request.
◆ cancelJob
int cancelJob |
( |
unsigned int |
moleQueueId | ) |
|
|
slot |
Cancel a job that was submitted.
- Parameters
-
moleQueueId | The MoleQueue ID for the job. |
- Returns
- The local ID of the job submission request.
◆ registerOpenWith [1/2]
int registerOpenWith |
( |
const QString & |
name, |
|
|
const QString & |
executable, |
|
|
const QList< QRegExp > & |
filePatterns |
|
) |
| |
|
slot |
Register an executable file handler with MoleQueue.
@param name GUI name of the file handler.
@param executable Executable to call with the filename as the first
argument. If the full path to the exectuble is not specified, it must be
in the user's $PATH.
@param filePatterns A list of QRegExp objects that the handler can open.
The QRegExp objects must use RegExp, RegExp2, WildCard, or WildCardUnix
pattern syntax, else they will be ignored.
@return The local ID of the request.
@note The executable is expected to use the following calling convention
to open files:
executable /absolute/path/to/selected/fileName
◆ registerOpenWith [2/2]
int registerOpenWith |
( |
const QString & |
name, |
|
|
const QString & |
rpcServer, |
|
|
const QString & |
rpcMethod, |
|
|
const QList< QRegExp > & |
filePatterns |
|
) |
| |
|
slot |
Register a JSON-RPC 2.0 local socket file handler with MoleQueue.
@param name GUI name of the file handler.
@param rpcServer Name of the local socket that the server is listening on.
@param rpcMethod JSON-RPC 2.0 request method to use.
@param filePatterns A list of QRegExp objects that the handler can open.
The QRegExp objects must use RegExp, RegExp2, WildCard, or WildCardUnix
pattern syntax, else they will be ignored.
@return The local ID of the request.
@note The following JSON-RPC 2.0 request is sent to the server when the
handler is activated:
{
"jsonrpc": "2.0",
"method": "<rpcMethod>",
"params": {
"fileName": "/absolute/path/to/selected/fileName"
}
},
"id": "XXX"
}
where <rpcMethod> is replaced by the rpcMethod argument.
◆ listOpenWithNames
int listOpenWithNames |
( |
| ) |
|
|
slot |
- Returns
- The local ID of the request.
◆ unregisterOpenWith
int unregisterOpenWith |
( |
const QString & |
handlerName | ) |
|
|
slot |
- Parameters
-
handlerName | Name of the file handler to remove. |
- Returns
- The local ID of the request.
- See also
- listOpenWithNames
◆ flush
- Warning
- This should not need to be called if used in an event loop, as Qt will start writing to the socket as soon as control returns to the event loop.
◆ connectionStateChanged
void connectionStateChanged |
( |
| ) |
|
|
signal |
Emitted when the connection state changes.
◆ queueListReceived
void queueListReceived |
( |
QJsonObject |
queues | ) |
|
|
signal |
Emitted when the remote queue list is received. This gives a list of lists, the primary key is the queue name, and that contains a list of available programs for each queue.
- Parameters
-
queues | A JSON object containing the names of the queues and the programs each queue have available. |
◆ submitJobResponse
void submitJobResponse |
( |
int |
localId, |
|
|
unsigned int |
moleQueueId |
|
) |
| |
|
signal |
Emitted when the job request response is received.
- Parameters
-
localId | The local ID the job submission response is in reply to. |
moleQueueId | The remote MoleQueue ID for the job submission (can be used to perform further actions on the job). |
◆ lookupJobResponse
void lookupJobResponse |
( |
int |
localId, |
|
|
QJsonObject |
jobInfo |
|
) |
| |
|
signal |
Emitted when a job lookup response is received.
- Parameters
-
localId | The local ID the job submission response is in reply to. |
jobInfo | A Json object containing all available job information. |
◆ cancelJobResponse
void cancelJobResponse |
( |
unsigned int |
moleQueueId | ) |
|
|
signal |
Emitted when a job is successfully cancelled.
◆ jobStateChanged
void jobStateChanged |
( |
unsigned int |
moleQueueId, |
|
|
QString |
oldState, |
|
|
QString |
newState |
|
) |
| |
|
signal |
Emitted when the job state changes.
◆ registerOpenWithResponse
void registerOpenWithResponse |
( |
int |
localId | ) |
|
|
signal |
Emitted when a successful registerOpenWith response is received.
◆ listOpenWithNamesResponse
void listOpenWithNamesResponse |
( |
int |
localId, |
|
|
QJsonArray |
handlerNames |
|
) |
| |
|
signal |
Emitted when a successful listOpenWithNames response is received.
◆ unregisterOpenWithResponse
void unregisterOpenWithResponse |
( |
int |
localId | ) |
|
|
signal |
Emitted when a successful unregisterOpenWith response is received.
◆ errorReceived
void errorReceived |
( |
int |
localId, |
|
|
int |
errorCode, |
|
|
QString |
errorMessage, |
|
|
QJsonValue |
errorData |
|
) |
| |
|
signal |
Emitted when an error response is received.
◆ processResult
void processResult |
( |
const QJsonObject & |
response | ) |
|
|
protectedslot |
Parse the response object and emit the appropriate signal(s).
◆ processNotification
void processNotification |
( |
const QJsonObject & |
notification | ) |
|
|
protectedslot |
Parse a notification object and emit the appropriate signal(s).
◆ processError
void processError |
( |
const QJsonObject & |
notification | ) |
|
|
protectedslot |
Parse an error object and emit the appropriate signal(s).
The documentation for this class was generated from the following file: