@@ -914,24 +914,56 @@ echo -e "\n ==============================Provisioning Compute Clu
914914}
915915
916916enable_model_registry () {
917- echo -e " \n =============================Deploying Model Registry ========================================="
918- USER_NAMESPACE=$workshop_name
919- cd /userconfig/.$USER_NAMESPACE /CAII
920- environment_crn=$( cdp environments describe-environment --environment-name ${workshop_name} -cdp-env | jq -r .environment.crn)
921- # Check if ML Model Registry exists and is already installed
922- registry_status=$( cdp ml list-model-registries | jq -r --arg env_name " ${workshop_name} -cdp-env" '
923- .modelRegistries[]
924- | select(.environmentName == $env_name)
925- | .status
926- ' )
917+ echo -e " \n =============================Deploying Model Registry ========================================="
918+ USER_NAMESPACE=$workshop_name
919+ cd /userconfig/.$USER_NAMESPACE /CAII
920+
921+ environment_crn=$( cdp environments describe-environment --environment-name ${workshop_name} -cdp-env | jq -r .environment.crn)
922+
923+ # Check if ML Model Registry exists and is already installed
924+ registry_status=$( cdp ml list-model-registries | jq -r --arg env_name " ${workshop_name} -cdp-env" '
925+ .modelRegistries[]
926+ | select(.environmentName == $env_name)
927+ | .status
928+ ' )
929+
930+ if [[ " $registry_status " == " installation:finished" ]]; then
931+ echo " ✅ ML Model Registry for environment '${workshop_name} -cdp-env' is already installed. Skipping creation."
932+ return
933+ else
934+ echo " 🚀 Proceeding with model registry deployment"
935+ cdp ml create-model-registry \
936+ --environment-crn " $environment_crn " \
937+ --environment-name " ${workshop_name} -cdp-env" \
938+ --use-public-load-balancer
939+ fi
927940
928- if [[ " $registry_status " == " installation:finished" ]]; then
929- echo " ✅ ML Model Registry for environment '${workshop_name} -cdp-env' is already installed. Skipping creation."
930- else
931- echo " 🚀 Proceeding with model registry deployment"
932- cdp ml create-model-registry --environment-crn $environment_crn --environment-name $workshop_name -cdp-env --use-public-load-balancer
933- fi
941+ echo " ⏳ Waiting for ML Model Registry installation to finish..."
942+ for i in {1..75}; do
943+ registry_status=$( cdp ml list-model-registries | jq -r --arg env_name " ${workshop_name} -cdp-env" '
944+ .modelRegistries[]
945+ | select(.environmentName == $env_name)
946+ | .status
947+ ' )
948+
949+ echo " ➤ Attempt $i : Status = $registry_status "
950+
951+ # Normalize to lowercase for matching
952+ status_lower=$( echo " $registry_status " | tr ' [:upper:]' ' [:lower:]' )
953+
954+ if [[ " $status_lower " == " installation:finished" ]]; then
955+ echo " ✅ ML Model Registry installation finished successfully."
956+ return
957+ elif [[ " $status_lower " == * " failed" * ]]; then
958+ echo " ❌ ML Model Registry installation FAILED with status: $registry_status "
959+ exit 1
960+ fi
961+
962+ sleep 60
963+ done
934964
965+ echo " ❌ Timeout Error: ML Model Registry did not reach 'installation:finished' state."
966+ exit 1
935967}
936968
937969provision_caii_service_app () {
0 commit comments