diff --git a/config.ini b/config.ini index 5d450fa..f957cd0 100644 --- a/config.ini +++ b/config.ini @@ -2,4 +2,4 @@ ARGO_ACCESS_METHOD = access ARGO_HOST = http://argo-argo-workflows-server.argo.svc.cluster.local:2746 ARGO_NAMESPACE = argo -COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL = http://cohort-middleware-service/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={} +COHORT_MIDDLEWARE_SERVICE = http://cohort-middleware-service diff --git a/src/argowrapper/auth/utils.py b/src/argowrapper/auth/utils.py index 6ecd620..b2196f2 100644 --- a/src/argowrapper/auth/utils.py +++ b/src/argowrapper/auth/utils.py @@ -1,17 +1,20 @@ import requests from argowrapper import logger from argowrapper.constants import ( - COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL, + COHORT_MIDDLEWARE_SERVICE_URL, ) def get_cohort_ids_for_team_project(token, source_id, team_project): header = {"Authorization": token, "cookie": "fence={}".format(token)} - url = COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL.format( - source_id, team_project + api_url = ( + COHORT_MIDDLEWARE_SERVICE_URL + + "/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}" ) + api_url = api_url.format(source_id, team_project) + try: - r = requests.get(url=url, headers=header) + r = requests.get(url=api_url, headers=header) r.raise_for_status() team_cohort_info = r.json() team_cohort_id_set = set() diff --git a/src/argowrapper/constants.py b/src/argowrapper/constants.py index 25f43c0..a1095d9 100644 --- a/src/argowrapper/constants.py +++ b/src/argowrapper/constants.py @@ -21,9 +21,7 @@ logger.info(f"Access method: {config['DEFAULT']['ARGO_ACCESS_METHOD']}") ARGO_HOST: Final = config["DEFAULT"]["ARGO_HOST"] -COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL: Final = config["DEFAULT"][ - "COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL" -] +COHORT_MIDDLEWARE_SERVICE_URL: Final = config["DEFAULT"]["COHORT_MIDDLEWARE_SERVICE"] TEST_WF: Final = "test.yaml" WF_HEADER: Final = "header.yaml" ARGO_NAMESPACE: Final = config["DEFAULT"]["ARGO_NAMESPACE"]