-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/argo_ns_no_debug_prints
- Loading branch information
Showing
5 changed files
with
223 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import requests | ||
from argowrapper import logger | ||
from argowrapper.constants import ( | ||
COHORT_DEFINITION_BY_SOURCE_AND_TEAM_PROJECT_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 | ||
) | ||
try: | ||
r = requests.get(url=url, headers=header) | ||
r.raise_for_status() | ||
team_cohort_info = r.json() | ||
team_cohort_id_set = set() | ||
if "cohort_definitions_and_stats" in team_cohort_info: | ||
for t in team_cohort_info["cohort_definitions_and_stats"]: | ||
if "cohort_definition_id" in t: | ||
team_cohort_id_set.add(t["cohort_definition_id"]) | ||
return team_cohort_id_set | ||
except Exception as e: | ||
exception = Exception("Could not get team project cohort ids", e) | ||
logger.error(exception) | ||
raise exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters