Skip to content

Study autoloaded #3046

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 8 commits into from
Nov 17, 2020
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: 3 additions & 0 deletions qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,9 @@ def _update_and_launch_children(self, mapping):
# Submit all the children that already have all the input parameters
for c in ready:
c.submit()
# some jobs create several children jobs/validators and this can
# clog the submission process; giving it a second to avoid this
sleep(1)

@property
def outputs(self):
Expand Down
32 changes: 31 additions & 1 deletion qiita_db/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Study(qdb.base.QiitaObject):
title
owner
specimen_id_column
autoloaded

Methods
-------
Expand All @@ -77,7 +78,8 @@ class Study(qdb.base.QiitaObject):
_table = "study"
_portal_table = "study_portal"
# The following columns are considered not part of the study info
_non_info = frozenset(["email", "study_title", "ebi_study_accession"])
_non_info = frozenset(["email", "study_title", "ebi_study_accession",
"autoloaded"])

def _lock_non_sandbox(self):
"""Raises QiitaDBStatusError if study is non-sandboxed"""
Expand Down Expand Up @@ -481,6 +483,34 @@ def insert_tags(cls, user, tags):
qdb.sql_connection.TRN.execute()

# --- Attributes ---
@property
def autoloaded(self):
"""Returns if the study was autoloaded

Returns
-------
bool
If the study was autoloaded or not
"""
with qdb.sql_connection.TRN:
sql = """SELECT autoloaded FROM qiita.{0}
WHERE study_id = %s""".format(self._table)
qdb.sql_connection.TRN.add(sql, [self._id])
return qdb.sql_connection.TRN.execute_fetchlast()

@autoloaded.setter
def autoloaded(self, value):
"""Sets the autoloaded status of the study

Parameters
----------
value : bool
Whether the study was autoloaded
"""
sql = """UPDATE qiita.{0} SET autoloaded = %s
WHERE study_id = %s""".format(self._table)
qdb.sql_connection.perform_as_transaction(sql, [value, self._id])

@property
def title(self):
"""Returns the title of the study
Expand Down
4 changes: 4 additions & 0 deletions qiita_db/support_files/patches/80.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Nov 10, 2020
-- Add a flag to the studies to see if the study was submitted by Qiita or downloaded by EBI

ALTER TABLE qiita.study ADD autoloaded BOOL NOT NULL DEFAULT false;
Loading