Skip to content

Commit

Permalink
PI-2580 Ignore conflict when updating contact semantic search model (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Oct 10, 2024
1 parent 4d33327 commit ffa8825
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ -z "$model_group_id" ]; then
}')
if [ "$(jq -r '.status' <<<"$model_group")" != "CREATED" ]; then fail "Failed to create model group: $model_group"; fi
model_group_id=$(jq -r '.model_group_id' <<<"$model_group")
else
echo "Found model group with id=$model_group_id"
fi

## Create Bedrock connector if it doesn't exist
Expand All @@ -23,6 +25,8 @@ if [ -z "$connector_id" ]; then
echo Creating connector...
connector_body=$(envsubst < /pipelines/contact/index/bedrock-connector.json)
connector_id=$(curl_json -XPOST "${SEARCH_INDEX_HOST}/_plugins/_ml/connectors/_create" --data "$connector_body" | jq -r '.connector_id')
else
echo "Found connector with id=$connector_id"
fi

## Register model if it doesn't exist
Expand All @@ -39,7 +43,7 @@ if [ -z "$model_id" ]; then
curl_json -XPOST "${SEARCH_INDEX_HOST}/_plugins/_ml/models/_register" --data "${model_body}"
else
echo Updating model...
curl_json -XPUT "${SEARCH_INDEX_HOST}/_plugins/_ml/models/${model_id}" --data "${model_body}"
curl_json -XPUT "${SEARCH_INDEX_HOST}/_plugins/_ml/models/${model_id}" --data "${model_body}" || echo 'Warning: Failed to update model' >&2
fi

## Deploy model
Expand Down

0 comments on commit ffa8825

Please sign in to comment.