Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tianj7 committed Feb 1, 2024
1 parent 4902931 commit caa3ca5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/argowrapper/routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def wrapper(*args, **kwargs):
logger.info(json.dumps(kwargs["request_body"]))
request = kwargs["request"]
token = request.headers.get("Authorization")
host = request
request_body = kwargs["request_body"]

team_project = request_body[TEAM_PROJECT_FIELD_NAME]
Expand All @@ -179,7 +178,6 @@ def wrapper(*args, **kwargs):

logger.info("team project is " + team_project)
logger.info("source_id is " + str(source_id))
logger.info("cohort ids are " + " ".join(str(c) for c in cohort_ids))
logger.info("request url is " + url)

try:
Expand All @@ -193,6 +191,12 @@ def wrapper(*args, **kwargs):
team_cohort_id_set.add(t["cohort_definition_id"])
cohort_id_set = set(cohort_ids)

logger.info("cohort ids are " + " ".join(str(c) for c in cohort_ids))
logger.info(
"team cohort ids are "
+ " ".join(str(c) for c in team_cohort_id_set)
)

if cohort_id_set.issubset(team_cohort_id_set):
logger.info(
"cohort ids submitted belong to user's team project. Continue.."
Expand Down
2 changes: 1 addition & 1 deletion test/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def raise_for_status(self):

if (
kwargs["url"]
== "https://cohort-middleware-service/cohortdefinition-stats/by-source-id/4/by-team-project?team-project=dummy-team-project"
== "http://cohort-middleware-service/cohortdefinition-stats/by-source-id/4/by-team-project?team-project=dummy-team-project"
):
return MockResponse(cohort_definition_data, 200)

Expand Down

0 comments on commit caa3ca5

Please sign in to comment.