Skip to content

Commit 4852a2c

Browse files
committed
make cohort middleware url configurable
1 parent e786c35 commit 4852a2c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

config.ini

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

src/argowrapper/auth/utils.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import requests
22
from argowrapper import logger
3+
from argowrapper.constants import (
4+
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL,
5+
)
36

47

58
def get_cohort_ids_for_team_project(token, source_id, team_project):
69
header = {"Authorization": token, "cookie": "fence={}".format(token)}
7-
url = "http://cohort-middleware-service/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}".format(
10+
url1 = "http://cohort-middleware-service/cohortdefinition-stats/by-source-id/{}/by-team-project?team-project={}".format(
11+
source_id, team_project
12+
)
13+
url = COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL.format(
814
source_id, team_project
915
)
10-
1116
try:
1217
r = requests.get(url=url, headers=header)
1318
r.raise_for_status()

src/argowrapper/constants.py

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

2222
ARGO_HOST: Final = config["DEFAULT"]["ARGO_HOST"]
23+
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL: Final = config["DEFAULT"][
24+
"COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_URL"
25+
]
2326
TEST_WF: Final = "test.yaml"
2427
WF_HEADER: Final = "header.yaml"
2528
ARGO_NAMESPACE: Final = "argo"

0 commit comments

Comments
 (0)