From 7b2ab786ce9b8251b4d3bda4e6501caef7ed2742 Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Mon, 27 Jun 2022 22:58:35 -1000 Subject: [PATCH] list user profiles --- app.py | 6 ++++++ miniwdl_gwfcore_studio/miniwdl_gwfcore_studio_stack.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 809f969..71d416c 100644 --- a/app.py +++ b/app.py @@ -32,6 +32,12 @@ client_opts["region_name"] = env["region"] sagemaker = boto3.client("sagemaker", **client_opts) domain_desc = sagemaker.describe_domain(DomainId=studio_domain_id) +if studio_user_profile_names == ["*"]: + lup = sagemaker.list_user_profiles(DomainIdEquals=studio_domain_id) + assert "NextToken" not in lup # TODO paginate query for >100 users + studio_user_profile_names = [ + up["UserProfileName"] for up in lup["UserProfiles"] if up["Status"] == "InService" + ] user_profile_desc = dict( (nm, sagemaker.describe_user_profile(DomainId=studio_domain_id, UserProfileName=nm)) for nm in studio_user_profile_names diff --git a/miniwdl_gwfcore_studio/miniwdl_gwfcore_studio_stack.py b/miniwdl_gwfcore_studio/miniwdl_gwfcore_studio_stack.py index 814625e..efa3e16 100644 --- a/miniwdl_gwfcore_studio/miniwdl_gwfcore_studio_stack.py +++ b/miniwdl_gwfcore_studio/miniwdl_gwfcore_studio_stack.py @@ -60,7 +60,7 @@ def __init__( f"StudioFSAPuid{uid}x", file_system=studio_efs, posix_user=cdk_efs.PosixUser(uid=uid, gid=uid), - path=f"/{uid}/miniwdl", + path=f"/{uid}", ) def __del__(self):