# NOTE: these unset are important; if not done AWS_PROFILE set in launcher will be ignored
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
unset AWS_PROFILE

INSTANCE_COUNT=$1
EXPERIMENT=$2
NAME=$3

QUEUE_NAME=${4:-mvdp}
INSTANCE_TYPE=${6:-p4de}
BUILD_TYPE=${5:-update}
VERSION=${7:-271}
USER_NAME=vguizilini
# USER_NAME=fzc

ENTRY_POINT=scripts/train.py
# HYDRA_CFG=custom/sagemaker/hydra/debug.yaml
CONFIG=cosmos_predict2/configs/base/config.py

# PROFILE=manip-cluster
PROFILE=default
REGION=us-west-2
# ARN=arn:aws:iam::124224456861:role/service-role/SageMaker-SageMakerAllAccess
ARN=arn:aws:iam::124224456861:role/SageMaker-SageMakerAllAccess-us-west-2
S3_REMOTE_SYNC=s3://tri-ml-sandbox-16011-us-west-2-datasets/sagemaker/s3_remote_sync/
PRIORITY=${8:-20}

AWS_DEFAULT_REGION=${REGION}                        \
    python3 custom/sagemaker/launch_sagemaker.py    \
    --base-job-name=${USER_NAME}-any4d-cvpr         \
    --entry_point=${ENTRY_POINT}                    \
    --user=${USER_NAME}                             \
    --config=${CONFIG}                              \
    --experiment=${EXPERIMENT}                      \
    --instance-count=${INSTANCE_COUNT}              \
    --profile=${PROFILE}                            \
    --region=${REGION}                              \
    --arn=${ARN}                                    \
    --s3-remote-sync=${S3_REMOTE_SYNC}              \
    --priority=${PRIORITY}                          \
    --queue=${QUEUE_NAME}       		            \
    --name=${NAME}                                  \
    --version=${VERSION}                            \
    --instance-type=${INSTANCE_TYPE}                \
    --build-type=${BUILD_TYPE}                      \
    --version=${VERSION}


