Skip to content

Transfer submit to vamps #2265

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 4 commits into from
Aug 31, 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
3 changes: 1 addition & 2 deletions qiita_db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
import study
import user
import processing_job
import private

__version__ = "0.2.0-dev"

__all__ = ["analysis", "artifact", "base", "commands", "environment_manager",
"exceptions", "investigation", "logger", "meta_util",
"ontology", "portal", "reference", "search",
"software", "sql_connection", "study", "user", "util",
"metadata_template", "processing_job", "private"]
"metadata_template", "processing_job"]
4 changes: 4 additions & 0 deletions qiita_db/support_files/patches/58.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Aug 31, 2017
-- Remove MOI and transfer all jobs to internal QIITA plugin

SELECT 42;
19 changes: 19 additions & 0 deletions qiita_db/support_files/patches/python_patches/58.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

from qiita_db.sql_connection import TRN
from qiita_db.software import Software, Command

with TRN:
# Retrieve the Qiita plugin
qiita_plugin = Software.from_name_and_version('Qiita', 'alpha')

# Create the submit to VAMPS command
parameters = {'artifact': ['artifact:["Demultiplexed"]', None]}
Command.create(qiita_plugin, "submit_to_VAMPS",
"submits an artifact to VAMPS", parameters)
40 changes: 20 additions & 20 deletions qiita_pet/handlers/study_handlers/vamps_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from tornado.web import authenticated, HTTPError
from qiita_files.demux import stats as demux_stats

from qiita_ware.context import submit
from qiita_ware.dispatchable import submit_to_VAMPS
from qiita_db.exceptions import QiitaDBUnknownIDError
from qiita_db.artifact import Artifact
from qiita_db.software import Software, Parameters
from qiita_db.processing_job import ProcessingJob
from qiita_pet.handlers.base_handlers import BaseHandler
from qiita_core.util import execute_as_transaction

Expand Down Expand Up @@ -99,23 +99,23 @@ def post(self, preprocessed_data_id):
user.id)
msg = ''
msg_level = 'success'
study = Artifact(preprocessed_data_id).study
study_id = study.id
state = study.ebi_submission_status
if state == 'submitting':
msg = "Cannot resubmit! Current state is: %s" % state
msg_level = 'danger'
else:
channel = user.id
job_id = submit(channel, submit_to_VAMPS,
int(preprocessed_data_id))

self.render('compute_wait.html',
job_id=job_id, title='VAMPS Submission',
completion_redirect=('/study/description/%s?top_tab='
'preprocessed_data_tab&sub_tab=%s'
% (study_id,
preprocessed_data_id)))
return
plugin = Software.from_name_and_version('Qiita', 'alpha')
cmd = plugin.get_command('submit_to_VAMPS')
artifact = Artifact(preprocessed_data_id)

# Check if the artifact is already being submitted to VAMPS
is_being_submitted = any(
[j.status in ('queued', 'running')
for j in artifact.jobs(cmd=cmd)])

self.display_template(preprocessed_data_id, msg, msg_level)
if is_being_submitted == 'submitting':
msg = "Cannot resubmit! Data is already being submitted"
msg_level = 'danger'
self.display_template(preprocessed_data_id, msg, msg_level)
else:
params = Parameters.load(
cmd, values_dict={'artifact': preprocessed_data_id})
job = ProcessingJob.create(user, params)
job.submit()
self.redirect('/study/description/%s' % artifact.study.study_id)
7 changes: 1 addition & 6 deletions qiita_ware/dispatchable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------
from qiita_ware.commands import submit_EBI, submit_VAMPS
from qiita_ware.commands import submit_EBI


def submit_to_ebi(preprocessed_data_id, submission_type):
"""Submit a study to EBI"""
submit_EBI(preprocessed_data_id, submission_type, True)


def submit_to_VAMPS(preprocessed_data_id):
"""Submit a study to VAMPS"""
return submit_VAMPS(preprocessed_data_id)


def copy_raw_data(prep_template, artifact_id):
"""Creates a new raw data by copying from artifact_id

Expand Down
16 changes: 15 additions & 1 deletion qiita_db/private.py → qiita_ware/private_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import traceback

import qiita_db as qdb
from qiita_ware.commands import submit_VAMPS


def build_analysis_files(job):
Expand Down Expand Up @@ -66,8 +67,21 @@ def release_validators(job):
job._set_status('success')


def submit_to_VAMPS(job):
"""Submits an artifact to VAMPS

Parameters
----------
job : qiita_db.processing_job.ProcessingJob
The processing job performing the task
"""
with qdb.sql_connection.TRN:
submit_VAMPS(job.parameters.values['artifact'])


TASK_DICT = {'build_analysis_files': build_analysis_files,
'release_validators': release_validators}
'release_validators': release_validators,
'submit_to_VAMPS': submit_to_VAMPS}


def private_task(job_id):
Expand Down
4 changes: 2 additions & 2 deletions scripts/qiita-private-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import click

import qiita_db as qdb
from qiita_ware.private_plugin import private_task


@click.command()
Expand All @@ -23,7 +23,7 @@ def execute(url, job_id, output_dir):
The parameters url and output_dir are ignored, but they are added for
compatibility with the plugin system.
"""
qdb.private.private_task(job_id)
private_task(job_id)


if __name__ == '__main__':
Expand Down