Class MscanUtils

java.lang.Object
org.eclipse.scanning.sequencer.MscanUtils

public final class MscanUtils extends Object
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 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.FAILED or Status.NONE;
      • jobs that are running (i.e. Status.isRunning() is true) and are older than the maximum running age (by default, two days);
      • jobs that are final (i.e. Status.isFinal() is true) 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:
      • invalid reference
        org.eclipse.scanning.api.event.core.IQueueConnection#clearQueue
    • clearQueue

      public static void clearQueue()
      Removes all pending jobs from the submission queue.
      See Also:
      • invalid reference
        org.eclipse.scanning.api.event.core.IQueueConnection#clearQueue
    • clearRunningAndCompleted

      public static void clearRunningAndCompleted()
      Removes all completed jobs from the IJobQueue's status set.
      See Also:
      • invalid reference
        org.eclipse.scanning.api.event.core.IQueueConnection#clearRunningAndCompleted
    • getCompletedFrom

      public static List<StatusBean> getCompletedFrom(List<StatusBean> runningAndCompleted)
      Parameters:
      runningAndCompleted -
      Returns:
      list of final (terminated, failed, complete and unfinished) jobs
    • getRunningAndCompleted

      public static List<StatusBean> getRunningAndCompleted() throws EventException, URISyntaxException
      Returns:
      list of running and completed jobs
      Throws:
      EventException
      URISyntaxException
    • getRunningFrom

      public static List<StatusBean> getRunningFrom(List<StatusBean> runningAndCompleted)
      Parameters:
      runningAndCompleted -
      Returns:
      list of active (running, paused or resumed) jobs
    • getSubmitted

      public static List<StatusBean> getSubmitted() throws EventException, URISyntaxException
      Returns:
      list of submitted jobs
      Throws:
      EventException
      URISyntaxException
    • 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 -