Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added modal status check, delete index before creating index #191

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions notebooks/document-chunking/with-index-pipelines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"id": "f38e0397",
"metadata": {
"colab": {
Expand All @@ -80,16 +80,7 @@
"id": "f38e0397",
"outputId": "ad6df489-d242-4229-a42a-39c5ca19d124"
},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Elastic Cloud ID: ········\n",
"Elastic Api Key: ········\n"
]
}
],
"outputs": [],
"source": [
"from elasticsearch import Elasticsearch\n",
"from getpass import getpass\n",
Expand Down Expand Up @@ -170,7 +161,16 @@
" --hub-model-id \"sentence-transformers/all-MiniLM-L6-v2\" \\\n",
" --task-type text_embedding \\\n",
" --clear-previous \\\n",
" --start"
" --start\n",
"\n",
"while True:\n",
" status = client.ml.get_trained_models_stats(model_id=MODEL_ID)\n",
" if \"trained_model_stats\" in status.keys() and status[\"trained_model_stats\"][0][\"deployment_stats\"][\"state\"] == \"started\":\n",
" print(MODEL_ID + \" Model has been successfully deployed & started.\")\n",
" break\n",
" else:\n",
" print(MODEL_ID + \" Model is currently being deployed.\")\n",
" time.sleep(5)\n"
]
},
{
Expand Down Expand Up @@ -300,6 +300,8 @@
"source": [
"INDEX_NAME = \"chunk_passages_example\"\n",
"\n",
"client.indices.delete(index=INDEX_NAME, ignore_unavailable=True)\n",
"\n",
"# Setup the index\n",
"client.indices.create(\n",
" index=INDEX_NAME,\n",
Expand Down
Loading