Skip to content

Commit 8edd0c8

Browse files
committed
Merge branch 'dev' of github.com:biocore/qiita into dev
2 parents 3c1f71b + 748126a commit 8edd0c8

File tree

6 files changed

+229
-173
lines changed

6 files changed

+229
-173
lines changed

qiita_db/metadata_template/prep_template.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,3 +1107,28 @@ def current_human_filtering(self, current_human_filtering):
11071107
WHERE prep_template_id = %s"""
11081108
qdb.sql_connection.TRN.add(sql, [current_human_filtering, self.id])
11091109
qdb.sql_connection.TRN.execute()
1110+
1111+
@property
1112+
def reprocess_job_id(self):
1113+
"""The job that was created to reprocess this prep info file
1114+
1115+
Returns
1116+
-------
1117+
bool or None
1118+
The reprocess_job_id of the prep file info
1119+
"""
1120+
with qdb.sql_connection.TRN:
1121+
sql = """SELECT reprocess_job_id
1122+
FROM qiita.prep_template
1123+
WHERE prep_template_id = %s"""
1124+
qdb.sql_connection.TRN.add(sql, [self.id])
1125+
return qdb.sql_connection.TRN.execute_fetchlast()
1126+
1127+
@reprocess_job_id.setter
1128+
def reprocess_job_id(self, reprocess_job_id):
1129+
with qdb.sql_connection.TRN:
1130+
sql = """UPDATE qiita.prep_template
1131+
SET reprocess_job_id = %s
1132+
WHERE prep_template_id = %s"""
1133+
qdb.sql_connection.TRN.add(sql, [reprocess_job_id, self.id])
1134+
qdb.sql_connection.TRN.execute()

qiita_db/metadata_template/test/test_prep_template.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,21 @@ def test_current_human_filtering(self):
19141914
pt.current_human_filtering = False
19151915
self.assertFalse(pt.current_human_filtering)
19161916

1917+
def test_reprocess_job_id(self):
1918+
pt = qdb.metadata_template.prep_template.PrepTemplate(1)
1919+
# by default it should be None
1920+
self.assertIsNone(pt.reprocess_job_id)
1921+
# it should not accept an external_job_id
1922+
with self.assertRaises(ValueError):
1923+
pt.reprocess_job_id = '124567'
1924+
# but it should work fine with an uuid
1925+
jid = '6d368e16-2242-4cf8-87b4-a5dc40bb890b'
1926+
pt.reprocess_job_id = jid
1927+
self.assertEqual(pt.reprocess_job_id, jid)
1928+
# and it should be fine to return to its default value
1929+
pt.reprocess_job_id = None
1930+
self.assertIsNone(pt.reprocess_job_id)
1931+
19171932

19181933
EXP_PREP_TEMPLATE = (
19191934
'sample_name\tbarcode\tcenter_name\tcenter_project_name\t'

qiita_db/support_files/patches/92.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ ALTER TABLE qiita.slurm_resource_allocations
2222
-- Apr 21, 2024
2323
-- Adding a new column: current_human_filtering to qiita.prep_template
2424
ALTER TABLE qiita.prep_template ADD current_human_filtering boolean DEFAULT False;
25+
26+
-- Apr 22, 2024
27+
-- Adding a new column: reprocess_job_id to qiita.prep_template to keep track of
28+
-- the job that reprocessed this prep
29+
ALTER TABLE qiita.prep_template ADD reprocess_job_id uuid DEFAULT NULL;

qiita_db/support_files/qiita-db.dbs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,12 @@
10011001
<column name="creation_job_id" type="uuid" jt="1111" >
10021002
<defo><![CDATA[NULL]]></defo>
10031003
</column>
1004-
<column name="current_human_filtering" type="boolean" jt="1111" >
1004+
<column name="current_human_filtering" type="boolean" jt="-7" >
10051005
<defo><![CDATA[false]]></defo>
10061006
</column>
1007+
<column name="reprocess_job_id" type="uuid" jt="1111" >
1008+
<defo><![CDATA[NULL]]></defo>
1009+
</column>
10071010
<index name="pk_prep_template" unique="PRIMARY_KEY" >
10081011
<column name="prep_template_id" />
10091012
</index>
@@ -2109,7 +2112,7 @@ $function$
21092112
<entity schema="qiita" name="parent_processing_job" color="F4DDBE" x="1152" y="1024" />
21102113
<entity schema="qiita" name="per_study_tags" color="D1BEF4" x="656" y="1376" />
21112114
<entity schema="qiita" name="portal_type" color="D1BEF4" x="944" y="176" />
2112-
<entity schema="qiita" name="prep_template" color="BEBEF4" x="1952" y="1312" />
2115+
<entity schema="qiita" name="prep_template" color="BEBEF4" x="1984" y="1264" />
21132116
<entity schema="qiita" name="prep_template_filepath" color="BEBEF4" x="2128" y="1104" />
21142117
<entity schema="qiita" name="prep_template_processing_job" color="BEBEF4" x="2672" y="864" />
21152118
<entity schema="qiita" name="prep_template_sample" color="BEBEF4" x="1648" y="1376" />
@@ -2157,4 +2160,4 @@ FROM
21572160
qiita.artifact t;]]></string>
21582161
</script>
21592162
</layout>
2160-
</project>
2163+
</project>

0 commit comments

Comments
 (0)