diff --git a/network-operations/01-ingest.ipynb b/network-operations/01-ingest.ipynb index 39ddfefb..e63231a9 100644 --- a/network-operations/01-ingest.ipynb +++ b/network-operations/01-ingest.ipynb @@ -42,14 +42,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:41:35,590 [info] loaded project network-operations from MLRun DB\n" + "> 2022-03-21 15:37:18,805 [info] loaded project network-operations from MLRun DB\n" ] } ], @@ -81,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -152,12 +152,15 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from src.generator import get_sample, config_to_static_mappings\n", "\n", + "with open(metric_configurations_path, \"r\") as fp:\n", + " metrics_configuration = yaml.safe_load(fp)\n", + "\n", "metrics_df, labels_df, static_df = get_sample(metrics_configuration, project=project)" ] }, @@ -174,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -239,10 +242,10 @@ "\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 7, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -267,7 +270,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -332,7 +335,7 @@ " \n", " \n", " \n", - " 5366904160408\n", + " 0517655866735\n", " 0\n", " 0\n", " 0\n", @@ -340,19 +343,20 @@ " 0\n", " 0\n", " 0\n", + " 1\n", " 0\n", " 0\n", " 1\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", " \n", " \n", - " 4366213343194\n", + " 2371451183019\n", + " 1\n", " 0\n", " 0\n", " 0\n", @@ -361,7 +365,6 @@ " 0\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 1\n", " 0\n", @@ -372,7 +375,8 @@ " 0\n", " \n", " \n", - " 5300819942199\n", + " 4541123052929\n", + " 0\n", " 1\n", " 0\n", " 0\n", @@ -383,17 +387,15 @@ " 0\n", " 0\n", " 0\n", - " 1\n", - " 0\n", " 0\n", " 0\n", " 0\n", + " 1\n", " 0\n", " 0\n", " \n", " \n", - " 7294710463338\n", - " 0\n", + " 8664701497798\n", " 0\n", " 0\n", " 0\n", @@ -410,9 +412,11 @@ " 0\n", " 0\n", " 0\n", + " 0\n", " \n", " \n", - " 5624716961858\n", + " 0109077675664\n", + " 1\n", " 0\n", " 0\n", " 0\n", @@ -420,15 +424,14 @@ " 0\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", + " 1\n", " 0\n", " \n", " \n", @@ -438,30 +441,30 @@ "text/plain": [ " models_0 models_1 models_2 models_3 models_4 models_5 \\\n", "device \n", - "5366904160408 0 0 0 0 0 0 \n", - "4366213343194 0 0 0 0 0 0 \n", - "5300819942199 1 0 0 0 0 0 \n", - "7294710463338 0 0 0 0 0 0 \n", - "5624716961858 0 0 0 0 0 0 \n", + "0517655866735 0 0 0 0 0 0 \n", + "2371451183019 1 0 0 0 0 0 \n", + "4541123052929 0 1 0 0 0 0 \n", + "8664701497798 0 0 0 0 0 0 \n", + "0109077675664 1 0 0 0 0 0 \n", "\n", " models_6 models_7 models_8 models_9 country_A country_B \\\n", "device \n", - "5366904160408 0 0 0 1 0 0 \n", - "4366213343194 0 0 1 0 1 0 \n", - "5300819942199 0 0 0 0 1 0 \n", - "7294710463338 0 0 0 1 0 1 \n", - "5624716961858 0 1 0 0 0 1 \n", + "0517655866735 0 1 0 0 1 0 \n", + "2371451183019 0 0 0 0 1 0 \n", + "4541123052929 0 0 0 0 0 0 \n", + "8664701497798 0 0 1 0 1 0 \n", + "0109077675664 0 0 0 0 0 0 \n", "\n", " country_C country_D country_E country_F country_G \n", "device \n", - "5366904160408 1 0 0 0 0 \n", - "4366213343194 0 0 0 0 0 \n", - "5300819942199 0 0 0 0 0 \n", - "7294710463338 0 0 0 0 0 \n", - "5624716961858 0 0 0 0 0 " + "0517655866735 0 0 0 0 0 \n", + "2371451183019 0 0 0 0 0 \n", + "4541123052929 0 0 1 0 0 \n", + "8664701497798 0 0 0 0 0 \n", + "0109077675664 0 0 0 1 0 " ] }, - "execution_count": 8, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -476,7 +479,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -500,7 +503,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -565,10 +568,10 @@ "\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 10, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -596,7 +599,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -669,123 +672,123 @@ " \n", " \n", " \n", - " 5366904160408\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 219.829296\n", - " 219.829296\n", - " 219.829296\n", - " 219.829296\n", + " 0517655866735\n", + " 61.203037\n", + " 61.203037\n", + " 61.203037\n", + " 61.203037\n", + " 61.203037\n", + " 61.203037\n", + " 262.130632\n", + " 262.130632\n", + " 262.130632\n", + " 262.130632\n", " ...\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 61.203037\n", + " 0.0\n", + " 0.0\n", + " 262.130632\n", + " 2022-03-20 15:37:34\n", + " 0\n", + " \n", + " \n", + " 2371451183019\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.000000\n", " 0.000000\n", " 0.000000\n", " 0.000000\n", - " 100.0\n", - " 0.000000\n", - " 0.000000\n", - " 219.829296\n", - " 2022-02-09 14:49:56\n", - " 0\n", - " \n", - " \n", - " 4366213343194\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 201.548274\n", - " 201.548274\n", - " 201.548274\n", - " 201.548274\n", " ...\n", - " 0.627030\n", - " 0.627030\n", - " 0.627030\n", - " 0.627030\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 100.000000\n", " 100.0\n", + " 50.0\n", " 0.000000\n", - " 0.627030\n", - " 201.548274\n", - " 2022-02-09 14:49:56\n", + " 2022-03-20 15:37:34\n", " 1\n", " \n", " \n", - " 5300819942199\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 230.646760\n", - " 230.646760\n", - " 230.646760\n", - " 230.646760\n", - " ...\n", + " 4541123052929\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.000000\n", " 0.000000\n", " 0.000000\n", " 0.000000\n", + " ...\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 100.000000\n", " 100.0\n", + " 50.0\n", " 0.000000\n", - " 0.000000\n", - " 230.646760\n", - " 2022-02-09 14:49:56\n", + " 2022-03-20 15:37:34\n", " 2\n", " \n", " \n", - " 7294710463338\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 189.683385\n", - " 189.683385\n", - " 189.683385\n", - " 189.683385\n", + " 8664701497798\n", + " 66.301653\n", + " 66.301653\n", + " 66.301653\n", + " 66.301653\n", + " 66.301653\n", + " 66.301653\n", + " 242.640984\n", + " 242.640984\n", + " 242.640984\n", + " 242.640984\n", " ...\n", - " 0.362444\n", - " 0.362444\n", - " 0.362444\n", - " 0.362444\n", - " 100.0\n", - " 0.000000\n", - " 0.362444\n", - " 189.683385\n", - " 2022-02-09 14:49:56\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 66.301653\n", + " 0.0\n", + " 0.0\n", + " 242.640984\n", + " 2022-03-20 15:37:34\n", " 3\n", " \n", " \n", - " 5624716961858\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 282.406720\n", - " 282.406720\n", - " 282.406720\n", - " 282.406720\n", + " 0109077675664\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 0.000000\n", + " 0.000000\n", + " 0.000000\n", + " 0.000000\n", " ...\n", - " 5.088156\n", - " 5.088156\n", - " 5.088156\n", - " 5.088156\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 50.0\n", + " 100.000000\n", " 100.0\n", - " 1.022657\n", - " 5.088156\n", - " 282.406720\n", - " 2022-02-09 14:49:56\n", + " 50.0\n", + " 0.000000\n", + " 2022-03-20 15:37:34\n", " 4\n", " \n", " \n", @@ -796,64 +799,64 @@ "text/plain": [ " cpu_utilization_max_1h cpu_utilization_max_6h \\\n", "device \n", - "5366904160408 100.0 100.0 \n", - "4366213343194 100.0 100.0 \n", - "5300819942199 100.0 100.0 \n", - "7294710463338 100.0 100.0 \n", - "5624716961858 100.0 100.0 \n", + "0517655866735 61.203037 61.203037 \n", + "2371451183019 100.000000 100.000000 \n", + "4541123052929 100.000000 100.000000 \n", + "8664701497798 66.301653 66.301653 \n", + "0109077675664 100.000000 100.000000 \n", "\n", " cpu_utilization_min_1h cpu_utilization_min_6h \\\n", "device \n", - "5366904160408 100.0 100.0 \n", - "4366213343194 100.0 100.0 \n", - "5300819942199 100.0 100.0 \n", - "7294710463338 100.0 100.0 \n", - "5624716961858 100.0 100.0 \n", + "0517655866735 61.203037 61.203037 \n", + "2371451183019 100.000000 100.000000 \n", + "4541123052929 100.000000 100.000000 \n", + "8664701497798 66.301653 66.301653 \n", + "0109077675664 100.000000 100.000000 \n", "\n", " cpu_utilization_avg_1h cpu_utilization_avg_6h \\\n", "device \n", - "5366904160408 100.0 100.0 \n", - "4366213343194 100.0 100.0 \n", - "5300819942199 100.0 100.0 \n", - "7294710463338 100.0 100.0 \n", - "5624716961858 100.0 100.0 \n", + "0517655866735 61.203037 61.203037 \n", + "2371451183019 100.000000 100.000000 \n", + "4541123052929 100.000000 100.000000 \n", + "8664701497798 66.301653 66.301653 \n", + "0109077675664 100.000000 100.000000 \n", "\n", " throughput_max_1h throughput_max_6h throughput_min_1h \\\n", "device \n", - "5366904160408 219.829296 219.829296 219.829296 \n", - "4366213343194 201.548274 201.548274 201.548274 \n", - "5300819942199 230.646760 230.646760 230.646760 \n", - "7294710463338 189.683385 189.683385 189.683385 \n", - "5624716961858 282.406720 282.406720 282.406720 \n", + "0517655866735 262.130632 262.130632 262.130632 \n", + "2371451183019 0.000000 0.000000 0.000000 \n", + "4541123052929 0.000000 0.000000 0.000000 \n", + "8664701497798 242.640984 242.640984 242.640984 \n", + "0109077675664 0.000000 0.000000 0.000000 \n", "\n", " throughput_min_6h ... packet_loss_min_1h packet_loss_min_6h \\\n", "device ... \n", - "5366904160408 219.829296 ... 0.000000 0.000000 \n", - "4366213343194 201.548274 ... 0.627030 0.627030 \n", - "5300819942199 230.646760 ... 0.000000 0.000000 \n", - "7294710463338 189.683385 ... 0.362444 0.362444 \n", - "5624716961858 282.406720 ... 5.088156 5.088156 \n", + "0517655866735 262.130632 ... 0.0 0.0 \n", + "2371451183019 0.000000 ... 50.0 50.0 \n", + "4541123052929 0.000000 ... 50.0 50.0 \n", + "8664701497798 242.640984 ... 0.0 0.0 \n", + "0109077675664 0.000000 ... 50.0 50.0 \n", "\n", " packet_loss_avg_1h packet_loss_avg_6h cpu_utilization \\\n", "device \n", - "5366904160408 0.000000 0.000000 100.0 \n", - "4366213343194 0.627030 0.627030 100.0 \n", - "5300819942199 0.000000 0.000000 100.0 \n", - "7294710463338 0.362444 0.362444 100.0 \n", - "5624716961858 5.088156 5.088156 100.0 \n", + "0517655866735 0.0 0.0 61.203037 \n", + "2371451183019 50.0 50.0 100.000000 \n", + "4541123052929 50.0 50.0 100.000000 \n", + "8664701497798 0.0 0.0 66.301653 \n", + "0109077675664 50.0 50.0 100.000000 \n", "\n", - " latency packet_loss throughput timestamp index \n", - "device \n", - "5366904160408 0.000000 0.000000 219.829296 2022-02-09 14:49:56 0 \n", - "4366213343194 0.000000 0.627030 201.548274 2022-02-09 14:49:56 1 \n", - "5300819942199 0.000000 0.000000 230.646760 2022-02-09 14:49:56 2 \n", - "7294710463338 0.000000 0.362444 189.683385 2022-02-09 14:49:56 3 \n", - "5624716961858 1.022657 5.088156 282.406720 2022-02-09 14:49:56 4 \n", + " latency packet_loss throughput timestamp index \n", + "device \n", + "0517655866735 0.0 0.0 262.130632 2022-03-20 15:37:34 0 \n", + "2371451183019 100.0 50.0 0.000000 2022-03-20 15:37:34 1 \n", + "4541123052929 100.0 50.0 0.000000 2022-03-20 15:37:34 2 \n", + "8664701497798 0.0 0.0 242.640984 2022-03-20 15:37:34 3 \n", + "0109077675664 100.0 50.0 0.000000 2022-03-20 15:37:34 4 \n", "\n", "[5 rows x 30 columns]" ] }, - "execution_count": 11, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -865,7 +868,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -883,7 +886,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -935,10 +938,10 @@ "\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -964,7 +967,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -1018,58 +1021,58 @@ " \n", " \n", " \n", - " 5366904160408\n", + " 0517655866735\n", " NaN\n", - " True\n", " False\n", " False\n", " False\n", " False\n", - " 2022-02-09 14:49:56\n", + " False\n", + " 2022-03-20 15:37:34\n", " 0\n", " \n", " \n", - " 4366213343194\n", + " 2371451183019\n", " NaN\n", - " True\n", " False\n", " False\n", " False\n", " False\n", - " 2022-02-09 14:49:56\n", + " False\n", + " 2022-03-20 15:37:34\n", " 1\n", " \n", " \n", - " 5300819942199\n", + " 4541123052929\n", " NaN\n", " True\n", - " False\n", - " False\n", - " False\n", - " False\n", - " 2022-02-09 14:49:56\n", + " True\n", + " True\n", + " True\n", + " True\n", + " 2022-03-20 15:37:34\n", " 2\n", " \n", " \n", - " 7294710463338\n", + " 8664701497798\n", " NaN\n", - " True\n", " False\n", " False\n", " False\n", " False\n", - " 2022-02-09 14:49:56\n", + " False\n", + " 2022-03-20 15:37:34\n", " 3\n", " \n", " \n", - " 5624716961858\n", + " 0109077675664\n", " NaN\n", - " True\n", " False\n", " False\n", " False\n", " False\n", - " 2022-02-09 14:49:56\n", + " False\n", + " 2022-03-20 15:37:34\n", " 4\n", " \n", " \n", @@ -1079,30 +1082,30 @@ "text/plain": [ " cpu_utilization_max_1h cpu_utilization_is_error \\\n", "device \n", - "5366904160408 NaN True \n", - "4366213343194 NaN True \n", - "5300819942199 NaN True \n", - "7294710463338 NaN True \n", - "5624716961858 NaN True \n", + "0517655866735 NaN False \n", + "2371451183019 NaN False \n", + "4541123052929 NaN True \n", + "8664701497798 NaN False \n", + "0109077675664 NaN False \n", "\n", " latency_is_error packet_loss_is_error throughput_is_error \\\n", "device \n", - "5366904160408 False False False \n", - "4366213343194 False False False \n", - "5300819942199 False False False \n", - "7294710463338 False False False \n", - "5624716961858 False False False \n", + "0517655866735 False False False \n", + "2371451183019 False False False \n", + "4541123052929 True True True \n", + "8664701497798 False False False \n", + "0109077675664 False False False \n", "\n", " is_error timestamp index \n", "device \n", - "5366904160408 False 2022-02-09 14:49:56 0 \n", - "4366213343194 False 2022-02-09 14:49:56 1 \n", - "5300819942199 False 2022-02-09 14:49:56 2 \n", - "7294710463338 False 2022-02-09 14:49:56 3 \n", - "5624716961858 False 2022-02-09 14:49:56 4 " + "0517655866735 False 2022-03-20 15:37:34 0 \n", + "2371451183019 False 2022-03-20 15:37:34 1 \n", + "4541123052929 True 2022-03-20 15:37:34 2 \n", + "8664701497798 False 2022-03-20 15:37:34 3 \n", + "0109077675664 False 2022-03-20 15:37:34 4 " ] }, - "execution_count": 14, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -1114,7 +1117,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -1154,7 +1157,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -1215,20 +1218,20 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:42:01,252 [info] Starting remote function deploy\n", - "2022-02-10 14:42:01 (info) Deploying function\n", - "2022-02-10 14:42:01 (info) Building\n", - "2022-02-10 14:42:02 (info) Staging files and preparing base images\n", - "2022-02-10 14:42:02 (info) Building processor image\n", - "2022-02-10 14:42:14 (info) Build complete\n", - "2022-02-10 14:42:20 (info) Function deploy complete\n", - "> 2022-02-10 14:42:20,909 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-admin-metrics-generator.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-admin-metrics-generator-network-ope-ewxq5kzc.default-tenant.app.yh41.iguazio-cd1.com/']}\n" + "> 2022-03-21 15:37:33,545 [info] Starting remote function deploy\n", + "2022-03-21 15:37:33 (info) Deploying function\n", + "2022-03-21 15:37:33 (info) Building\n", + "2022-03-21 15:37:34 (info) Staging files and preparing base images\n", + "2022-03-21 15:37:34 (info) Building processor image\n", + "2022-03-21 15:37:37 (info) Build complete\n", + "2022-03-21 15:37:45 (info) Function deploy complete\n", + "> 2022-03-21 15:37:45,980 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-orz-metrics-generator.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-orz-metrics-generator-network-operations-orz.default-tenant.app.app-lab-testing.iguazio-cd0.com/']}\n" ] }, { "data": { "text/plain": [ - "'http://network-operations-admin-metrics-generator-network-ope-ewxq5kzc.default-tenant.app.yh41.iguazio-cd1.com/'" + "'http://network-operations-orz-metrics-generator-network-operations-orz.default-tenant.app.app-lab-testing.iguazio-cd0.com/'" ] }, "execution_count": 16, @@ -1268,14 +1271,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:42:29,071 [info] Starting remote function deploy\n", - "2022-02-10 14:42:29 (info) Deploying function\n", - "2022-02-10 14:42:29 (info) Building\n", - "2022-02-10 14:42:30 (info) Staging files and preparing base images\n", - "2022-02-10 14:42:30 (info) Building processor image\n", - "2022-02-10 14:42:32 (info) Build complete\n", - "2022-02-10 14:42:38 (info) Function deploy complete\n", - "> 2022-02-10 14:42:38,202 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-admin-device-metrics-ingest.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-admin-device-metrics-ingest-network-oitylvmt.default-tenant.app.yh41.iguazio-cd1.com/']}\n" + "> 2022-03-21 15:37:46,273 [info] Starting remote function deploy\n", + "2022-03-21 15:37:46 (info) Deploying function\n", + "2022-03-21 15:37:46 (info) Building\n", + "2022-03-21 15:37:46 (info) Staging files and preparing base images\n", + "2022-03-21 15:37:46 (info) Building processor image\n", + "2022-03-21 15:37:48 (info) Build complete\n", + "2022-03-21 15:37:53 (info) Function deploy complete\n", + "> 2022-03-21 15:37:53,983 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-orz-device-metrics-ingest.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-orz-device-metrics-ingest-network-o-ab8w1cne.default-tenant.app.app-lab-testing.iguazio-cd0.com/']}\n" ] } ], @@ -1307,14 +1310,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:42:38,357 [info] Starting remote function deploy\n", - "2022-02-10 14:42:38 (info) Deploying function\n", - "2022-02-10 14:42:38 (info) Building\n", - "2022-02-10 14:42:38 (info) Staging files and preparing base images\n", - "2022-02-10 14:42:38 (info) Building processor image\n", - "2022-02-10 14:42:40 (info) Build complete\n", - "2022-02-10 14:42:45 (info) Function deploy complete\n", - "> 2022-02-10 14:42:46,382 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-admin-device-labels-ingest.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-admin-device-labels-ingest-network-0xvjxk82.default-tenant.app.yh41.iguazio-cd1.com/']}\n" + "> 2022-03-21 15:37:54,148 [info] Starting remote function deploy\n", + "2022-03-21 15:37:54 (info) Deploying function\n", + "2022-03-21 15:37:54 (info) Building\n", + "2022-03-21 15:37:54 (info) Staging files and preparing base images\n", + "2022-03-21 15:37:54 (info) Building processor image\n", + "2022-03-21 15:37:55 (info) Build complete\n", + "2022-03-21 15:38:01 (info) Function deploy complete\n", + "> 2022-03-21 15:38:01,789 [info] successfully deployed function: {'internal_invocation_urls': ['nuclio-network-operations-orz-device-labels-ingest.default-tenant.svc.cluster.local:8080'], 'external_invocation_urls': ['network-operations-orz-device-labels-ingest-network-op-o9h6w77y.default-tenant.app.app-lab-testing.iguazio-cd0.com/']}\n" ] } ], diff --git a/network-operations/02-training-and-deployment.ipynb b/network-operations/02-training-and-deployment.ipynb index f06e29bf..229dc834 100644 --- a/network-operations/02-training-and-deployment.ipynb +++ b/network-operations/02-training-and-deployment.ipynb @@ -33,7 +33,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 13:56:05,467 [info] loaded project network-operations from MLRun DB\n" + "> 2022-03-21 15:29:29,500 [info] loaded project network-operations from MLRun DB\n" ] } ], @@ -94,9 +94,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 13:56:06,270 [info] wrote target: {'name': 'parquet', 'kind': 'parquet', 'path': 'v3io:///projects/network-operations-admin/FeatureStore/device_features/parquet/vectors/device_features-latest.parquet', 'status': 'ready', 'updated': '2022-02-10T13:56:06.270401+00:00', 'size': 55011}\n", + "> 2022-03-21 15:29:30,242 [info] wrote target: {'name': 'parquet', 'kind': 'parquet', 'path': 'v3io:///projects/network-operations-orz/FeatureStore/device_features/parquet/vectors/device_features-latest.parquet', 'status': 'ready', 'updated': '2022-03-21T15:29:30.241991+00:00', 'size': 105251}\n", "\n", - "Training set shape: (480, 47)\n" + "Training set shape: (600, 47)\n" ] }, { @@ -146,12 +146,12 @@ " \n", " \n", " 0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", + " 71.364616\n", + " 71.364616\n", + " 71.364616\n", + " 71.364616\n", + " 71.364616\n", + " 71.364616\n", " 0.0\n", " 0.0\n", " 0.0\n", @@ -159,47 +159,47 @@ " ...\n", " 0\n", " 0\n", + " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", - " True\n", + " False\n", " \n", " \n", " 1\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.0\n", " 0.0\n", " 0.0\n", " 0.0\n", " ...\n", + " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", " 0\n", " 0\n", - " 1\n", - " 0\n", " 0\n", - " True\n", + " 1\n", + " False\n", " \n", " \n", " 2\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.0\n", " 0.0\n", " 0.0\n", @@ -207,23 +207,23 @@ " ...\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", + " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", - " True\n", + " False\n", " \n", " \n", " 3\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.0\n", " 0.0\n", " 0.0\n", @@ -231,38 +231,38 @@ " ...\n", " 0\n", " 0\n", - " 1\n", " 0\n", " 0\n", + " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", - " True\n", + " False\n", " \n", " \n", " 4\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", - " 100.0\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", + " 100.000000\n", " 0.0\n", " 0.0\n", " 0.0\n", " 0.0\n", " ...\n", - " 1\n", " 0\n", - " 1\n", " 0\n", " 0\n", " 0\n", " 0\n", + " 1\n", + " 0\n", " 0\n", " 0\n", - " True\n", + " False\n", " \n", " \n", "\n", @@ -271,18 +271,18 @@ ], "text/plain": [ " cpu_utilization_avg_1h cpu_utilization_avg_6h cpu_utilization_min_1h \\\n", - "0 100.0 100.0 100.0 \n", - "1 100.0 100.0 100.0 \n", - "2 100.0 100.0 100.0 \n", - "3 100.0 100.0 100.0 \n", - "4 100.0 100.0 100.0 \n", + "0 71.364616 71.364616 71.364616 \n", + "1 100.000000 100.000000 100.000000 \n", + "2 100.000000 100.000000 100.000000 \n", + "3 100.000000 100.000000 100.000000 \n", + "4 100.000000 100.000000 100.000000 \n", "\n", " cpu_utilization_min_6h cpu_utilization_max_1h cpu_utilization_max_6h \\\n", - "0 100.0 100.0 100.0 \n", - "1 100.0 100.0 100.0 \n", - "2 100.0 100.0 100.0 \n", - "3 100.0 100.0 100.0 \n", - "4 100.0 100.0 100.0 \n", + "0 71.364616 71.364616 71.364616 \n", + "1 100.000000 100.000000 100.000000 \n", + "2 100.000000 100.000000 100.000000 \n", + "3 100.000000 100.000000 100.000000 \n", + "4 100.000000 100.000000 100.000000 \n", "\n", " throughput_avg_1h throughput_avg_6h throughput_min_1h throughput_min_6h \\\n", "0 0.0 0.0 0.0 0.0 \n", @@ -292,18 +292,18 @@ "4 0.0 0.0 0.0 0.0 \n", "\n", " ... models_8 models_9 country_A country_B country_C country_D \\\n", - "0 ... 0 0 0 0 0 0 \n", - "1 ... 0 0 0 0 0 0 \n", - "2 ... 0 0 1 0 0 0 \n", - "3 ... 0 0 1 0 0 0 \n", - "4 ... 1 0 1 0 0 0 \n", + "0 ... 0 0 1 0 0 0 \n", + "1 ... 1 0 0 0 0 0 \n", + "2 ... 0 0 0 0 1 0 \n", + "3 ... 0 0 0 0 1 0 \n", + "4 ... 0 0 0 0 0 1 \n", "\n", " country_E country_F country_G is_error \n", - "0 1 0 0 True \n", - "1 1 0 0 True \n", - "2 0 0 0 True \n", - "3 0 0 0 True \n", - "4 0 0 0 True \n", + "0 0 0 0 False \n", + "1 0 0 1 False \n", + "2 0 0 0 False \n", + "3 0 0 0 False \n", + "4 0 0 0 False \n", "\n", "[5 rows x 47 columns]" ] @@ -361,13 +361,13 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "
Pipeline running (id=73730040-07dc-4de5-9f28-d7f48cdfc519), click here to view the details in MLRun UI
" + "
Pipeline running (id=26fa454b-d373-4e8c-b2be-d828e0a0c2bf), click here to view the details in MLRun UI
" ], "text/plain": [ "" @@ -390,44 +390,44 @@ "\n", "kfp\n", "\n", - "\n", + "\n", "\n", - "netops-demo-wfjww-2234054694\n", - "\n", - "\n", - "\n", - "\n", - "deploy-serving\n", + "netops-demo-nvhlm-1006652392\n", + "\n", + "test\n", "\n", - "\n", + "\n", "\n", - "netops-demo-wfjww-2714578612\n", - "\n", - "test\n", + "netops-demo-nvhlm-2262231370\n", + "\n", + "\n", + "\n", + "\n", + "deploy-serving\n", "\n", - "\n", + "\n", "\n", - "netops-demo-wfjww-3111339042\n", - "\n", - "train\n", + "netops-demo-nvhlm-256586422\n", + "\n", + "train\n", "\n", - "\n", - "\n", - "netops-demo-wfjww-3111339042->netops-demo-wfjww-2234054694\n", - "\n", - "\n", - "\n", - "\n", + "\n", "\n", - "netops-demo-wfjww-3111339042->netops-demo-wfjww-2714578612\n", - "\n", - "\n", + "netops-demo-nvhlm-256586422->netops-demo-nvhlm-1006652392\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "netops-demo-nvhlm-256586422->netops-demo-nvhlm-2262231370\n", + "\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -436,7 +436,7 @@ { "data": { "text/html": [ - "

Run Results

Workflow 73730040-07dc-4de5-9f28-d7f48cdfc519 finished, state=Succeeded
click the hyper links below to see detailed results
\n", + "

Run Results

Workflow 26fa454b-d373-4e8c-b2be-d828e0a0c2bf finished, state=Succeeded
click the hyper links below to see detailed results
\n", " \n", " \n", " \n", @@ -449,20 +449,20 @@ " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", "
uid
Feb 10 14:04:10Mar 21 15:30:01completedtest
label_column=is_error
accuracy=1.0
test-error=0.0
rocauc=1.0
brier_score=0.00031527777777777777
f1-score=1.0
precision_score=1.0
recall_score=1.0
accuracy=0.8944444444444445
test-error=0.10555555555555556
rocauc=0.9153125
brier_score=0.07797681975229906
f1-score=0.4571428571428572
precision_score=0.5333333333333333
recall_score=0.4
Feb 10 14:03:53Mar 21 15:29:45completedtrain
label_column=is_error
model_pkg_class=sklearn.ensemble.RandomForestClassifier
accuracy=1.0
test-error=0.0
rocauc=1.0
brier_score=0.0016544554455445544
f1-score=1.0
precision_score=1.0
recall_score=1.0
accuracy=0.8888888888888888
test-error=0.1111111111111111
rocauc=0.9341608202914193
brier_score=0.07015625097294208
f1-score=0.46153846153846156
precision_score=0.6666666666666666
recall_score=0.35294117647058826
" @@ -502,14 +502,14 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Devices sample: ['5366904160408' '4366213343194' '5300819942199' '7294710463338']\n" + "Devices sample: ['0517655866735' '2371451183019' '4541123052929' '8664701497798']\n" ] } ], @@ -531,25 +531,25 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:05:05,843 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n" + "> 2022-03-21 15:30:18,714 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n" ] }, { "data": { "text/plain": [ - "{'id': 'f5c28ca9-3b52-4582-89fa-9caf80752ba3',\n", + "{'id': '7692c3f7-ee09-450f-9f8d-fe32b987f439',\n", " 'model_name': 'netops',\n", " 'outputs': [False]}" ] }, - "execution_count": 8, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -568,33 +568,33 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2022-02-10 14:05:07,665 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", - "Sent: [['5366904160408'], ['9089787659244']]\n", - "Response: {'id': '5fab5012-31e1-4c93-99f7-910c5e10df93', 'model_name': 'netops', 'outputs': [False, False]}\n", - "Predictions: [(['5366904160408'], False), (['9089787659244'], False)]\n", - "> 2022-02-10 14:05:17,709 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", - "Sent: [['7190575638226'], ['6456808756864']]\n", - "Response: {'id': '81ac75f1-00d7-412d-8eab-8d8e5d3719b1', 'model_name': 'netops', 'outputs': [False, False]}\n", - "Predictions: [(['7190575638226'], False), (['6456808756864'], False)]\n", - "> 2022-02-10 14:05:27,755 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", - "Sent: [['6796821902797'], ['5300819942199']]\n", - "Response: {'id': '882ffa3f-cb1c-40ae-915b-8e80810c3a49', 'model_name': 'netops', 'outputs': [False, False]}\n", - "Predictions: [(['6796821902797'], False), (['5300819942199'], False)]\n", - "> 2022-02-10 14:05:37,801 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", - "Sent: [['5366904160408'], ['2133702096887']]\n", - "Response: {'id': '43b458d7-8e59-4598-95b3-f0c350a20ca3', 'model_name': 'netops', 'outputs': [False, False]}\n", - "Predictions: [(['5366904160408'], False), (['2133702096887'], False)]\n", - "> 2022-02-10 14:05:47,851 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-admin-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", - "Sent: [['5021644823083'], ['7453742823111']]\n", - "Response: {'id': 'cdde1873-b9c0-483a-8771-4eae5f2a480d', 'model_name': 'netops', 'outputs': [False, False]}\n", - "Predictions: [(['5021644823083'], False), (['7453742823111'], False)]\n" + "> 2022-03-21 15:30:18,776 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", + "Sent: [['4171338169441'], ['7478932327231']]\n", + "Response: {'id': '5dd52d95-5e81-48f2-999c-3c56142f750f', 'model_name': 'netops', 'outputs': [False, False]}\n", + "Predictions: [(['4171338169441'], False), (['7478932327231'], False)]\n", + "> 2022-03-21 15:30:28,833 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", + "Sent: [['4582020878559'], ['9861411520919']]\n", + "Response: {'id': '2583ce2d-c7b6-4d67-af21-09af55b196ed', 'model_name': 'netops', 'outputs': [False, False]}\n", + "Predictions: [(['4582020878559'], False), (['9861411520919'], False)]\n", + "> 2022-03-21 15:30:38,885 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", + "Sent: [['8218878184161'], ['8490822166617']]\n", + "Response: {'id': '1cf42e41-8a05-45b3-b635-9fba3bb695b3', 'model_name': 'netops', 'outputs': [False, False]}\n", + "Predictions: [(['8218878184161'], False), (['8490822166617'], False)]\n", + "> 2022-03-21 15:30:48,934 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", + "Sent: [['1761764880917'], ['0444798971455']]\n", + "Response: {'id': '7cf7ed9c-0ef8-42dc-b1d6-e268365e44cd', 'model_name': 'netops', 'outputs': [False, False]}\n", + "Predictions: [(['1761764880917'], False), (['0444798971455'], False)]\n", + "> 2022-03-21 15:30:58,985 [info] invoking function: {'method': 'POST', 'path': 'http://nuclio-network-operations-orz-serving.default-tenant.svc.cluster.local:8080/v2/models/netops/infer'}\n", + "Sent: [['3891062846664'], ['0321416570712']]\n", + "Response: {'id': '1cdf50db-42cd-4d10-b9af-3ed728917a59', 'model_name': 'netops', 'outputs': [False, False]}\n", + "Predictions: [(['3891062846664'], False), (['0321416570712'], False)]\n" ] } ], diff --git a/network-operations/src/generator.py b/network-operations/src/generator.py index 8256e2b9..9c78760c 100644 --- a/network-operations/src/generator.py +++ b/network-operations/src/generator.py @@ -101,8 +101,12 @@ def get_sample( generator = met_gen.generate(as_df=True) while True: sample = next(generator) - if len(sample.is_error.unique()) == 2: - break + errors = sample.is_error.value_counts() + error_count = errors.loc[errors.index == True] + if not error_count.empty: + error_count = error_count.values[0] + if error_count >= 10: + break metrics_df, labels_df = get_data_from_sample(None, sample, as_df) for i in range(ticks): sample = next(generator) diff --git a/network-operations/src/metric_configurations.yaml b/network-operations/src/metric_configurations.yaml index c79d1e07..4c422664 100644 --- a/network-operations/src/metric_configurations.yaml +++ b/network-operations/src/metric_configurations.yaml @@ -1,5 +1,5 @@ -errors: {length_in_ticks: 5, rate_in_ticks: 10} -timestamps: {interval: 5s, stochastic_interval: true} +errors: {length_in_ticks: 3, rate_in_ticks: 5} +timestamps: {interval: 5s, stochastic_interval: false} deployment: device: faker: msisdn