I have set up a sagemaker domain and added some user profile. I log into the sagemaker studio, select a user profile and it starts the studio for me. i open a new notebook. inside the notebook, i install sagemaker and import additional libraries. how can use sagemaker api to print the name of the user/userprofile , that is currently using the studio? in the example below, i have created a userprofile by the name of "chuck". and i'm logged into studio via that profile , but i would like go get and print that name in the notebook, i'm running.
!pip install --upgrade sagemaker
!pip install torch==1.9.1
!pip install torchvision==0.10.1
import boto3
import numpy as np
import os
import sagemaker
import torch
import torchvision
from sagemaker.pytorch.model import PyTorchModel
cloudformation code to create sagemaker domain and userprofiles
StudioDomain:
Type: Custom::StudioDomain
Properties:
ServiceToken: !GetAtt StudioDomainFunction.Arn
VPC: !Ref VPCId
SubnetIds: !Ref SubnetIds
DomainName: "MyDomainName"
DefaultUserSettings:
ExecutionRole: !GetAtt SageMakerExecutionRole.Arn
UserProfile:
Type: Custom::UserProfile
Properties:
ServiceToken: !GetAtt UserProfileFunction.Arn
DomainId: !GetAtt StudioDomain.DomainId
UserProfileName: 'chuck'
UserSettings:
ExecutionRole: !GetAtt SageMakerExecutionRole.Arn