Skip to content

Fixes 2038 #2349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 10 additions & 7 deletions qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def release_validators(self):
# Check if all the validators are completed. Validator jobs can be
# in two states when completed: 'waiting' in case of success
# or 'error' otherwise
sql = """SELECT COUNT(1)
sql = """SELECT pjv.validator_id
FROM qiita.processing_job_validator pjv
JOIN qiita.processing_job pj ON
pjv.validator_id = pj.processing_job_id
Expand All @@ -419,14 +419,16 @@ def release_validators(self):
AND processing_job_status NOT IN %s"""
sql_args = [self.id, ('waiting', 'error')]
qdb.sql_connection.TRN.add(sql, sql_args)
remaining = qdb.sql_connection.TRN.execute_fetchlast()
validator_ids = qdb.sql_connection.TRN.execute_fetchindex()

# Active polling - wait until all validator jobs are completed
while remaining != 0:
self.step = "Validating outputs (%d remaining)" % remaining
while validator_ids:
jids = ', '.join([j[0] for j in validator_ids])
self.step = ("Validating outputs (%d remaining) via "
"job(s) %s" % (len(validator_ids), jids))
sleep(10)
qdb.sql_connection.TRN.add(sql, sql_args)
remaining = qdb.sql_connection.TRN.execute_fetchlast()
validator_ids = qdb.sql_connection.TRN.execute_fetchindex()

# Check if any of the validators errored
sql = """SELECT validator_id
Expand Down Expand Up @@ -631,8 +633,9 @@ def _complete_artifact_transformation(self, artifacts_data):
ProcessingJob.create(self.user, validate_params))

# Change the current step of the job
self.step = "Validating outputs (%d remaining)" % len(
validator_jobs)

self.step = "Validating outputs (%d remaining) via job(s) %s" % (
len(validator_jobs), ', '.join([j.id for j in validator_jobs]))

# Link all the validator jobs with the current job
self._set_validator_jobs(validator_jobs)
Expand Down
2 changes: 2 additions & 0 deletions qiita_db/test/test_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ def test_complete_success(self):
# 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')
self.assertTrue(job.step.startswith(
'Validating outputs (1 remaining) via job(s)'))

obsjobs = set(self._get_all_job_ids())

Expand Down