Skip to content

Commit

Permalink
Fixing bug with summary jobs (#2025)
Browse files Browse the repository at this point in the history
* Fixing bug with summary jobs

* addressing @antgonza's comments
  • Loading branch information
josenavas authored and antgonza committed Dec 16, 2016
1 parent c0b5a6f commit d1c1875
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion qiita_db/test/test_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())

Expand Down

0 comments on commit d1c1875

Please sign in to comment.