Package org.eclipse.scanning.sequencer
Class MscanUtils
java.lang.Object
org.eclipse.scanning.sequencer.MscanUtils
Helper class to give easy access to submission and run queues
Use this class to easily get lists of submitted, running and completed jobs, clear them or stop running jobs.
Jython examples:
>>> from org.eclipse.scanning.sequencer import MscanUtils
>>> MscanUtils.clearRunningAndCompleted()
>>> mscan(repeat('dummy1', 10000, 0.0, 0))
>>> MscanUtils.stopAll()
>>> MscanUtils.stopAllIn(5000) # ms
>>> mscan(repeat('dummy1', 10000, 0.0, 0))
>>> MscanUtils.clearQueue()
>>> MscanUtils.getSubmitted()
[]
>>> MscanUtils.getRunningAndCompleted().size()
2
>>> MscanUtils.getRunningFrom(MscanUtils.getRunningAndCompleted()).size()
0
>>> MscanUtils.getCompletedFrom(MscanUtils.getRunningAndCompleted()).size()
2
>>> MscanUtils.cleanUpCompleted()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCleans up the status set by removing certain old jobs.static voidRemoves all pending jobs from the submission queue.static voidRemoves all completed jobs from theIJobQueue's status set.static List<StatusBean> getCompletedFrom(List<StatusBean> runningAndCompleted) static List<StatusBean> static List<StatusBean> getRunningFrom(List<StatusBean> runningAndCompleted) static List<StatusBean> static voidstopAll()Stop all active (running, paused or resumed) jobsstatic voidstopAllIn(long ms) Stop all active (running, paused or resumed) jobs after the given delay (in milliseconds)
-
Constructor Details
-
MscanUtils
public MscanUtils()
-
-
Method Details
-
cleanUpCompleted
public static void cleanUpCompleted()Cleans up the status set by removing certain old jobs.
Specifically, the jobs that are removed are those that meet one of the following criteria:- jobs that have the status
Status.FAILEDorStatus.NONE; - jobs that are running (i.e.
Status.isRunning()istrue) and are older than the maximum running age (by default, two days); - jobs that are final (i.e.
Status.isFinal()istrue) and are older than the maximum complete age (by default, one week); - Additionally jobs that are not started or paused will have their status set to
Status.FAILED;
- See Also:
- jobs that have the status
-
clearQueue
public static void clearQueue()Removes all pending jobs from the submission queue.- See Also:
-
clearRunningAndCompleted
public static void clearRunningAndCompleted()Removes all completed jobs from theIJobQueue's status set.- See Also:
-
getCompletedFrom
- Parameters:
runningAndCompleted-- Returns:
- list of final (terminated, failed, complete and unfinished) jobs
-
getRunningAndCompleted
- Returns:
- list of running and completed jobs
- Throws:
EventExceptionURISyntaxException
-
getRunningFrom
- Parameters:
runningAndCompleted-- Returns:
- list of active (running, paused or resumed) jobs
-
getSubmitted
- Returns:
- list of submitted jobs
- Throws:
EventExceptionURISyntaxException
-
stopAll
public static void stopAll()Stop all active (running, paused or resumed) jobs -
stopAllIn
public static void stopAllIn(long ms) Stop all active (running, paused or resumed) jobs after the given delay (in milliseconds)- Parameters:
ms-
-