Skip to content

Commit cc97e89

Browse files
committed
fix calls to system_call and ebi submissions
1 parent 18b3ed5 commit cc97e89

File tree

3 files changed

+27
-35
lines changed

3 files changed

+27
-35
lines changed

qiita_ware/commands.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,19 @@ 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+
le = LogEntry.create(
68+
'Fatal', "Command: %s\nError: %s\n" % (cmd, stderr),
69+
info={'ebi_submission': preprocessed_data_id})
70+
ebi_submission.study.ebi_submission_status = (
71+
"failed: ASCP submission, log id: %d" % le.id)
72+
raise ComputeError("EBI Submission failed! Log id: "
73+
"%d" % le.id)
74+
open(ebi_submission.ascp_reply, 'a').write(
75+
'stdout:\n%s\n\nstderr: %s' % (stdout, stderr))
76+
environ['ASPERA_SCP_PASS'] = old_ascp_pass
8477
LogEntry.create('Runtime',
8578
('Submission of sequences of pre_processed_id: '
8679
'%d completed successfully' %
@@ -91,13 +84,11 @@ def submit_EBI(preprocessed_data_id, action, send):
9184
LogEntry.create('Runtime',
9285
("Submitting XMLs for pre_processed_id: "
9386
"%d" % preprocessed_data_id))
94-
try:
95-
xml_content, stderr, _ = system_call(xmls_cmds)
96-
except Exception as e:
87+
xml_content, stderr, rv = system_call(xmls_cmds)
88+
if rv != 0:
9789
xml_content = ''
98-
stderr = str(e)
9990
le = LogEntry.create(
100-
'Fatal', "Command: %s\nError: %s\n" % (cmd, str(e)),
91+
'Fatal', "Command: %s\nError: %s\n" % (cmd, stderr),
10192
info={'ebi_submission': preprocessed_data_id})
10293
ebi_submission.study.ebi_submission_status = (
10394
"failed: XML submission, log id: %d" % le.id)
@@ -107,9 +98,8 @@ def submit_EBI(preprocessed_data_id, action, send):
10798
('Submission of sequences of pre_processed_id: '
10899
'%d completed successfully' %
109100
preprocessed_data_id))
110-
finally:
111-
open(ebi_submission.curl_reply, 'w').write(
112-
'stdout:\n%s\n\nstderr: %s' % (xml_content, stderr))
101+
open(ebi_submission.curl_reply, 'w').write(
102+
'stdout:\n%s\n\nstderr: %s' % (xml_content, stderr))
113103

114104
try:
115105
st_acc, sa_acc, bio_acc, ex_acc, run_acc = \
@@ -198,7 +188,9 @@ def submit_VAMPS(artifact_id):
198188
qiita_config.vamps_pass,
199189
targz_fp,
200190
qiita_config.vamps_url))
201-
obs, _, _ = system_call(cmd)
191+
obs, stderr, rv = system_call(cmd)
192+
if rv != 0:
193+
raise ComputeError('Error: \nstderr: %s' % stderr)
202194

203195
exp = ("<html>\n<head>\n<title>Process Uploaded File</title>\n</head>\n"
204196
"<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)