Skip to content

Commit

Permalink
add print_docker_container_stats
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Mar 27, 2024
1 parent 3f267f5 commit 8398bbb
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 27 deletions.
72 changes: 68 additions & 4 deletions run-elasticsearch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,25 @@
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "212f01d4-9009-4217-8a9d-1436dfbb5448",
"metadata": {},
"outputs": [],
"source": [
"def print_docker_container_stats():\n",
" docker_cmd = [\n",
" # \"sudo\",\n",
" \"docker\", \"container\", \"stats\", \"--no-stream\"\n",
" ]\n",
" result = subprocess.run(docker_cmd, capture_output=True, text=True)\n",
" if result.returncode == 0:\n",
" print(result.stdout)\n",
" else:\n",
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -645,14 +664,37 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8ac4dca8-329b-43a0-9a6d-16805ab873b3",
"id": "a81c4185-f898-469e-ba36-8cceeeb40dbd",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "983bacda-2f22-404e-862d-fb56e880de14",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"create_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "87b4fb34-6aae-4b12-9252-1a276202f478",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"create_index()\n",
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
Expand All @@ -671,16 +713,26 @@
{
"cell_type": "code",
"execution_count": null,
"id": "07001257-ac80-49ad-9191-c46f86d321fd",
"id": "366fb9cd-28ec-473d-b1b4-02edcd77c68d",
"metadata": {},
"outputs": [],
"source": [
"# forcemerge_index()\n",
"close_index()\n",
"time.sleep(10)\n",
"open_index()\n",
"refresh_index()\n",
"refresh_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1999f8ae-1446-4e51-8c1e-ae295d906fed",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
Expand All @@ -699,6 +751,18 @@
" print_took_and_total_hits(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d577b1f4-12e6-40b7-9658-1eb01ebe9e16",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
72 changes: 68 additions & 4 deletions run-milvus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,25 @@
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f1beb657-9354-47b9-9a2c-c94a8bafc093",
"metadata": {},
"outputs": [],
"source": [
"def print_docker_container_stats():\n",
" docker_cmd = [\n",
" # \"sudo\",\n",
" \"docker\", \"container\", \"stats\", \"--no-stream\"\n",
" ]\n",
" result = subprocess.run(docker_cmd, capture_output=True, text=True)\n",
" if result.returncode == 0:\n",
" print(result.stdout)\n",
" else:\n",
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -632,26 +651,59 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8ac4dca8-329b-43a0-9a6d-16805ab873b3",
"id": "c1322f48-ad86-4293-83cc-fa98b04d4be7",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd611a75-8f69-4ccc-ac70-1b98ce4b010d",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"create_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "29892c89-2664-4a8f-be8c-06b8a2315d70",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"create_index()\n",
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3dc02726-3045-4f24-9a66-f018ab3f2d93",
"id": "761ee3bf-8474-4e26-8068-a47ea9e04113",
"metadata": {},
"outputs": [],
"source": [
"insert_data(bulk_size=bulk_size, max_size=index_size)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a735e465-fee7-4eaf-bebf-85ab5452ff20",
"metadata": {},
"outputs": [],
"source": [
"insert_data(bulk_size=bulk_size, max_size=index_size)\n",
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
Expand All @@ -670,6 +722,18 @@
" print_took_and_total_hits(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1432bab5-2978-4cf1-b03c-abf6747007f1",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
89 changes: 81 additions & 8 deletions run-opensearch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,25 @@
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c28bebd7-6f0b-4162-87e6-e450612eccd4",
"metadata": {},
"outputs": [],
"source": [
"def print_docker_container_stats():\n",
" docker_cmd = [\n",
" # \"sudo\",\n",
" \"docker\", \"container\", \"stats\", \"--no-stream\"\n",
" ]\n",
" result = subprocess.run(docker_cmd, capture_output=True, text=True)\n",
" if result.returncode == 0:\n",
" print(result.stdout)\n",
" else:\n",
" print(result.stderr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -653,40 +672,82 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8ac4dca8-329b-43a0-9a6d-16805ab873b3",
"id": "0ec8166b-a110-4f5e-80f4-a086f36606e6",
"metadata": {},
"outputs": [],
"source": [
"create_index()\n",
"print_docker_system_df()\n",
"print_docker_container_stats()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b08e3f40-f91d-43c2-98c8-df2c6b0c339d",
"metadata": {},
"outputs": [],
"source": [
"create_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "99e0e6e1-9c6d-4e1c-86e2-6281e48c3f14",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3dc02726-3045-4f24-9a66-f018ab3f2d93",
"id": "547f1ff5-58f1-4984-a81d-d8ab537f238f",
"metadata": {},
"outputs": [],
"source": [
"insert_data(bulk_size=bulk_size, max_size=index_size)\n",
"flush_index()\n",
"print_docker_system_df()"
"flush_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "07001257-ac80-49ad-9191-c46f86d321fd",
"id": "8042b0f7-021d-4772-b5bc-a73af08fd7ba",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "04f3a9f6-2d24-43ee-990b-be3a509e77c5",
"metadata": {},
"outputs": [],
"source": [
"# forcemerge_index()\n",
"close_index()\n",
"time.sleep(10)\n",
"open_index()\n",
"refresh_index()\n",
"refresh_index()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "193e9c0b-62fd-487a-a5e5-5e65c76d82f9",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
Expand All @@ -705,6 +766,18 @@
" print_took_and_total_hits(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8f84fa6f-cefa-48e8-851c-79ecbbc9aef7",
"metadata": {},
"outputs": [],
"source": [
"print_docker_system_df()\n",
"print_docker_container_stats()\n",
"print_indices()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -721,7 +794,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "fdc6c0c1-a508-4c04-a30c-6f14958d7eb7",
"id": "e7ab39f9-e73f-43c4-be59-a04d641aeb1c",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading

0 comments on commit 8398bbb

Please sign in to comment.