Class NMPIQueueManagerCompat
java.lang.Object
uk.ac.manchester.spinnaker.nmpi.nmpi.NMPIQueueManagerCompat
- All Implemented Interfaces:
NMPIQueueManager
public class NMPIQueueManagerCompat extends Object implements NMPIQueueManager
Manages the NMPI queue, receiving jobs and submitting them to be run.
-
Field Summary
Fields Modifier and Type Field Description static String
STATUS_ERROR
Job status when in error.static String
STATUS_FINISHED
Job status when finished.static String
STATUS_RUNNING
Job status when running.static String
STATUS_VALIDATED
Job status when in the queue but the executer hasn't started. -
Constructor Summary
Constructors Constructor Description NMPIQueueManagerCompat()
-
Method Summary
Modifier and Type Method Description void
addListener(NMPIQueueListener listener)
Register a listener against the manager for new jobs.void
appendJobLog(int id, String logToAppend)
Appends log messages to the log.void
close()
Close the manager.List<? extends Job>
getJobs()
Get jobs that are marked as running or in progress in some form.void
processResponsesFromQueue()
Process responses from the queue now.void
setJobError(int id, String logToAppend, List<DataItem> outputs, Throwable error, ObjectNode provenance)
Marks a job as finished with an error.void
setJobFinished(int id, String logToAppend, List<DataItem> outputs, ObjectNode provenance)
Marks a job as finished successfully.void
setJobRunning(int id)
Mark a job as running.
-
Field Details
-
STATUS_FINISHED
Job status when finished.- See Also:
- Constant Field Values
-
STATUS_VALIDATED
Job status when in the queue but the executer hasn't started.- See Also:
- Constant Field Values
-
STATUS_RUNNING
Job status when running.- See Also:
- Constant Field Values
-
STATUS_ERROR
Job status when in error.- See Also:
- Constant Field Values
-
-
Constructor Details
-
NMPIQueueManagerCompat
public NMPIQueueManagerCompat()
-
-
Method Details
-
getJobs
Description copied from interface:NMPIQueueManager
Get jobs that are marked as running or in progress in some form.- Specified by:
getJobs
in interfaceNMPIQueueManager
- Returns:
- A list of jobs.
-
addListener
Register a listener against the manager for new jobs.- Specified by:
addListener
in interfaceNMPIQueueManager
- Parameters:
listener
- The listener to register
-
processResponsesFromQueue
public void processResponsesFromQueue()Description copied from interface:NMPIQueueManager
Process responses from the queue now.- Specified by:
processResponsesFromQueue
in interfaceNMPIQueueManager
-
appendJobLog
Appends log messages to the log.- Specified by:
appendJobLog
in interfaceNMPIQueueManager
- Parameters:
id
- The ID of the joblogToAppend
- The messages to append
-
setJobRunning
public void setJobRunning(int id)Mark a job as running.- Specified by:
setJobRunning
in interfaceNMPIQueueManager
- Parameters:
id
- The ID of the job.
-
setJobFinished
public void setJobFinished(int id, String logToAppend, List<DataItem> outputs, ObjectNode provenance)Marks a job as finished successfully.- Specified by:
setJobFinished
in interfaceNMPIQueueManager
- Parameters:
id
- The ID of the joblogToAppend
- Any additional log messages to append to the existing log (null if none)outputs
- The outputs of the job (null if none)provenance
- JSON provenance information
-
setJobError
public void setJobError(int id, String logToAppend, List<DataItem> outputs, Throwable error, ObjectNode provenance)Marks a job as finished with an error.- Specified by:
setJobError
in interfaceNMPIQueueManager
- Parameters:
id
- The ID of the joblogToAppend
- Any additional log messages to append to the existing log (null if none)outputs
- Any outputs generated, or null if noneerror
- The error detailsprovenance
- JSON provenance information
-
close
public void close()Close the manager.- Specified by:
close
in interfaceNMPIQueueManager
-