-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi @antgonza ,
in my local setup, one test for qp-target-gene fails. Namely
qp-target-gene/qp_target_gene/tests/test_pick_otus.py
Lines 100 to 139 in 858436e
| def test_pick_closed_reference_otus(self): | |
| # Create a new job | |
| data = {'user': '[email protected]', | |
| 'command': dumps(['QIIMEq2', '1.9.1', | |
| 'Pick closed-reference OTUs']), | |
| 'status': 'running', | |
| 'parameters': dumps(self.parameters)} | |
| job_id = self.qclient.post( | |
| '/apitest/processing_job/', data=data)['job'] | |
| # These filepaths do not exist in Qiita - create them | |
| fps = self.qclient.get('/qiita_db/artifacts/2/')['files'] | |
| fasta_fp = fps['preprocessed_fasta'][0]['filepath'] | |
| self.parameters['reference-seq'] = '/tmp/seq.fna' | |
| self.parameters['reference-tax'] = '/tmp/tax.txt' | |
| with open(fasta_fp, 'w') as f: | |
| f.write(READS) | |
| # self._clean_up_files.append(fasta_fp) | |
| with open(self.parameters['reference-seq'], 'w') as f: | |
| f.write(REF_SEQ) | |
| # self._clean_up_files.append(self.parameters['reference-seq']) | |
| with open(self.parameters['reference-tax'], 'w') as f: | |
| f.write(REF_TAX) | |
| # self._clean_up_files.append(self.parameters['reference-tax']) | |
| out_dir = mkdtemp() | |
| self._clean_up_files.append(out_dir) | |
| obs_success, obs_ainfo, obs_msg = pick_closed_reference_otus( | |
| self.qclient, job_id, self.parameters, out_dir) | |
| self.assertEqual(obs_msg, "") | |
| self.assertTrue(obs_success) | |
| path_builder = partial(join, out_dir, 'cr_otus') | |
| log_fp = glob(path_builder("log_*.txt"))[0] | |
| fps = [(path_builder("otu_table.biom"), "biom"), | |
| (path_builder("sortmerna_picked_otus"), "directory"), | |
| (path_builder("sortmerna_picked_otus.tgz"), "tgz"), | |
| (log_fp, "log")] | |
| exp_ainfo = [ArtifactInfo('OTU table', 'BIOM', fps)] | |
| self.assertEqual(obs_ainfo, exp_ainfo) |
Looking at the plugin configuration, I see parameters reference-seq and reference-tax:
qp-target-gene/qp_target_gene/__init__.py
Lines 148 to 149 in 858436e
| 'reference-seq': '/databases/gg/13_8/rep_set/97_otus.fasta', | |
| 'reference-tax': '/databases/gg/13_8/taxonomy/97_otu_taxonomy.txt', |
However, the populate_test_db.sql inserts a parameter reference, but not reference-seq nor reference-tax.
https://github.com/qiita-spots/qiita/blob/a34dcebc44ea6408340d31ecaf0efd1f78e3cc6b/qiita_db/support_files/populate_test_db.sql#L1818
Updating the plugin with config file information does not change values, I figure because a plugin with same name and version number already exists in the re-populated DB.
This issue might be arising from the larger change of the patch system: qiita-spots/qiita@7b9cb33 Not sure if you ever re-executed the qp-target-gene github tests after this change.
Full error message is below:
root@363bf284c221:/qp-target-gene# pytest qp_target_gene/tests/test_pick_otus.py
==================================== test session starts =====================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
rootdir: /qp-target-gene
collected 1 item
qp_target_gene/tests/test_pick_otus.py F [100%]
========================================== FAILURES ==========================================
_______________________ PickOTUsTests.test_pick_closed_reference_otus ________________________
self = <qp_target_gene.tests.test_pick_otus.PickOTUsTests testMethod=test_pick_closed_reference_otus>
def test_pick_closed_reference_otus(self):
# Create a new job
data = {'user': '[email protected]',
'command': dumps(['QIIMEq2', '1.9.1',
'Pick closed-reference OTUs']),
'status': 'running',
'parameters': dumps(self.parameters)}
job_id = self.qclient.post(
> '/apitest/processing_job/', data=data)['job']
qp_target_gene/tests/test_pick_otus.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python2.7/dist-packages/qiita_client/qiita_client.py:450: in post
self._session.post, url, rettype='json', **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <qiita_client.qiita_client.QiitaClient object at 0x731b17dd1fd0>
req = <bound method Session.post of <requests.sessions.Session object at 0x731b17dd1f10>>
url = 'https://tinqiita-qiita-1:21174/apitest/processing_job/', rettype = 'json'
kwargs = {'data': {'command': '["QIIMEq2", "1.9.1", "Pick closed-reference OTUs"]', 'parameters': '{"input_data": 2, "reference...overage": 0.97, "sortmerna_e_value": 1, "sortmerna_max_pos": 10000}', 'status': 'running', 'user': '[email protected]'}}
retries = 0, r = <Response [500]>
def _request_retry(self, req, url, rettype='json', **kwargs):
"""Executes a request retrying it 2 times in case of failure
Parameters
----------
req : function
The request to execute
rettype : string
The return type of the function, either "json" (default) or
if e.g. files are transferred "content"
url : str
The url to access in the server
kwargs : dict
The request kwargs
Returns
-------
dict or None or plain content IF rettype='content'
The JSON information in the request response, if any
Raises
------
NotFoundError
If the request returned a 404 error
BadRequestError
If the request returned a 400 error
ForbiddenError
If the request returned a 403 error
RuntimeError
If the request did not succeed due to unknown causes
Notes
-----
After doing some research on the topic, there are multiple ways of
engineering the number of times a request should be retried (multiple
sources - most of them on RPC systems). A short summary of those are:
1. Keep retrying indefinitely
2. The probability of retrying a request is based on the number of
retries already done, as well as the cost of a retry
3. Retry just once
Number 1 could create an infinite loop. Number 2 is too complex and
the cost of retrying depends on the actual work that we are currently
doing (which is unknown to the current function). We thus decided to
implement 3, which is simple and allows to overcome simple
communication problems.
"""
logger.debug('Entered QiitaClient._request_retry()')
url = self._server_url + url
retries = MAX_RETRIES
while retries > 0:
retries -= 1
r = self._request_oauth2(
req, rettype, url, verify=self._verify, **kwargs)
r.close()
# There are some error codes that the specification says that they
# shouldn't be retried
if r.status_code == 404:
raise NotFoundError(r.text)
elif r.status_code == 403:
raise ForbiddenError(r.text)
elif r.status_code == 400:
raise BadRequestError(r.text)
elif r.status_code in (500, 405):
raise RuntimeError(
"Request '%s %s' did not succeed. Status code: %d. "
> "Message: %s" % (req.__name__, url, r.status_code, r.text))
E RuntimeError: Request 'post https://tinqiita-qiita-1:21174/apitest/processing_job/' did not succeed. Status code: 500. Message: The provided JSON string doesn't encode a parameter set for command 3. Extra parameters: reference-tax, reference-seq
/usr/local/lib/python2.7/dist-packages/qiita_client/qiita_client.py:387: RuntimeError
----------------------------------- Captured stderr setup ------------------------------------
2025-09-09 21:01:49,196 qiita_client.testing DEBUG Entered PluginTestCase.setUpClass()
2025-09-09 21:01:49,200 qiita_client.qiita_client DEBUG Entered QiitaClient._fetch_token()
2025-09-09 21:01:49,200 qiita_client.qiita_client DEBUG data = {'client_secret': 'J7FfQ7CQdOxuKhQAf1eoGgBAE81Ns8Gu3EKaWFm3IO2JKhAmmCWZuabe0O5Mp28s1', 'grant_type': 'client', 'client_id': '19ndkO3oMKsoChjVVWluF7QkxHRfYhTKSFbAVt8IhK7gZgDaO4'}
2025-09-09 21:01:49,200 qiita_client.qiita_client DEBUG authenticate_url = https://tinqiita-qiita-1:21174/qiita_db/authenticate/
2025-09-09 21:01:49,200 qiita_client.qiita_client DEBUG verify = True
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG status code = 200
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG RESULT.JSON() = {u'access_token': u'wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa', u'token_type': u'Bearer', u'expires_in': 3600}
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG access_token = wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa
2025-09-09 21:01:49,215 qiita_client.testing DEBUG PluginTestCase.setUpClass() token wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG Entered QiitaClient.post(/apitest/reload_plugins/)
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG Entered QiitaClient._request_retry()
2025-09-09 21:01:49,215 qiita_client.qiita_client DEBUG Entered QiitaClient._request_oauth2()
------------------------------------- Captured log setup -------------------------------------
DEBUG qiita_client.testing:testing.py:24 Entered PluginTestCase.setUpClass()
DEBUG qiita_client.qiita_client:qiita_client.py:235 Entered QiitaClient._fetch_token()
DEBUG qiita_client.qiita_client:qiita_client.py:240 data = {'client_secret': 'J7FfQ7CQdOxuKhQAf1eoGgBAE81Ns8Gu3EKaWFm3IO2JKhAmmCWZuabe0O5Mp28s1', 'grant_type': 'client', 'client_id': '19ndkO3oMKsoChjVVWluF7QkxHRfYhTKSFbAVt8IhK7gZgDaO4'}
DEBUG qiita_client.qiita_client:qiita_client.py:241 authenticate_url = https://tinqiita-qiita-1:21174/qiita_db/authenticate/
DEBUG qiita_client.qiita_client:qiita_client.py:242 verify = True
DEBUG qiita_client.qiita_client:qiita_client.py:248 status code = 200
DEBUG qiita_client.qiita_client:qiita_client.py:253 RESULT.JSON() = {u'access_token': u'wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa', u'token_type': u'Bearer', u'expires_in': 3600}
DEBUG qiita_client.qiita_client:qiita_client.py:255 access_token = wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa
DEBUG qiita_client.testing:testing.py:37 PluginTestCase.setUpClass() token wlOjRSuh0s8vPoM61PBUL6OfqeDHMjGheg5819hdmwEwpgbh568TLIa
DEBUG qiita_client.qiita_client:qiita_client.py:448 Entered QiitaClient.post(/apitest/reload_plugins/)
DEBUG qiita_client.qiita_client:qiita_client.py:368 Entered QiitaClient._request_retry()
DEBUG qiita_client.qiita_client:qiita_client.py:282 Entered QiitaClient._request_oauth2()
------------------------------------ Captured stderr call ------------------------------------
2025-09-09 21:02:55,220 qiita_client.qiita_client DEBUG Entered QiitaClient.post(/apitest/processing_job/)
2025-09-09 21:02:55,220 qiita_client.qiita_client DEBUG Entered QiitaClient._request_retry()
2025-09-09 21:02:55,220 qiita_client.qiita_client DEBUG Entered QiitaClient._request_oauth2()
------------------------------------- Captured log call --------------------------------------
DEBUG qiita_client.qiita_client:qiita_client.py:448 Entered QiitaClient.post(/apitest/processing_job/)
DEBUG qiita_client.qiita_client:qiita_client.py:368 Entered QiitaClient._request_retry()
DEBUG qiita_client.qiita_client:qiita_client.py:282 Entered QiitaClient._request_oauth2()
---------------------------------- Captured stderr teardown ----------------------------------
2025-09-09 21:02:55,284 qiita_client.testing DEBUG Entered PluginTestCase.tearDownClass()
2025-09-09 21:02:55,284 qiita_client.qiita_client DEBUG Entered QiitaClient.post(/apitest/reset/)
2025-09-09 21:02:55,284 qiita_client.qiita_client DEBUG Entered QiitaClient._request_retry()
2025-09-09 21:02:55,284 qiita_client.qiita_client DEBUG Entered QiitaClient._request_oauth2()
----------------------------------- Captured log teardown ------------------------------------
DEBUG qiita_client.testing:testing.py:44 Entered PluginTestCase.tearDownClass()
DEBUG qiita_client.qiita_client:qiita_client.py:448 Entered QiitaClient.post(/apitest/reset/)
DEBUG qiita_client.qiita_client:qiita_client.py:368 Entered QiitaClient._request_retry()
DEBUG qiita_client.qiita_client:qiita_client.py:282 Entered QiitaClient._request_oauth2()
====================================== warnings summary ======================================
qp_target_gene/tests/test_pick_otus.py::PickOTUsTests::test_pick_closed_reference_otus
qp_target_gene/tests/test_pick_otus.py::PickOTUsTests::test_pick_closed_reference_otus
/usr/local/lib/python2.7/dist-packages/requests/models.py:915: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
raise RequestsJSONDecodeError(e.message)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================== 1 failed, 2 warnings in 67.27 seconds ============================