Skip to content

Commit

Permalink
fix(retriever): avoid infinite loop if sbatch command fails (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored Apr 11, 2024
1 parent dfcf5e6 commit ea7624e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion antareslauncher/use_cases/retrieve/state_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run(self, study: StudyDTO) -> None:
Args:
study: The study data transfer object
"""
if not study.done:
if not study.done and not study.with_error:
# set current study job state flags
if study.job_id:
s, f, e = self._env.get_job_state_flags(study)
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/retriever/test_study_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def test_given_done_study_nothing_is_done(self):
self.reporter.save_study.assert_not_called()
self.zip_extractor.extract_final_zip.assert_not_called()

@pytest.mark.unit_test
def test_given_study_with_error_study_is_still_in_error(self):
env = mock.Mock()
display = mock.Mock()
self.state_updater = StateUpdater(env=env, display=display)
study_with_error = StudyDTO(path="hello", with_error=True)
self.study_retriever.retrieve(study_with_error)
assert study_with_error.with_error

@pytest.mark.unit_test
def test_retrieve_study(self):
"""
Expand Down

0 comments on commit ea7624e

Please sign in to comment.