Beispiel #1
0
    def test_execute_job_error(self):
        # Create a prep template
        prep_info = {'SKB8.640193': {'col': 'val1'},
                     'SKD8.640184': {'col': 'val2'}}
        data = {'prep_info': dumps(prep_info),
                'study': 1,
                'data_type': '16S'}
        template = self.qclient.post(
            '/apitest/prep_template/', data=data)['prep']
        # Create a new validate job
        fd, biom_fp = mkstemp(suffix=".biom")
        close(fd)
        data = np.random.randint(100, size=(2, 2))
        table = Table(data, ['O1', 'O2'], ['S1', 'S2'])
        with biom_open(biom_fp, 'w') as f:
            table.to_hdf5(f, "Test")
        data = {'command': dumps(['BIOM type', '2.1.4', 'Validate']),
                'parameters': dumps(
                    {'files': dumps({'biom': [biom_fp]}),
                     'template': template,
                     'artifact_type': 'BIOM'}),
                'artifact_type': 'BIOM',
                'status': 'queued'}
        job_id = self.qclient.post(
            '/apitest/processing_job/', data=data)['job']

        plugin("https://localhost:21174", job_id, self.out_dir)
        obs = self._wait_job(job_id)
        self.assertEqual(obs, 'error')
Beispiel #2
0
    def test_execute_job_summary(self):
        # Create a summary job
        data = {'command': dumps(['BIOM type', '2.1.4',
                                  'Generate HTML summary']),
                'parameters': dumps({'input_data': 4}),
                'status': 'queued'}
        job_id = self.qclient.post(
            '/apitest/processing_job/', data=data)['job']

        plugin("https://localhost:21174", job_id, self.out_dir)

        obs = self._wait_job(job_id)
        self.assertEqual(obs, 'success')
Beispiel #3
0
    def test_execute_job_summary(self):
        # Create a summary job
        data = {
            'command': dumps(['BIOM type', '2.1.4', 'Generate HTML summary']),
            'parameters': dumps({'input_data': 4}),
            'status': 'queued'
        }
        job_id = self.qclient.post('/apitest/processing_job/',
                                   data=data)['job']

        plugin("https://localhost:21174", job_id, self.out_dir)

        obs = self._wait_job(job_id)
        self.assertEqual(obs, 'success')
Beispiel #4
0
    def test_execute_job_error(self):
        # Create a prep template
        prep_info = {
            'SKB8.640193': {
                'col': 'val1'
            },
            'SKD8.640184': {
                'col': 'val2'
            }
        }
        data = {'prep_info': dumps(prep_info), 'study': 1, 'data_type': '16S'}
        template = self.qclient.post('/apitest/prep_template/',
                                     data=data)['prep']
        # Create a new validate job
        fd, biom_fp = mkstemp(suffix=".biom")
        close(fd)
        data = np.random.randint(100, size=(2, 2))
        table = Table(data, ['O1', 'O2'], ['S1', 'S2'])
        with biom_open(biom_fp, 'w') as f:
            table.to_hdf5(f, "Test")
        data = {
            'command':
            dumps(['BIOM type', '2.1.4 - Qiime2', 'Validate']),
            'parameters':
            dumps({
                'files': dumps({'biom': [biom_fp]}),
                'template': template,
                'artifact_type': 'BIOM'
            }),
            'artifact_type':
            'BIOM',
            'status':
            'queued'
        }
        job_id = self.qclient.post('/apitest/processing_job/',
                                   data=data)['job']

        plugin("https://localhost:8383", job_id, self.out_dir)
        obs = self._wait_job(job_id)

        self.assertEqual(obs, 'error')