def assert_job_status(self, job_status_fname, expected_job_status):
     with patch(
             "b2luigi.batch.processes.gbasf2.get_gbasf2_project_job_status_dict",
             MagicMock(
                 return_value=self._get_job_status_dict(job_status_fname))):
         job_status = Gbasf2Process.get_job_status(self.gb2_mock_process)
         self.assertEqual(job_status, expected_job_status)
    def assert_rescheduled_jobs(self, job_status_fname,
                                expected_jobs_to_be_rescheduled):
        with patch(
                "b2luigi.batch.processes.gbasf2.get_gbasf2_project_job_status_dict",
                MagicMock(
                    return_value=self._get_job_status_dict(job_status_fname))):
            with patch(
                    "b2luigi.batch.processes.gbasf2.Gbasf2Process._reschedule_jobs",
                    new=self._reschedule_jobs):

                Gbasf2Process._reschedule_failed_jobs(self.gb2_mock_process)

                self.assertCountEqual(
                    list(self.gb2_mock_process.n_retries_by_job.keys()),
                    expected_jobs_to_be_rescheduled)
                for jobid in self.gb2_mock_process.n_retries_by_job.keys():
                    self.assertEqual(
                        self.gb2_mock_process.n_retries_by_job[jobid], 1)
 def _build_gbasf2_submit_command(self, task) -> List[str]:
     gb2_mock_process = Mock()
     os.makedirs(self._get_task_file_dir(task), exist_ok=True)
     self.pickle_file_path = os.path.join(self._get_task_file_dir(task),
                                          "serialized_basf2_path.pkl")
     self.wrapper_file_path = os.path.join(self._get_task_file_dir(task),
                                           "steering_file_wrapper.py")
     gb2_mock_process.pickle_file_path = self.test_dir
     gb2_mock_process.wrapper_file_path = self.test_dir
     gb2_mock_process.gbasf2_project_name = get_unique_project_name(task)
     gb2_mock_process.task = task
     return Gbasf2Process._build_gbasf2_submit_command(gb2_mock_process)
Exemple #4
0
 def assert_failed_files(self, download_stdout_name,
                         expected_number_of_failed_files):
     failed_files = Gbasf2Process._failed_files_from_dataset_download(
         self.gb2_mock_process,
         self._get_download_stdout(download_stdout_name))
     self.assertEqual(len(failed_files), expected_number_of_failed_files)