Exemple #1
0
    def test_restart_record_output_project(self, mock_requests,
                                           MockJobSettings):
        job_id = 1
        mock_settings, report = make_mock_settings_and_report(job_id)
        MockJobSettings.return_value = mock_settings
        report.vm_instance_name = 'some_vm'
        report.vm_volume_name = 'volume_x'
        report.job_state = JobStates.ERRORED
        report.job_step = JobSteps.RECORD_OUTPUT_PROJECT
        lando = Lando(MagicMock())
        lando.restart_job(RestartJobPayload(job_id=1))
        expected_report = """
Set job state to E.
Send progress notification. Job:1 State:E Step:P
        """
        self.assertMultiLineEqual(expected_report.strip(), report.text.strip())
Exemple #2
0
    def test_restart_store_output_job(self, mock_requests,
                                      MockLandoWorkerClient, MockJobSettings):
        job_id = 1
        mock_settings, report = make_mock_settings_and_report(job_id)
        MockJobSettings.return_value = mock_settings
        report.vm_instance_name = 'some_vm'
        report.job_state = JobStates.ERRORED
        report.job_step = JobSteps.STORING_JOB_OUTPUT
        lando = Lando(MagicMock())
        lando.restart_job(RestartJobPayload(job_id=1))
        expected_report = """
Set job state to R.
Send progress notification. Job:1 State:R Step:O
Set job step to o.
Send progress notification. Job:1 State:R Step:o
"""
        self.assertMultiLineEqual(expected_report.strip(), report.text.strip())
Exemple #3
0
    def test_restart_workflow_running_job(self, mock_requests,
                                          MockLandoWorkerClient,
                                          MockJobSettings):
        job_id = 1
        mock_settings, report = make_mock_settings_and_report(job_id)
        MockJobSettings.return_value = mock_settings
        report.vm_instance_name = 'some_vm'
        report.job_state = JobStates.ERRORED
        report.job_step = JobSteps.RUNNING
        lando = Lando(MagicMock())
        lando.restart_job(RestartJobPayload(job_id=1))
        expected_report = """
Set job state to R.
Send progress notification. Job:1 State:R Step:R
Set job step to R.
Send progress notification. Job:1 State:R Step:R
Put run_job message in queue for some_vm.
        """
        self.assertMultiLineEqual(expected_report.strip(), report.text.strip())
Exemple #4
0
    def test_restart_new_job(self, mock_requests, MockLandoWorkerClient,
                             MockJobSettings):
        job_id = 1
        mock_settings, report = make_mock_settings_and_report(job_id)
        MockJobSettings.return_value = mock_settings
        report.vm_instance_name = None
        lando = Lando(MagicMock())
        lando.restart_job(RestartJobPayload(job_id=1))
        expected_report = """
Set job state to R.
Send progress notification. Job:1 State:R Step:EMPTY
Created vm name for job 1.
Created volume name for job 1.
Set job step to V.
Send progress notification. Job:1 State:R Step:V
Created volume volume_x.
Launched vm worker_x.
Set vm instance name to worker_x.
        """
        self.assertMultiLineEqual(expected_report.strip(), report.text.strip())
Exemple #5
0
    def test_restart_terminate_vm_job(self, mock_requests,
                                      MockLandoWorkerClient, MockJobSettings):
        job_id = 1
        mock_settings, report = make_mock_settings_and_report(job_id)
        MockJobSettings.return_value = mock_settings
        report.vm_instance_name = 'some_vm'
        report.vm_volume_name = 'volume_x'
        report.job_state = JobStates.ERRORED
        report.job_step = JobSteps.TERMINATE_VM
        lando = Lando(MagicMock())
        lando.restart_job(RestartJobPayload(job_id=1))
        expected_report = """
Set job state to R.
Send progress notification. Job:1 State:R Step:T
Set job step to T.
Send progress notification. Job:1 State:R Step:T
Terminated vm some_vm.
Deleted volume volume_x.
Delete my worker's queue.
Set job step to EMPTY.
Set job state to F.
Send progress notification. Job:1 State:F Step:EMPTY"""
        self.assertMultiLineEqual(expected_report.strip(), report.text.strip())