Esempio n. 1
0
    def test_evaluate_action_execution_delay(self):
        # No task delay.
        task_ex_req = {'task_id': 'task1', 'task_name': 'task1'}
        ac_ex_req = {'action': 'core.noop', 'input': None}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req)
        self.assertIsNone(actual_delay)

        # Simple task delay.
        task_ex_req = {'task_id': 'task1', 'task_name': 'task1', 'delay': 180}
        ac_ex_req = {'action': 'core.noop', 'input': None}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task and with no concurrency.
        task_ex_req = {
            'task_id': 'task1',
            'task_name': 'task1',
            'delay': 180,
            'concurrency': None
        }
        ac_ex_req = {'action': 'core.noop', 'input': None, 'items_id': 0}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate first item.
        task_ex_req = {
            'task_id': 'task1',
            'task_name': 'task1',
            'delay': 180,
            'concurrency': 1
        }
        ac_ex_req = {'action': 'core.noop', 'input': None, 'item_id': 0}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate later items.
        task_ex_req = {
            'task_id': 'task1',
            'task_name': 'task1',
            'delay': 180,
            'concurrency': 1
        }
        ac_ex_req = {'action': 'core.noop', 'input': None, 'item_id': 1}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertIsNone(actual_delay)
Esempio n. 2
0
    def test_evaluate_action_execution_delay(self):
        base_task_ex_req = {
            "task_id": "task1",
            "task_name": "task1",
            "route": 0
        }

        # No task delay.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        ac_ex_req = {"action": "core.noop", "input": None}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req)
        self.assertIsNone(actual_delay)

        # Simple task delay.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req["delay"] = 180
        ac_ex_req = {"action": "core.noop", "input": None}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task and with no concurrency.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req["delay"] = 180
        task_ex_req["concurrency"] = None
        ac_ex_req = {"action": "core.noop", "input": None, "items_id": 0}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate first item.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req["delay"] = 180
        task_ex_req["concurrency"] = 1
        ac_ex_req = {"action": "core.noop", "input": None, "item_id": 0}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate later items.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req["delay"] = 180
        task_ex_req["concurrency"] = 1
        ac_ex_req = {"action": "core.noop", "input": None, "item_id": 1}
        actual_delay = workflow_service.eval_action_execution_delay(
            task_ex_req, ac_ex_req, True)
        self.assertIsNone(actual_delay)
Esempio n. 3
0
    def test_evaluate_action_execution_delay(self):
        base_task_ex_req = {'task_id': 'task1', 'task_name': 'task1', 'route': 0}

        # No task delay.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        ac_ex_req = {'action': 'core.noop', 'input': None}
        actual_delay = workflow_service.eval_action_execution_delay(task_ex_req, ac_ex_req)
        self.assertIsNone(actual_delay)

        # Simple task delay.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req['delay'] = 180
        ac_ex_req = {'action': 'core.noop', 'input': None}
        actual_delay = workflow_service.eval_action_execution_delay(task_ex_req, ac_ex_req)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task and with no concurrency.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req['delay'] = 180
        task_ex_req['concurrency'] = None
        ac_ex_req = {'action': 'core.noop', 'input': None, 'items_id': 0}
        actual_delay = workflow_service.eval_action_execution_delay(task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate first item.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req['delay'] = 180
        task_ex_req['concurrency'] = 1
        ac_ex_req = {'action': 'core.noop', 'input': None, 'item_id': 0}
        actual_delay = workflow_service.eval_action_execution_delay(task_ex_req, ac_ex_req, True)
        self.assertEqual(actual_delay, 180)

        # Task delay for with items task, with concurrency, and evaluate later items.
        task_ex_req = copy.deepcopy(base_task_ex_req)
        task_ex_req['delay'] = 180
        task_ex_req['concurrency'] = 1
        ac_ex_req = {'action': 'core.noop', 'input': None, 'item_id': 1}
        actual_delay = workflow_service.eval_action_execution_delay(task_ex_req, ac_ex_req, True)
        self.assertIsNone(actual_delay)