예제 #1
0
    def test_start_timed_plans3(self):

        # Set datetime
        timer_svc.set_datetime("2011-11-12T11:23:44.123Z")

        with patch("orch.orchestrator.execute_plan") as mock_execute_plan:
            sched_svc.start_timed_plans()

        self.assertEqual(mock_execute_plan.call_count, 0)
예제 #2
0
    def test_start_timed_tasks_for_running_plans1(self):

        # Start 4 plans
        orchestrator.execute_plan(self.plan1_id)
        orchestrator.execute_plan(self.plan2_id)
        orchestrator.execute_plan(self.plan3_id)
        orchestrator.execute_plan(self.plan4_id)

        # Set datetime
        timer_svc.set_datetime("2015-11-12T11:23:44.123Z")

        with patch("orch.orchestrator.execute_task") as mock_execute_task:
            sched_svc.start_timed_tasks_for_running_plans()

        self.assertEqual(mock_execute_task.call_count, 3)
예제 #3
0
def scheduler_loop():
    # Main scheduler loop
    while 1 == 1:

        time.sleep(get_delay())

        logger.debug("Setting new timer time")
        timer_svc.set_datetime(timer_svc.get_current_datetime())

        # Check if there are initial plans with start_on that need to be started.
        start_timed_plans()

        # Check if there are running plans that have tasks with start_on. If the task is not active
        # and it is time to start it, start it.
        start_timed_tasks_for_running_plans()

        if interrupt():
            return
예제 #4
0
def scheduler_loop():
    # Main scheduler loop
    while 1 == 1:

        time.sleep ( get_delay ( ) )

        logger.debug ( "Setting new timer time" )
        timer_svc.set_datetime ( timer_svc.get_current_datetime ( ) )

        # Check if there are initial plans with start_on that need to be started.
        start_timed_plans()

        # Check if there are running plans that have tasks with start_on. If the task is not active
        # and it is time to start it, start it.
        start_timed_tasks_for_running_plans()


        if interrupt():
            return