aboutsummaryrefslogtreecommitdiff
path: root/bh20sequploader
diff options
context:
space:
mode:
authorPjotr Prins2020-05-29 08:29:07 -0500
committerPjotr Prins2020-05-29 08:29:07 -0500
commitcc5db1777ad7334243dff0d9a0bbacea417b5ffb (patch)
tree62ed1869435d754a3173cd73fd4a7766f3bb166d /bh20sequploader
parent2bcf4c45eaba42b36cff93c9cd5e461baaf3eae1 (diff)
downloadbh20-seq-resource-cc5db1777ad7334243dff0d9a0bbacea417b5ffb.tar.gz
bh20-seq-resource-cc5db1777ad7334243dff0d9a0bbacea417b5ffb.tar.lz
bh20-seq-resource-cc5db1777ad7334243dff0d9a0bbacea417b5ffb.zip
Improved error output for the web uploader
Diffstat (limited to 'bh20sequploader')
-rw-r--r--bh20sequploader/main.py15
-rw-r--r--bh20sequploader/qc_fasta.py5
2 files changed, 15 insertions, 5 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py
index 2cd15c2..a2e62fa 100644
--- a/bh20sequploader/main.py
+++ b/bh20sequploader/main.py
@@ -31,16 +31,23 @@ def main():
api = arvados.api(host=ARVADOS_API_HOST, token=ARVADOS_API_TOKEN, insecure=True)
- log.debug("Checking metadata")
- if not qc_metadata(args.metadata.name):
- log.warning("Failed metadata qc")
+ try:
+ log.debug("Checking metadata")
+ if not qc_metadata(args.metadata.name):
+ log.warning("Failed metadata qc")
+ exit(1)
+ except ValueError as e:
+ log.debug(e)
+ log.debug("Failed metadata qc")
+ print(e)
exit(1)
try:
log.debug("Checking FASTA QC")
target = qc_fasta(args.sequence)
except ValueError as e:
- log.warning("Failed FASTA qc")
+ log.debug(e)
+ log.debug("Failed FASTA qc")
print(e)
exit(1)
diff --git a/bh20sequploader/qc_fasta.py b/bh20sequploader/qc_fasta.py
index 16cf2c9..5c8cf3a 100644
--- a/bh20sequploader/qc_fasta.py
+++ b/bh20sequploader/qc_fasta.py
@@ -6,6 +6,8 @@ import tempfile
import logging
import re
+log = logging.getLogger(__name__ )
+
def read_fasta(sequence):
entries = 0
bases = []
@@ -17,11 +19,12 @@ def read_fasta(sequence):
else:
bases.append(line)
if entries > 1:
+ log.debug("FASTA file contains multiple entries")
raise ValueError("FASTA file contains multiple entries")
- break
return label, bases
def qc_fasta(sequence):
+ log.debug("Starting qc_fasta")
schema_resource = pkg_resources.resource_stream(__name__, "validation/formats")
with tempfile.NamedTemporaryFile() as tmp:
tmp.write(schema_resource.read())