示例#1
0
def test_submitTasks(
    mocker,
    tcMockGetTasksToSubmitReturnValue,
    tmMockPrepareTransformationTasksReturnValue,
    tmMockSubmitTransformationTasksReturnValue,
    tmMockUpdateDBAfterTaskSubmissionReturnValue,
    expected,
):
    mocker.patch(
        "DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.AgentModule",
        side_effect=mockAM)
    mocker.patch(
        "DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.FileReport",
        side_effect=MagicMock())
    tmab = TaskManagerAgentBase()
    tc_mock.getTasksToSubmit.return_value = tcMockGetTasksToSubmitReturnValue
    tm_mock.prepareTransformationTasks.return_value = tmMockPrepareTransformationTasksReturnValue
    tm_mock.submitTransformationTasks.return_value = tmMockSubmitTransformationTasksReturnValue
    tm_mock.updateDBAfterTaskSubmission.return_value = tmMockUpdateDBAfterTaskSubmissionReturnValue
    res = tmab.submitTasks(transDict, clients)
    assert res["OK"] == expected
    tmab.maxParametricJobs = 10
    tmab.bulkSubmissionFlag = True
    res = tmab.submitTasks(transDict, clients)
    assert res["OK"] == expected
def test_submitTasks(mocker,
                     tcMockGetTasksToSubmitReturnValue,
                     tmMockPrepareTransformationTasksReturnValue,
                     tmMockSubmitTransformationTasksReturnValue,
                     tmMockUpdateDBAfterTaskSubmissionReturnValue,
                     expected):
  mocker.patch('DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.AgentModule', side_effect=mockAM)
  mocker.patch('DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.FileReport', side_effect=MagicMock())
  tmab = TaskManagerAgentBase()
  tc_mock.getTasksToSubmit.return_value = tcMockGetTasksToSubmitReturnValue
  tm_mock.prepareTransformationTasks.return_value = tmMockPrepareTransformationTasksReturnValue
  tm_mock.submitTransformationTasks.return_value = tmMockSubmitTransformationTasksReturnValue
  tm_mock.updateDBAfterTaskSubmission.return_value = tmMockUpdateDBAfterTaskSubmissionReturnValue
  res = tmab.submitTasks(transIDOPBody, clients)
  assert res['OK'] == expected
  tmab.maxParametricJobs = 10
  tmab.bulkSubmissionFlag = True
  res = tmab.submitTasks(transIDOPBody, clients)
  assert res['OK'] == expected
def test_submitTasks(mocker, tcMockGetTasksToSubmitReturnValue,
                     tmMockPrepareTransformationTasksReturnValue,
                     tmMockSubmitTransformationTasksReturnValue,
                     tmMockUpdateDBAfterTaskSubmissionReturnValue, expected):
    mocker.patch(
        'DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.AgentModule',
        side_effect=mockAM)
    mocker.patch(
        'DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.FileReport',
        side_effect=MagicMock())
    tmab = TaskManagerAgentBase()
    tc_mock.getTasksToSubmit.return_value = tcMockGetTasksToSubmitReturnValue
    tm_mock.prepareTransformationTasks.return_value = tmMockPrepareTransformationTasksReturnValue
    tm_mock.submitTransformationTasks.return_value = tmMockSubmitTransformationTasksReturnValue
    tm_mock.updateDBAfterTaskSubmission.return_value = tmMockUpdateDBAfterTaskSubmissionReturnValue
    res = tmab.submitTasks(transIDOPBody, clients)
    assert res['OK'] == expected