Class SmartExecutorScheduler


  • public class SmartExecutorScheduler
    extends Object
    Author:
    Luca Frosini (ISTI - CNR)
    • Field Detail

      • scheduledJobs

        protected Set<UUID> scheduledJobs
      • scheduler

        protected org.quartz.Scheduler scheduler
    • Method Detail

      • createTriggerBuilder

        protected org.quartz.TriggerBuilder<? extends org.quartz.Trigger> createTriggerBuilder​(UUID uuid,
                                                                                               org.quartz.ScheduleBuilder<? extends org.quartz.Trigger> sb)
      • getTriggerBuilderWithScheduling

        protected org.quartz.TriggerBuilder<? extends org.quartz.Trigger> getTriggerBuilderWithScheduling​(UUID uuid,
                                                                                                          org.gcube.vremanagement.executor.api.types.Scheduling scheduling)
                                                                                                   throws org.gcube.vremanagement.executor.exception.LaunchException
        Throws:
        org.gcube.vremanagement.executor.exception.LaunchException
      • reallySchedule

        protected void reallySchedule​(UUID uuid,
                                      org.gcube.vremanagement.executor.api.types.LaunchParameter parameter)
                               throws org.gcube.vremanagement.executor.exception.LaunchException,
                                      org.quartz.SchedulerException
        Create the Scheduler using the strategy provided by LaunchParameter
        Parameters:
        uuid - the UUID will be used to identify the task
        parameter - LaunchParameter requested in service invocation
        Throws:
        org.gcube.vremanagement.executor.exception.LaunchException - if the LaunchParameter does not contains a valid scheduling strategy
        org.quartz.SchedulerException - if the scheduler cannot be created by the scheduler factory
      • schedule

        public UUID schedule​(org.gcube.vremanagement.executor.api.types.LaunchParameter parameter,
                             UUID uuid)
                      throws org.gcube.vremanagement.executor.exception.InputsNullException,
                             org.gcube.vremanagement.executor.exception.PluginNotFoundException,
                             org.gcube.vremanagement.executor.exception.LaunchException
        Schedule a task execution
        Parameters:
        parameter - LaunchParameter requested in service invocation
        Returns:
        the UUID which will identify the task
        Throws:
        org.gcube.vremanagement.executor.exception.LaunchException - if the LaunchParameter does not contains a valid scheduling strategy
        org.gcube.vremanagement.executor.exception.InputsNullException - if provided input map is null
        org.gcube.vremanagement.executor.exception.PluginNotFoundException - if the request plugin is not available on this smart executor instance
      • stopTask

        protected void stopTask​(UUID uuid)
                         throws org.gcube.vremanagement.executor.exception.UnableToInterruptTaskException
        Throws:
        org.gcube.vremanagement.executor.exception.UnableToInterruptTaskException
      • getCurrentlyExecutingJobs

        protected List<org.quartz.JobExecutionContext> getCurrentlyExecutingJobs​(org.quartz.Scheduler scheduler)
                                                                          throws org.quartz.SchedulerException
        Throws:
        org.quartz.SchedulerException
      • getLaunchParameter

        public org.gcube.vremanagement.executor.api.types.LaunchParameter getLaunchParameter​(org.quartz.JobKey jobKey)
                                                                                      throws org.quartz.SchedulerException
        Throws:
        org.quartz.SchedulerException
      • stop

        public void stop​(UUID uuid,
                         boolean remove)
                  throws Exception
        Stop the execution of the Task identified by UUID
        Parameters:
        uuid - which identify the Task
        remove - : when the Task is a Scheduled one indicate if the Task has to be released or to be removed (the argument is set to true when an explicit request arrive to remove the scheduled task)
        Throws:
        Exception
        SchedulerNotFoundException
      • stopAll

        public void stopAll()
                     throws org.quartz.SchedulerException
        Throws:
        org.quartz.SchedulerException