Skip to content

Commit 49297d0

Browse files
authored
Merge pull request #603 from biocore/csymons_bypass_qiita
Bypass Qiita
2 parents 5b60918 + b920b1f commit 49297d0

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

microsetta_private_api/api/_sample.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import flask
22
from flask import jsonify
3-
from qiita_client import NotFoundError, BadRequestError, \
4-
ForbiddenError
3+
# from qiita_client import NotFoundError, BadRequestError, \
4+
# ForbiddenError
55
from werkzeug.exceptions import BadRequest
66

77
from microsetta_private_api.api._account import _validate_account_access
@@ -17,7 +17,7 @@
1717
from microsetta_private_api.admin.admin_impl import token_grants_admin_access
1818
from microsetta_private_api.qiita import qclient
1919

20-
from flask import current_app as app
20+
# from flask import current_app as app
2121
from datetime import datetime
2222
from dateutil.relativedelta import relativedelta
2323

@@ -61,6 +61,7 @@ def read_sample_association(account_id, source_id, sample_id, token_info):
6161
if sample is None:
6262
return jsonify(code=404, message="Sample not found"), 404
6363

64+
"""
6465
qiita_body = {
6566
'sample_ids': ["10317." + str(sample.barcode)]
6667
}
@@ -93,8 +94,8 @@ def read_sample_association(account_id, source_id, sample_id, token_info):
9394
except RuntimeError:
9495
# How do I log these to gunicorn??
9596
app.logger.warning("Couldn't communicate with qiita", exc_info=True)
96-
raise
97-
97+
pass
98+
"""
9899
return jsonify(sample.to_api()),
99100

100101

@@ -244,3 +245,17 @@ def get_preparations(sample_barcode):
244245
preps = r.list_preparations(sample_barcode)
245246
preps_api = [p.to_api() for p in preps]
246247
return jsonify(preps_api), 200
248+
249+
250+
def use_qclient(sample_barcode):
251+
# NB: Do not use this function. It's a temporary workaround to bypass
252+
# qiita in production code, but keep the qclient import so that all of
253+
# our tests won't break.
254+
qiita_body = {
255+
'sample_ids': ["10317." + str(sample_barcode)]
256+
}
257+
258+
_ = qclient.post(
259+
'/api/v1/study/10317/samples/status',
260+
json=qiita_body
261+
)

microsetta_private_api/celery_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def __call__(self, *args, **kwargs):
3737
"task": "microsetta_private_api.admin.daklapack_polling.poll_dak_orders", # noqa
3838
"schedule": 60 * 60 * 4 # every 4 hours
3939
},
40-
"update_qiita_metadata": {
41-
"task": "microsetta_private_api.tasks.update_qiita_metadata", # noqa
42-
"schedule": 60 * 60 * 24 # every 24 hours
43-
},
40+
# "update_qiita_metadata": {
41+
# "task": "microsetta_private_api.tasks.update_qiita_metadata", # noqa
42+
# "schedule": 60 * 60 * 24 # every 24 hours
43+
# },
4444
"pull_fundrazr_transactions": {
4545
"task": "microsetta_private_api.util.fundrazr.get_fundrazr_transactions", # noqa
4646
"schedule": 60 * 60 # every hour

microsetta_private_api/celery_worker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
from microsetta_private_api.admin.daklapack_polling import poll_dak_orders
55
from microsetta_private_api.util.fundrazr import get_fundrazr_transactions
66
from microsetta_private_api.util.perk_fulfillment import check_shipping_updates
7-
from microsetta_private_api.tasks import update_qiita_metadata
7+
# from microsetta_private_api.tasks import update_qiita_metadata
88
init_celery(celery, app.app)
99

1010
# Run any celery tasks that require initialization on worker start
1111
refresh_headers.delay() # Initialize the vioscreen task with a token
1212
poll_dak_orders.delay() # check for orders
1313
get_fundrazr_transactions.delay() # check for new transactions
1414
check_shipping_updates.delay() # check for tracking updates
15-
update_qiita_metadata.delay() # run Qiita metadata push
15+
# update_qiita_metadata.delay() # run Qiita metadata push

0 commit comments

Comments
 (0)