Skip to content

Commit 8656ffc

Browse files
authored
Merge pull request #3131 from antgonza/add-base-for-new-admin-plugin
add base for new admin plugin
2 parents 6f7a247 + df9d118 commit 8656ffc

File tree

9 files changed

+30
-14
lines changed

9 files changed

+30
-14
lines changed

qiita_db/artifact.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def create(cls, filepaths, artifact_type, name=None, prep_template=None,
337337
raise qdb.exceptions.QiitaDBArtifactCreationError(
338338
"When provided, both parents and processing parameters should "
339339
"be provided")
340-
elif bool(analysis) != bool(data_type):
340+
elif bool(analysis) and not bool(data_type):
341341
# When provided, analysis and data_type both should be
342342
# provided (this is effectively doing an XOR)
343343
raise qdb.exceptions.QiitaDBArtifactCreationError(
@@ -476,7 +476,8 @@ def _associate_with_analysis(instance, analysis_id):
476476
instance = _common_creation_steps(
477477
artifact_type, None, data_type, None)
478478
# Associate the artifact with the analysis
479-
analysis.add_artifact(instance)
479+
if bool(analysis):
480+
analysis.add_artifact(instance)
480481

481482
# Associate the artifact with its filepaths
482483
fp_ids = qdb.util.insert_filepaths(

qiita_db/handlers/processing_job.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ def get(self, job_id):
7171
cmd = job.command.name
7272
params = job.parameters.values
7373
status = job.status
74+
msg = '' if status != 'error' else job.log.msg
7475

7576
response = {'command': cmd, 'parameters': params,
76-
'status': status}
77+
'status': status, 'msg': msg}
78+
7779
self.write(response)
7880

7981

qiita_db/handlers/tests/test_processing_job.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def test_get(self):
5151
"phred_quality_threshold": 3, "barcode_type": "golay_12",
5252
"max_barcode_errors": 1.5, "input_data": 1,
5353
'phred_offset': 'auto'}
54-
exp = {'command': cmd, 'parameters': params, 'status': 'success'}
54+
exp = {'command': cmd, 'parameters': params, 'status': 'success',
55+
'msg': ''}
5556
self.assertEqual(loads(obs.body), exp)
5657

5758
def test_get_no_header(self):

qiita_db/processing_job.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,11 +1197,15 @@ def _complete_artifact_definition(self, artifact_data):
11971197
AND processing_job_id = %s"""
11981198
qdb.sql_connection.TRN.add(sql, [an.id, self.id])
11991199
data_type = qdb.sql_connection.TRN.execute_fetchlast()
1200-
else:
1200+
elif job_params['template'] is not None:
12011201
pt = qdb.metadata_template.prep_template.PrepTemplate(
12021202
job_params['template'])
12031203
an = None
12041204
data_type = None
1205+
else:
1206+
pt = None
1207+
an = None
1208+
data_type = 'Job Output Folder'
12051209

12061210
qdb.artifact.Artifact.create(
12071211
filepaths, atype, prep_template=pt, analysis=an,

qiita_db/support_files/patches/83.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- August 16, 2021
2+
-- adding new artifact_type for raw_job_folder
3+
INSERT INTO qiita.data_type (data_type) VALUES ('Job Output Folder');

qiita_db/test/test_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def test_get_data_types(self):
156156
obs = qdb.util.get_data_types()
157157
exp = {'16S': 1, '18S': 2, 'ITS': 3, 'Proteomic': 4, 'Metabolomic': 5,
158158
'Metagenomic': 6, 'Multiomic': 7, 'Metatranscriptomics': 8,
159-
'Viromics': 9, 'Genomics': 10, 'Transcriptomics': 11}
159+
'Viromics': 9, 'Genomics': 10, 'Transcriptomics': 11,
160+
'Job Output Folder': 12}
160161
self.assertEqual(obs, exp)
161162

162163
obs = qdb.util.get_data_types(key='data_type_id')

qiita_pet/handlers/api_proxy/tests/test_prep_template.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ def test_new_prep_template_get_req(self):
5252
exp = {
5353
'status': 'success',
5454
'prep_files': ['uploaded_file.txt'],
55-
'data_types': ['16S', '18S', 'Genomics', 'ITS', 'Metabolomic',
56-
'Metagenomic', 'Metatranscriptomics', 'Multiomic',
57-
'Proteomic', 'Transcriptomics', 'Viromics'],
55+
'data_types': ['16S', '18S', 'Genomics', 'ITS',
56+
'Job Output Folder', 'Metabolomic',
57+
'Metagenomic', 'Metatranscriptomics',
58+
'Multiomic', 'Proteomic', 'Transcriptomics',
59+
'Viromics'],
5860
'ontology': {
5961
'ENA': ['Cancer Genomics', 'Epigenetics', 'Exome Sequencing',
6062
'Forensic or Paleo-genomics', 'Gene Regulation Study',

qiita_pet/handlers/study_handlers/tests/test_sample_template.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ def test_sample_template_overview_handler_get_request(self):
305305
obs = sample_template_overview_handler_get_request(new_study.id, user)
306306
exp = {'exists': False,
307307
'uploaded_files': [],
308-
'data_types': ['16S', '18S', 'Genomics', 'ITS', 'Metabolomic',
309-
'Metagenomic', 'Metatranscriptomics',
310-
'Multiomic', 'Proteomic', 'Transcriptomics',
311-
'Viromics'],
308+
'data_types': ['16S', '18S', 'Genomics', 'ITS',
309+
'Job Output Folder', 'Metabolomic',
310+
'Metagenomic', 'Metatranscriptomics',
311+
'Multiomic', 'Proteomic', 'Transcriptomics',
312+
'Viromics'],
312313
'user_can_edit': True,
313314
'job': None,
314315
'download_id': None,

qiita_pet/test/test_download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ def test_download(self):
425425
self.assertEqual(response.reason, 'Not a valid data_type. Valid types '
426426
'are: 16S, 18S, ITS, Proteomic, Metabolomic, '
427427
'Metagenomic, Multiomic, Metatranscriptomics, '
428-
'Viromics, Genomics, Transcriptomics')
428+
'Viromics, Genomics, Transcriptomics, '
429+
'Job Output Folder')
429430

430431
response = self.get(
431432
'/public_download/?data=raw&study_id=1&data_type=Genomics')

0 commit comments

Comments
 (0)