Skip to content

Commit 9e10d9c

Browse files
authored
Merge pull request #2345 from biocore/fix-ebi-1012
fix calls to system_call and ebi submissions
2 parents 18b3ed5 + d721f85 commit 9e10d9c

File tree

6 files changed

+35
-50
lines changed

6 files changed

+35
-50
lines changed

qiita_pet/handlers/study_handlers/ebi_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def post(self, preprocessed_data_id):
124124
study = Artifact(preprocessed_data_id).study
125125
state = study.ebi_submission_status
126126
if state == 'submitting':
127-
level = 'danger'
128127
message = "Cannot resubmit! Current state is: %s" % state
128+
self.display_template(preprocessed_data_id, message, 'danger')
129129
else:
130130
qiita_plugin = Software.from_name_and_version('Qiita', 'alpha')
131131
cmd = qiita_plugin.get_command('submit_to_EBI')

qiita_pet/support_files/doc/source/tutorials/prepare-information-files.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ Without this columns you will not be able to submit to EBI. These are the column
177177

178178
Valid values for instrument_model per platform, taken from ftp://ftp.sra.ebi.ac.uk/meta/xsd/sra_1_5/SRA.common.xsd
179179

180-
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
181-
| Platform | Valid instrument_model options |
182-
+==============+==================================================================================================================================================================================================================================================================================================+
183-
| ``LS454`` | ``454 GS``, ``454 GS 20``, ``454 GS FLX``, ``454 GS FLX+``, ``454 GS FLX Titanium``, ``454 GS Junior``, or ``unspecified`` |
184-
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
180+
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
181+
| Platform | Valid instrument_model options |
182+
+==============+===================================================================================================================================================================================================================================================================================================+
183+
| ``LS454`` | ``454 GS``, ``454 GS 20``, ``454 GS FLX``, ``454 GS FLX+``, ``454 GS FLX Titanium``, ``454 GS Junior``, or ``unspecified`` |
184+
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
185185
| ``Illumina`` | ``Illumina Genome Analyzer``, ``Illumina Genome Analyzer II``, ``Illumina Genome Analyzer IIx``, ``Illumina HiSeq 2500``, ``Illumina HiSeq 2000``, ``Illumina HiSeq 1500``, ``Illumina HiSeq 1000``, ``Illumina MiSeq``, ``Illumina HiScanSQ``, ``HiSeq X Ten``, ``NextSeq 500``, ``unspecified`` |
186-
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
186+
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
187187

188188
.. _required-fields-for-preprocessing-target-gene-data:
189189

qiita_pet/test/test_download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_download_study(self):
140140
'[0-9]*.txt mapping_files/6_mapping_file.txt\n'
141141
'- 36615 /protected/templates/1_prep_2_qiime_[0-9]*-'
142142
'[0-9]*.txt mapping_files/7_mapping_file.txt\n'
143-
'- 39752 /protected/BIOM/{0}/otu_table.biom '
143+
'- [0-9]* /protected/BIOM/{0}/otu_table.biom '
144144
'BIOM/{0}/otu_table.biom\n'
145145
'- 1 /protected/BIOM/{0}/sortmerna_picked_otus/seqs_otus.log '
146146
'BIOM/{0}/sortmerna_picked_otus/seqs_otus.log\n'
@@ -161,7 +161,7 @@ def test_download_study(self):
161161
response = self.get('/download_study_bioms/1')
162162
self.assertEqual(response.code, 200)
163163
exp = (
164-
'- 39752 /protected/BIOM/{0}/otu_table.biom '
164+
'- [0-9]* /protected/BIOM/{0}/otu_table.biom '
165165
'BIOM/{0}/otu_table.biom\n'
166166
'- 1 /protected/BIOM/{0}/sortmerna_picked_otus/seqs_otus.log '
167167
'BIOM/{0}/sortmerna_picked_otus/seqs_otus.log\n'

qiita_ware/commands.py

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,15 @@ def submit_EBI(preprocessed_data_id, action, send):
6161
LogEntry.create('Runtime',
6262
("Submitting sequences for pre_processed_id: "
6363
"%d" % preprocessed_data_id))
64-
try:
65-
for cmd in ebi_submission.generate_send_sequences_cmd():
66-
try:
67-
stdout, stderr, _ = system_call(cmd)
68-
except Exception as e:
69-
stdout = ''
70-
stderr = str(e)
71-
le = LogEntry.create(
72-
'Fatal', "Command: %s\nError: %s\n" % (cmd,
73-
str(e)),
74-
info={'ebi_submission': preprocessed_data_id})
75-
ebi_submission.study.ebi_submission_status = (
76-
"failed: ASCP submission, log id: %d" % le.id)
77-
raise ComputeError("EBI Submission failed! Log id: "
78-
"%d" % le.id)
79-
finally:
80-
open(ebi_submission.ascp_reply, 'a').write(
81-
'stdout:\n%s\n\nstderr: %s' % (stdout, stderr))
82-
finally:
83-
environ['ASPERA_SCP_PASS'] = old_ascp_pass
64+
for cmd in ebi_submission.generate_send_sequences_cmd():
65+
stdout, stderr, rv = system_call(cmd)
66+
if rv != 0:
67+
error_msg = ("Error:\nStd output:%s\nStd error:%s" % (
68+
stdout, stderr))
69+
raise ComputeError(error_msg)
70+
open(ebi_submission.ascp_reply, 'a').write(
71+
'stdout:\n%s\n\nstderr: %s' % (stdout, stderr))
72+
environ['ASPERA_SCP_PASS'] = old_ascp_pass
8473
LogEntry.create('Runtime',
8574
('Submission of sequences of pre_processed_id: '
8675
'%d completed successfully' %
@@ -91,25 +80,18 @@ def submit_EBI(preprocessed_data_id, action, send):
9180
LogEntry.create('Runtime',
9281
("Submitting XMLs for pre_processed_id: "
9382
"%d" % preprocessed_data_id))
94-
try:
95-
xml_content, stderr, _ = system_call(xmls_cmds)
96-
except Exception as e:
97-
xml_content = ''
98-
stderr = str(e)
99-
le = LogEntry.create(
100-
'Fatal', "Command: %s\nError: %s\n" % (cmd, str(e)),
101-
info={'ebi_submission': preprocessed_data_id})
102-
ebi_submission.study.ebi_submission_status = (
103-
"failed: XML submission, log id: %d" % le.id)
104-
raise ComputeError("EBI Submission failed! Log id: %d" % le.id)
83+
xml_content, stderr, rv = system_call(xmls_cmds)
84+
if rv != 0:
85+
error_msg = ("Error:\nStd output:%s\nStd error:%s" % (
86+
xml_content, stderr))
87+
raise ComputeError(error_msg)
10588
else:
10689
LogEntry.create('Runtime',
10790
('Submission of sequences of pre_processed_id: '
10891
'%d completed successfully' %
10992
preprocessed_data_id))
110-
finally:
111-
open(ebi_submission.curl_reply, 'w').write(
112-
'stdout:\n%s\n\nstderr: %s' % (xml_content, stderr))
93+
open(ebi_submission.curl_reply, 'w').write(
94+
'stdout:\n%s\n\nstderr: %s' % (xml_content, stderr))
11395

11496
try:
11597
st_acc, sa_acc, bio_acc, ex_acc, run_acc = \
@@ -198,7 +180,10 @@ def submit_VAMPS(artifact_id):
198180
qiita_config.vamps_pass,
199181
targz_fp,
200182
qiita_config.vamps_url))
201-
obs, _, _ = system_call(cmd)
183+
obs, stderr, rv = system_call(cmd)
184+
if rv != 0:
185+
error_msg = ("Error:\nStd output:%s\nStd error:%s" % (obs, stderr))
186+
raise ComputeError(error_msg)
202187

203188
exp = ("<html>\n<head>\n<title>Process Uploaded File</title>\n</head>\n"
204189
"<body>\n</body>\n</html>")

qiita_ware/private_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def submit_to_EBI(job):
9797
param_vals = job.parameters.values
9898
artifact_id = int(param_vals['artifact'])
9999
submission_type = param_vals['submission_type']
100-
submit_EBI(artifact_id, submission_type, False)
100+
submit_EBI(artifact_id, submission_type, True)
101101
job._set_status('success')
102102

103103

scripts/qiita

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def webserver(build_docs):
6161
sphinx_fp = join(base, 'support_files/doc/')
6262
cmd = 'make -C %s html' % sphinx_fp
6363
print('Building documentation ...')
64-
try:
65-
qdb.processing_job._system_call(cmd)
66-
except Exception as e:
67-
raise click.ClickException('Could not build documentation: %s' %
68-
str(e))
64+
stdout, stderr, rv = qdb.processing_job._system_call(cmd)
65+
if rv != 0:
66+
raise click.ClickException(
67+
'Could not build documentation:\n'
68+
'Std output:%s\nStd error:%s' % (stdout, stderr))
6969
else:
7070
print('Documentation successfully built')
7171

0 commit comments

Comments
 (0)