Skip to content

Commit da6ab4b

Browse files
antgonzawasademcmk3ElDeveloper
authored
Study autoloaded (#3046)
* Version 092020 (#3034) * inject study_type in EBI and improvements to current automatic processing pipeline (#3023) * inject study_type in ebi and improvements to current automatic proecssing pipeline * addressing @ElDeveloper comments * some general fixes/additions for next release (#3026) * some general fixes/additions for next release * adding test for not None job.release_validator_job * fix #2839 * fix #2868 (#3028) * fix #2868 * 2nd round * fix errors * more changes * fix errors * fix ProcessingJobTest * fix PY_PATCH * add missing TRN.add * encapsulated_query -> perform_as_transaction * fix #3022 (#3030) * fix #3022 * adding tests * fix #2320 (#3031) * fix #2320 * adding prints to debug * children -> 1 * APIArtifactHandlerTest -> APIArtifactHandlerTests * configure_biom * qdb.util.activate_or_update_plugins * improving code * almost there * add values.template * fix filepaths * filepaths -> files * fixing errors * add prep.artifact insertion * addressing @ElDeveloper comments * fix artifact_definition active command * != -> == * Added three tutorial sections to the Qiita documentation (#3032) * Added three tutorial sections to the Qiita documentation: 'Retrieving Public Data for Own Analysis' and 'Processing public data retrieved with redbiom' to the redbiom tab, and 'Statistical Analysis to Justify Clinical Trial Sample Size Tutorial' to the analyzing samples tab. * Update redbiom.rst * Update redbiom.rst * Update redbiom.rst * Further updates to redbiom.rst and the Stats tutorial. * update redbiom.rst * Finished proof-reading * Placed all three tutorials/sections together under Introduction to the download and analysis of public Qiita data * added a new introduction, with links to the three sections * Added figures to stats tutorial and contexts explanation * Added figures to stats tutorial and contexts explanation * Apply suggestions from code review [skip ci] Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> Co-authored-by: Antonio Gonzalez <[email protected]> Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> * 092020 (#3033) * 092020 * connect artifact with job * rm INSERT qiita.artifact_processing_job * Apply suggestions from code review [skip ci] Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> Co-authored-by: Daniel McDonald <[email protected]> Co-authored-by: Mirte Kuijpers <[email protected]> Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> * adding qiita.study autoloaded column * cleaning tests * fix redbiom test * avoiding clog submissions * Apply suggestions from code review Co-authored-by: Yoshiki Vázquez Baeza <[email protected]> Co-authored-by: Daniel McDonald <[email protected]> Co-authored-by: Mirte Kuijpers <[email protected]> Co-authored-by: Yoshiki Vázquez Baeza <[email protected]>
1 parent 8cef17e commit da6ab4b

File tree

12 files changed

+2236
-2594
lines changed

12 files changed

+2236
-2594
lines changed

qiita_db/processing_job.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,9 @@ def _update_and_launch_children(self, mapping):
16361636
# Submit all the children that already have all the input parameters
16371637
for c in ready:
16381638
c.submit()
1639+
# some jobs create several children jobs/validators and this can
1640+
# clog the submission process; giving it a second to avoid this
1641+
sleep(1)
16391642

16401643
@property
16411644
def outputs(self):

qiita_db/study.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Study(qdb.base.QiitaObject):
5757
title
5858
owner
5959
specimen_id_column
60+
autoloaded
6061
6162
Methods
6263
-------
@@ -77,7 +78,8 @@ class Study(qdb.base.QiitaObject):
7778
_table = "study"
7879
_portal_table = "study_portal"
7980
# The following columns are considered not part of the study info
80-
_non_info = frozenset(["email", "study_title", "ebi_study_accession"])
81+
_non_info = frozenset(["email", "study_title", "ebi_study_accession",
82+
"autoloaded"])
8183

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

483485
# --- Attributes ---
486+
@property
487+
def autoloaded(self):
488+
"""Returns if the study was autoloaded
489+
490+
Returns
491+
-------
492+
bool
493+
If the study was autoloaded or not
494+
"""
495+
with qdb.sql_connection.TRN:
496+
sql = """SELECT autoloaded FROM qiita.{0}
497+
WHERE study_id = %s""".format(self._table)
498+
qdb.sql_connection.TRN.add(sql, [self._id])
499+
return qdb.sql_connection.TRN.execute_fetchlast()
500+
501+
@autoloaded.setter
502+
def autoloaded(self, value):
503+
"""Sets the autoloaded status of the study
504+
505+
Parameters
506+
----------
507+
value : bool
508+
Whether the study was autoloaded
509+
"""
510+
sql = """UPDATE qiita.{0} SET autoloaded = %s
511+
WHERE study_id = %s""".format(self._table)
512+
qdb.sql_connection.perform_as_transaction(sql, [value, self._id])
513+
484514
@property
485515
def title(self):
486516
"""Returns the title of the study

qiita_db/support_files/patches/80.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Nov 10, 2020
2+
-- Add a flag to the studies to see if the study was submitted by Qiita or downloaded by EBI
3+
4+
ALTER TABLE qiita.study ADD autoloaded BOOL NOT NULL DEFAULT false;

0 commit comments

Comments
 (0)