Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:jhu-bids/TermHub into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigfried committed Sep 5, 2024
2 parents cb597ab + fea8389 commit 6c9ec11
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 31 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/backend_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# todo: optional: run tests
# - name: Run tests
# run: python -m unittest discover -v
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/backend_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# todo: optional: run tests
# - name: Run tests
# run: python -m unittest discover -v
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/kill_idle_cons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# Run the action
- name: Kill idle connections
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/refresh_counts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# Refresh
- name: Refresh counts
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/refresh_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# Refresh
- name: Refresh db
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/refresh_from_datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# todo: Do we actually need this here?
# i. termhub-vocab: Not needed for this i think
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/refresh_voc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
# Refresh
- name: Refresh vocab
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/resolve_fetch_failures_0_members.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
- name: Resolve fetch failures
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/resolve_fetch_failures_excess_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
- name: Resolve fetch failures
run: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test_backend_e2e_and_unit_and_qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ jobs:
# python -m pip install --upgrade pip
# pip install --upgrade wheel
# pip install --upgrade setuptools
# VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
# TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
# python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
pip install -r requirements.txt
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
TOKEN=$(grep '^PALANTIR_ENCLAVE_AUTHENTICATION_BEARER_TOKEN=' env/.env | cut -d'=' -f2)
python3 -m pip install vshub_sdk --upgrade --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.artifacts.main.repository.9bc9cc56-4b8c-4560-9bfb-fba8ade55246/contents/release/pypi/simple" --extra-index-url "https://:${TOKEN}@unite.nih.gov/artifacts/api/repositories/ri.foundry-sdk-asset-bundle.main.artifacts.repository/contents/release/pypi/simple"
- name: Run tests
run: make test-backend
13 changes: 8 additions & 5 deletions enclave_wrangler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
from datetime import datetime, timezone, timedelta
from http.client import HTTPConnection
from requests import Response
from vshub_sdk.core.api import UserTokenAuth
try:
from vshub_sdk.core.api import UserTokenAuth
except ModuleNotFoundError: # VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
pass

from enclave_wrangler.config import OUTDIR_OBJECTS, config, TERMHUB_VERSION, CSET_VERSION_MIN_ID
from backend.utils import dump
Expand Down Expand Up @@ -48,7 +51,7 @@ class ActionValidateError(RuntimeError):
"""Wrapper just to handle errors from this module"""


def get_headers(personal=False, content_type="application/json", for_curl=False, oauth=True):
def get_headers(personal=False, content_type="application/json", for_curl=False, oauth=False):
"""Format headers for enclave calls
todo: fix all this -- we've been switching back and forth between service token and personal because some APIs are
Expand Down Expand Up @@ -116,7 +119,7 @@ def get_oauth_token() -> str:
return OAUTH_TOKEN if OAUTH_TOKEN_EXPIRES > datetime.now() else refresh_oauth_token()


def get_auth_token(oauth=True) -> str:
def get_auth_token(oauth=False) -> str:
"""Returns the auth token for the N3C Palantir Foundry data enclave."""
service_user_token: str = config[TOKEN_KEY]
return get_oauth_token() if oauth else service_user_token
Expand Down Expand Up @@ -237,7 +240,7 @@ def handle_response_error(
})


def enclave_get(url: str, verbose: bool = True, args: Dict = {}, error_dir: str = None, oauth=True) -> Response:
def enclave_get(url: str, verbose: bool = True, args: Dict = {}, error_dir: str = None, oauth=False) -> Response:
"""Get from the enclave and print curl"""
if verbose:
print_curl(url, args=args)
Expand Down Expand Up @@ -502,7 +505,7 @@ def process_validate_errors(response: Response, err_type: Exception=None, print_
return out_errors


def enclave_post(url: str, data: Union[List, Dict], raise_validate_error: bool=False, verbose=True, oauth=True) -> Response:
def enclave_post(url: str, data: Union[List, Dict], raise_validate_error: bool=False, verbose=True, oauth=False) -> Response:
"""Post to the enclave and handle / report on some common issues"""
if verbose:
print_curl(url, data)
Expand Down
2 changes: 0 additions & 2 deletions install-requirements.sh

This file was deleted.

2 changes: 1 addition & 1 deletion requirements-unlocked.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ setuptools
# non-PyPi packages
# - For the command to install these, consult: install-requirements.sh
# foundry-sdk-runtime==1.113.0
# vshub_sdk==0.1.0
# vshub_sdk==0.1.0 # VS Hub SDK w/ OAuth disabled: https://github.com/jhu-bids/TermHub/issues/863
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ validators==0.20.0
virtualenv==20.15.1
virtualenv-clone==0.5.7
virtualenvwrapper==4.8.4
# vshub_sdk==0.1.0
watchdog==3.0.0
watchfiles==0.15.0
webcolors==1.12
Expand Down

0 comments on commit 6c9ec11

Please sign in to comment.