Skip to content

Commit 513a5e2

Browse files
authored
Revert "Revert "Refactor to allow other call to cohort-middleware service""
1 parent 359ea50 commit 513a5e2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

config.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
ARGO_ACCESS_METHOD = access
33
ARGO_HOST = http://argo-argo-workflows-server.argo.svc.cluster.local:2746
44
ARGO_NAMESPACE = argo
5-
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL = http://cohort-middleware-service/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}
5+
COHORT_MIDDLEWARE_SERVICE = http://cohort-middleware-service

src/argowrapper/auth/utils.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import requests
22
from argowrapper import logger
33
from argowrapper.constants import (
4-
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL,
4+
COHORT_MIDDLEWARE_SERVICE,
55
)
66

77

88
def get_cohort_ids_for_team_project(token, source_id, team_project):
99
header = {"Authorization": token, "cookie": "fence={}".format(token)}
10-
url = COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL.format(
11-
source_id, team_project
10+
api_url = (
11+
COHORT_MIDDLEWARE_SERVICE
12+
+ "/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}"
1213
)
14+
url = api_url.format(source_id, team_project)
1315
try:
1416
r = requests.get(url=url, headers=header)
1517
r.raise_for_status()

src/argowrapper/constants.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
logger.info(f"Access method: {config['DEFAULT']['ARGO_ACCESS_METHOD']}")
2222

2323
ARGO_HOST: Final = config["DEFAULT"]["ARGO_HOST"]
24-
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL: Final = config["DEFAULT"][
25-
"COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL"
26-
]
24+
COHORT_MIDDLEWARE_SERVICE: Final = config["DEFAULT"]["COHORT_MIDDLEWARE_SERVICE"]
2725
TEST_WF: Final = "test.yaml"
2826
WF_HEADER: Final = "header.yaml"
2927
ARGO_NAMESPACE: Final = config["DEFAULT"]["ARGO_NAMESPACE"]

0 commit comments

Comments
 (0)