diff --git a/qiita_db/processing_job.py b/qiita_db/processing_job.py index c31bbbb35..4b7a885fb 100644 --- a/qiita_db/processing_job.py +++ b/qiita_db/processing_job.py @@ -595,6 +595,8 @@ def complete(self, success, artifacts_data=None, error=None): self._complete_artifact_definition(a_data) else: self._complete_artifact_transformation(artifacts_data) + else: + self._set_status('success') else: if self.command.software.type == 'artifact definition': job_params = self.parameters.values diff --git a/qiita_db/test/test_processing_job.py b/qiita_db/test/test_processing_job.py index d53e1764b..9ff4626ae 100644 --- a/qiita_db/test/test_processing_job.py +++ b/qiita_db/test/test_processing_job.py @@ -394,6 +394,16 @@ def test_complete_artifact_transformation(self): # Implicitly tested by "test_complete" pass + def test_complete_no_artifact_data(self): + job = qdb.processing_job.ProcessingJob.create( + qdb.user.User('test@foo.bar'), + qdb.software.Parameters.load( + qdb.software.Command(5), + values_dict={"input_data": 1})) + job._set_status('running') + job.complete(True) + self.assertEqual(job.status, 'success') + def test_complete_type(self): fd, fp = mkstemp(suffix="_table.biom") self._clean_up_files.append(fp) @@ -448,7 +458,13 @@ def test_complete_success(self): alljobs = set(self._get_all_job_ids()) job.complete(True, artifacts_data=artifacts_data) - self.assertTrue(job.status, 'success') + # When completing the previous job, it creates a new job that needs + # to validate the BIOM table that is being added as new artifact. + # Hence, this job is still in running state until the validation job + # is completed. Note that this is tested by making sure that the status + # of this job is running, and that we have one more job than before + # (see assertEqual with len of all jobs) + self.assertEqual(job.status, 'running') obsjobs = set(self._get_all_job_ids())