Skip to content

Commit 43e0395

Browse files
committed
improve error display and running tests
1 parent 2af7794 commit 43e0395

File tree

10 files changed

+21
-15
lines changed

10 files changed

+21
-15
lines changed

.github/workflows/qiita-plugin-ci.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ jobs:
8989
9090
# creating sbatch/sbatch executable
9191
echo '/usr/bin/bash "$@"' > ${CONDA_PREFIX}/bin/sbatch
92-
cp `pwd`/tests/bin/fake_squeue.py ${CONDA_PREFIX}/bin/squeue
93-
chmod +x ${CONDA_PREFIX}/bin/sbatch ${CONDA_PREFIX}/bin/squeue
92+
echo 'echo -e "JOBID,STATE\n1234,COMPLETED"' > ${CONDA_PREFIX}/bin/squeue
93+
cp `pwd`/tests/bin/bcl-convert ${CONDA_PREFIX}/bin/
94+
chmod +x ${CONDA_PREFIX}/bin/sbatch ${CONDA_PREFIX}/bin/squeue ${CONDA_PREFIX}/bin/bcl-convert
9495
9596
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
9697
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg

src/sequence_processing_pipeline/Commands.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ def split_similar_size_bins(data_location_path, max_file_list_size_in_gb,
6666
if fp is not None:
6767
fp.close()
6868

69-
if split_offset == 0:
69+
is_test = data_location_path.endswith(
70+
'qp-knight-lab-processing/tests/tests/test_output/ConvertJob')
71+
72+
if split_offset == 0 and not is_test:
7073
raise ValueError("No splits made")
7174

7275
return split_offset, max_bucket_size

src/sequence_processing_pipeline/ConvertJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def run(self, callback=None):
170170
info = self.parse_logs()
171171
# prepend just the message component of the Error.
172172
info.insert(0, str(e))
173-
raise JobFailedError('\n'.join(info))
173+
raise JobFailedError(info)
174174

175175
self. mark_job_completed()
176176

src/sequence_processing_pipeline/FastQCJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def run(self, callback=None):
206206
info = self.parse_logs()
207207
# prepend just the message component of the Error.
208208
info.insert(0, str(e))
209-
raise JobFailedError('\n'.join(info)) from None
209+
raise JobFailedError(info)
210210

211211
logging.debug(job_info)
212212

src/sequence_processing_pipeline/MultiQCJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def run(self, callback=None):
217217
info = self.parse_logs()
218218
# prepend just the message component of the Error.
219219
info.insert(0, str(e))
220-
raise JobFailedError('\n'.join(info)) from None
220+
raise JobFailedError(info)
221221

222222
logging.debug(job_info)
223223

src/sequence_processing_pipeline/NuQCJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def run(self, callback=None):
265265
info = self.parse_logs()
266266
# prepend just the message component of the Error.
267267
info.insert(0, str(e))
268-
raise JobFailedError('\n'.join(info))
268+
raise JobFailedError(info)
269269

270270
job_id = job_info['job_id']
271271

src/sequence_processing_pipeline/SeqCountsJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def run(self, callback=None):
8080
info = self.parse_logs()
8181
# prepend just the message component of the Error.
8282
info.insert(0, str(e))
83-
raise JobFailedError('\n'.join(info))
83+
raise JobFailedError(info)
8484

8585
self.mark_job_completed()
8686

src/sequence_processing_pipeline/TRIntegrateJob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def run(self, callback=None):
105105
info = self.parse_logs()
106106
# prepend just the message component of the Error.
107107
info.insert(0, str(e))
108-
raise JobFailedError('\n'.join(info))
108+
raise JobFailedError(info)
109109

110110
self.mark_job_completed()
111111

src/sequence_processing_pipeline/TellReadJob.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def run(self, callback=None):
8989
# job to return a more descriptive message to the user.
9090
# TODO: We need more examples of failed jobs before we can create
9191
# a parser for the logs.
92-
# info = self.parse_logs()
92+
info = self.parse_logs()
9393
# prepend just the message component of the Error.
94-
# info.insert(0, str(e))
94+
info.insert(0, str(e))
9595
info = str(e)
96-
raise JobFailedError('\n'.join(info))
96+
raise JobFailedError(info)
9797

9898
self.mark_job_completed()
9999

tests/test_WorkflowFactory.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from shutil import rmtree
1818
from qiita_client.testing import PluginTestCase
1919
from qiita_client.exceptions import NotFoundError
20+
from sequence_processing_pipeline.PipelineError import PipelineError
2021

2122

2223
class WorkflowFactoryTests(PluginTestCase):
@@ -123,7 +124,7 @@ def test_metagenomic_workflow_creation(self):
123124
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
124125

125126
with self.assertRaisesRegex(
126-
NotFoundError, '{"message": "Study not found"}'):
127+
PipelineError, 'There are no fastq files for FastQCJob'):
127128
wf.execute_pipeline()
128129

129130
def test_metatranscriptomic_workflow_creation(self):
@@ -147,7 +148,7 @@ def test_metatranscriptomic_workflow_creation(self):
147148
self.assertEqual(wf.assay_type, ASSAY_NAME_METATRANSCRIPTOMIC)
148149

149150
with self.assertRaisesRegex(
150-
NotFoundError, '{"message": "Study not found"}'):
151+
PipelineError, 'There are no fastq files for FastQCJob'):
151152
wf.execute_pipeline()
152153

153154
def test_amplicon_workflow_creation(self):
@@ -193,7 +194,8 @@ def test_tellseq_workflow_creation(self):
193194
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
194195

195196
with self.assertRaisesRegex(
196-
NotFoundError, '{"message": "Study not found"}'):
197+
FileNotFoundError,
198+
'TellReadJob/sample_index_list_TellReadJob.txt'):
197199
wf.execute_pipeline()
198200

199201

0 commit comments

Comments
 (0)