예제 #1
0
    def test_resource_failure(self):
        task_server = self.task_server

        tc = TaskComputer(task_server, use_docker_manager=False)

        task_id = 'xyz'
        subtask_id = 'xxyyzz'

        tc.task_resource_failure(task_id, 'reason')
        assert not task_server.send_task_failed.called

        tc.assigned_subtask = ComputeTaskDef(
            task_id=task_id,
            subtask_id=subtask_id,
        )

        tc.task_resource_failure(task_id, 'reason')
        assert task_server.send_task_failed.called
예제 #2
0
    def test_resource_failure(self):
        task_server = mock.MagicMock()
        task_server.config_desc = config_desc()
        tc = TaskComputer("ABC", task_server, use_docker_machine_manager=False)

        task_id = 'xyz'
        subtask_id = 'xxyyzz'

        tc.task_resource_failure(task_id, 'reason')
        assert not task_server.send_task_failed.called

        tc.task_to_subtask_mapping[task_id] = subtask_id
        tc.assigned_subtasks[subtask_id] = mock.Mock()

        tc.task_resource_failure(task_id, 'reason')
        assert task_server.send_task_failed.called

        tc.resource_request_rejected(subtask_id, 'reason')