Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qiita_ware/private_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ def complete_job(job):
artifacts = None
error = payload['error']
c_job = qdb.processing_job.ProcessingJob(param_vals['job_id'])
c_job.step = 'Completing via %s [%s]' % (job.id, job.external_id)
try:

c_job.complete(payload['success'], artifacts, error)
except Exception:
c_job._set_error(traceback.format_exception(*exc_info()))
Expand Down
11 changes: 11 additions & 0 deletions qiita_ware/test/test_private_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,24 @@ def test_complete_job(self):
f.write('\n')
self._clean_up_files.append(fp)
exp_artifact_count = get_count('qiita.artifact') + 1

# the main job (c_job) is still not completing so the step hasn't been
# updated since creation === None
self.assertIsNone(c_job.step)

payload = dumps(
{'success': True, 'error': '',
'artifacts': {'OTU table': {'filepaths': [(fp, 'biom')],
'artifact_type': 'BIOM'}}})
job = self._create_job('complete_job', {'job_id': c_job.id,
'payload': payload})
private_task(job.id)

# the complete job has started so now the step of c_job should report
# the complete information
self.assertEqual(c_job.step,
f"Completing via {job.id} [Not Available]")

self.assertEqual(job.status, 'success')
self.assertEqual(c_job.status, 'success')
self.assertEqual(get_count('qiita.artifact'), exp_artifact_count)
Expand Down