Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VADC-981 #129

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 7 additions & 4 deletions src/argowrapper/auth/utils.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
4 changes: 1 addition & 3 deletions src/argowrapper/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Loading