Skip to content

Commit

Permalink
Merge pull request #199 from hubmapconsortium/test-release
Browse files Browse the repository at this point in the history
v2.0.26 release
  • Loading branch information
yuanzhou authored Apr 7, 2022
2 parents 79bff51 + c89fbbe commit 10d5a02
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.25
2.0.26
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ services:
networks:
- gateway_hubmap
volumes:
# Mount the directory of requests_cache generated sqlite database
- "./hubmap-auth/requests_cache:/usr/src/app/requests_cache"
# Make the uwsgi/nginx log files generated on container available through from host
- "./hubmap-auth/log:/usr/src/app/log"
# favicon.ico and portal/ingest UI maintenance page
Expand Down
Empty file.
22 changes: 0 additions & 22 deletions hubmap-auth/src/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from flask import Flask, request, jsonify, make_response, Response, render_template
import requests
import requests_cache
# Don't confuse urllib (Python native library) with urllib3 (3rd-party library, requests also uses urllib3)
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import re
Expand Down Expand Up @@ -47,11 +46,6 @@
# Here we use two hours, 7200 seconds for ttl
cache = TTLCache(maxsize=app.config['CACHE_MAXSIZE'], ttl=app.config['CACHE_TTL'])

# Requests cache generates the sqlite file
# File path defined in app.config['REQUESTS_CACHE_SQLITE_NAME'] without the .sqlite extension
# Use the same CACHE_TTL from configuration
requests_cache.install_cache(app.config['REQUESTS_CACHE_SQLITE_NAME'], backend='sqlite', expire_after=app.config['CACHE_TTL'])

# Suppress InsecureRequestWarning warning when requesting status on https with ssl cert verify disabled
requests.packages.urllib3.disable_warnings(category = InsecureRequestWarning)

Expand Down Expand Up @@ -592,9 +586,6 @@ def get_file_access(uuid, token_from_query, request):
# Possible response status codes: 200, 401, and 500 to be handled below
response = requests.get(url = entity_api_full_url, headers = request_headers, verify = False)

# Verify if the cached response from the SQLite database being used
verify_request_cache(entity_api_full_url, response.from_cache)

# Using the globus app secret as internal token should always return 200 supposedly
# If not, either technical issue 500 or something wrong with this internal token 401
if response.status_code == 200:
Expand Down Expand Up @@ -819,9 +810,6 @@ def get_entity_uuid_by_file_uuid(uuid):
uuid_api_file_url = f"{app.config['UUID_API_URL']}/file-id/{uuid}"
response = requests.get(url = uuid_api_file_url, headers = request_headers, verify = False)

# Verify if the cached response from the SQLite database being used
verify_request_cache(uuid_api_file_url, response.from_cache)

# 200: this given uuid is a file uuid
# 404: either the given uuid does not exist or it's not a file uuid
if response.status_code == 200:
Expand Down Expand Up @@ -869,9 +857,6 @@ def get_entity_uuid_by_file_uuid(uuid):
uuid_api_entity_url = f"{app.config['UUID_API_URL']}/hmuuid/{entity_uuid}"
response = requests.get(url = uuid_api_entity_url, headers = request_headers, verify = False)

# Verify if the cached response from the SQLite database being used
verify_request_cache(uuid_api_entity_url, response.from_cache)

if response.status_code == 200:
entity_uuid_dict = response.json()

Expand Down Expand Up @@ -901,10 +886,3 @@ def get_entity_uuid_by_file_uuid(uuid):
# Return the entity uuid string, if the entity is AVR, and
# if the given uuid is a file uuid or not (bool)
return entity_uuid, entity_is_avr, given_uuid_is_file_uuid


# Verify if the cached response from the SQLite database being used
def verify_request_cache(url, response_from_cache):
now = time.ctime(int(time.time()))
logger.debug(f"Time: {now} / GET request URL: {url} / Used requests cache: {response_from_cache}")

3 changes: 0 additions & 3 deletions hubmap-auth/src/instance/app.cfg.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# File path to API endpoints json file within docker container, DO NOT MODIFY
API_ENDPOINTS_FILE = '/usr/src/app/api_endpoints.json'

# File path to the requests_cache generated sqlite (without extension) within docker container, DO NOT MODIFY
REQUESTS_CACHE_SQLITE_NAME = '/usr/src/app/requests_cache/hubmap_gateway'

# Globus app client ID and secret
# Used by HuBMAP commons AuthHelper
GLOBUS_APP_ID = ''
Expand Down
1 change: 0 additions & 1 deletion hubmap-auth/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cachetools==4.2.1
Flask==1.1.2
requests_cache==0.5.2

# The commons package requires requests>=2.22.0
requests==2.25.1
Expand Down

0 comments on commit 10d5a02

Please sign in to comment.