Skip to content

mv some methods #2268

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 21 commits into from
Sep 5, 2017
Merged
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
Prev Previous commit
fix delete error
  • Loading branch information
antgonza committed Sep 2, 2017
commit df64ef51e4e48891a6737927df2fcf07df9aac45
10 changes: 7 additions & 3 deletions qiita_db/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,15 @@ def delete(cls, artifact_id):
qdb.sql_connection.TRN.add(sql, [artifact_id])
jobs = qdb.sql_connection.TRN.execute_fetchflatten()
if jobs:
# as the delete happens on the queue, we need to check that
# there is more than the job running is not delete_artifact
# if the artifact has active jobs we need to raise an error
# but we also need to check that if it's only 1 job, that the
# job is not the delete_artifact actual job
raise_error = True
job_name = qdb.processing_job.ProcessingJob(
jobs[0]).command.name
if len(jobs) != 1 and job_name != 'delete_artifact':
if len(jobs) == 1 and job_name == 'delete_artifact':
raise_error = False
if raise_error:
raise qdb.exceptions.QiitaDBArtifactDeletionError(
artifact_id, "there is a queued/running job that "
"uses this artifact")
Expand Down