Skip to content

Commit d1c1875

Browse files
josenavasantgonza
authored andcommitted
Fixing bug with summary jobs (#2025)
* Fixing bug with summary jobs * addressing @antgonza's comments
1 parent c0b5a6f commit d1c1875

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

qiita_db/processing_job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ def complete(self, success, artifacts_data=None, error=None):
595595
self._complete_artifact_definition(a_data)
596596
else:
597597
self._complete_artifact_transformation(artifacts_data)
598+
else:
599+
self._set_status('success')
598600
else:
599601
if self.command.software.type == 'artifact definition':
600602
job_params = self.parameters.values

qiita_db/test/test_processing_job.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,16 @@ def test_complete_artifact_transformation(self):
394394
# Implicitly tested by "test_complete"
395395
pass
396396

397+
def test_complete_no_artifact_data(self):
398+
job = qdb.processing_job.ProcessingJob.create(
399+
qdb.user.User('test@foo.bar'),
400+
qdb.software.Parameters.load(
401+
qdb.software.Command(5),
402+
values_dict={"input_data": 1}))
403+
job._set_status('running')
404+
job.complete(True)
405+
self.assertEqual(job.status, 'success')
406+
397407
def test_complete_type(self):
398408
fd, fp = mkstemp(suffix="_table.biom")
399409
self._clean_up_files.append(fp)
@@ -448,7 +458,13 @@ def test_complete_success(self):
448458
alljobs = set(self._get_all_job_ids())
449459

450460
job.complete(True, artifacts_data=artifacts_data)
451-
self.assertTrue(job.status, 'success')
461+
# When completing the previous job, it creates a new job that needs
462+
# to validate the BIOM table that is being added as new artifact.
463+
# Hence, this job is still in running state until the validation job
464+
# is completed. Note that this is tested by making sure that the status
465+
# of this job is running, and that we have one more job than before
466+
# (see assertEqual with len of all jobs)
467+
self.assertEqual(job.status, 'running')
452468

453469
obsjobs = set(self._get_all_job_ids())
454470

0 commit comments

Comments
 (0)