From 26937fceb310d028ad84f67692e945895f78ed2d Mon Sep 17 00:00:00 2001 From: Avi Asulin Date: Tue, 7 Jun 2022 17:25:08 +0300 Subject: [PATCH] fix dask cluster image --- .../dask-cluster.ipynb | 262 +++++++++++------- 1 file changed, 155 insertions(+), 107 deletions(-) diff --git a/data-ingestion-and-preparation/dask-cluster.ipynb b/data-ingestion-and-preparation/dask-cluster.ipynb index 449be57..d35279d 100644 --- a/data-ingestion-and-preparation/dask-cluster.ipynb +++ b/data-ingestion-and-preparation/dask-cluster.ipynb @@ -32,26 +32,6 @@ "Import mlrun and dask. nuclio is used just to convert the code into an mlrun function" ] }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Both server & client are aligned (0.7.1).\n" - ] - } - ], - "source": [ - "#Make sure thar mlrun is installed. if it's already installed then skip this step\n", - "#to instlal mlrun run the following\n", - "\n", - "!/User/align_mlrun.sh" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -61,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 86, "metadata": {}, "outputs": [], "source": [ @@ -70,19 +50,9 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 87, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - " % Total % Received % Xferd Average Speed Time Time Time Current\n", - " Dload Upload Total Spent Left Speed\n", - "100 84.9M 100 84.9M 0 0 21.7M 0 0:00:03 0:00:03 --:--:-- 21.7M\n" - ] - } - ], + "outputs": [], "source": [ "import mlrun\n", "import requests\n", @@ -95,20 +65,11 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "# nuclio: ignore\n", - "import nuclio " - ] - }, - { - "cell_type": "code", - "execution_count": 5, + "execution_count": 88, "metadata": {}, "outputs": [], "source": [ + "# mlrun: start-code\n", "from mlrun.execution import MLClientCtx\n", "from mlrun.datastore import DataItem\n", "\n", @@ -141,11 +102,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 89, "metadata": {}, "outputs": [], "source": [ - "def test_dask(context: MLClientCtx,\n", + "def test_dask(context,\n", " dataset: DataItem,\n", " dask_client: str=None) -> None:\n", " \n", @@ -162,11 +123,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 90, "metadata": {}, "outputs": [], "source": [ - "# nuclio: end-code" + "# mlrun: end-code" ] }, { @@ -178,14 +139,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 91, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2021-10-12 09:43:54,745 [info] loaded project default from MLRun DB\n" + "> 2022-06-07 14:18:56,952 [info] loaded project default from MLRun DB\n" ] } ], @@ -212,12 +173,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "fn = mlrun.code_to_function(\"test_dask\", kind='job', image='mlrun/mlrun', handler=\"test_dask\").apply(mlrun.mount_v3io())" - ] + "source": [] }, { "cell_type": "markdown", @@ -228,16 +187,16 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 92, "metadata": {}, "outputs": [], "source": [ - "dsf = mlrun.new_function(\"dask_init\", kind='dask', image='mlrun/mlrun').apply(mlrun.mount_v3io())" + "dsf = mlrun.new_function(\"dask_init\", kind='dask', image='mlrun/ml-models').apply(mlrun.mount_v3io())" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 93, "metadata": {}, "outputs": [], "source": [ @@ -250,21 +209,22 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 94, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2021-10-12 09:44:06,095 [info] trying dask client at: tcp://mlrun-dask-init-b76f44f5-0.default-tenant:8786\n", - "> 2021-10-12 09:44:06,116 [info] using remote dask scheduler (mlrun-dask-init-b76f44f5-0) at: tcp://mlrun-dask-init-b76f44f5-0.default-tenant:8786\n" + "> 2022-06-07 14:18:57,008 [info] trying dask client at: tcp://mlrun-dask-init-d0ef8acd-8.default-tenant:8786\n", + "> 2022-06-07 14:19:27,011 [warning] remote scheduler at tcp://mlrun-dask-init-d0ef8acd-8.default-tenant:8786 not ready, will try to restart Timed out trying to connect to tcp://mlrun-dask-init-d0ef8acd-8.default-tenant:8786 after 30 s\n", + "> 2022-06-07 14:19:37,599 [info] using remote dask scheduler (mlrun-dask-init-d1179375-8) at: tcp://mlrun-dask-init-d1179375-8.default-tenant:8786\n" ] }, { "data": { "text/html": [ - "dashboard link: default-tenant.app.app-lab-eks-testing.iguazio-cd1.com:30990" + "dashboard link: default-tenant.app.dev39.lab.iguazeng.com:32166" ], "text/plain": [ "" @@ -276,31 +236,89 @@ { "data": { "text/html": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "
\n", - "

Client

\n", - "\n", - "
\n", - "

Cluster

\n", - "
    \n", - "
  • Workers: 2
  • \n", - "
  • Cores: 2
  • \n", - "
  • Memory: 8.34 GB
  • \n", - "
\n", - "
" + "
\n", + "
\n", + "
\n", + "

Client

\n", + "

Client-dcbd3fac-e66c-11ec-8f10-958967c1f7c9

\n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "
Connection method: Direct
\n", + " Dashboard: http://mlrun-dask-init-d1179375-8.default-tenant:8787/status\n", + "
\n", + "\n", + " \n", + "
\n", + "

Scheduler Info

\n", + "
\n", + "
\n", + "
\n", + "
\n", + "

Scheduler

\n", + "

Scheduler-21df4fbf-e20b-4235-94bc-b5a313d2ed53

\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " Comm: tcp://10.200.108.145:8786\n", + " \n", + " Workers: 0\n", + "
\n", + " Dashboard: http://10.200.108.145:8787/status\n", + " \n", + " Total threads: 0\n", + "
\n", + " Started: Just now\n", + " \n", + " Total memory: 0 B\n", + "
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "

Workers

\n", + "
\n", + "\n", + " \n", + "\n", + "
\n", + "
\n", + "
\n", + " \n", + "\n", + "
\n", + "
" ], "text/plain": [ - "" + "" ] }, - "execution_count": 12, + "execution_count": 94, "metadata": {}, "output_type": "execute_result" } @@ -319,15 +337,44 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 95, "metadata": {}, "outputs": [], "source": [ - "DATA_URL = '/User/examples/ytrip.csv'\n", - "DASK_CLIENT = client.scheduler.address\n", + "DATA_URL = \"/User/examples/ytrip.csv\"\n", + "DASK_CLIENT = str(client.scheduler.address)\n", "# e.g. DASK_CLIENT = 'tcp://mlrun-dask-init-9d8122b2-b.default-tenant:8786'" ] }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'tcp://mlrun-dask-init-d1179375-8.default-tenant:8786'" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "DASK_CLIENT" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [], + "source": [ + "fn = mlrun.code_to_function(\"test_dask\", kind='job', handler=\"test_dask\", image='mlrun/ml-base').apply(mlrun.mount_v3io())" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -344,16 +391,16 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 101, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "> 2021-10-12 09:44:06,154 [info] starting run test-dask-test_dask uid=3d3ec4b558a140b5849700dc5d77c97c DB=http://mlrun-api:8080\n", - "> 2021-10-12 09:44:06,317 [info] Job is running in the background, pod: test-dask-test-dask-w28ff\n", - "> 2021-10-12 09:44:20,436 [info] run executed, status=completed\n", + "> 2022-06-07 14:21:19,759 [info] starting run dasking uid=38f5b7d118be4b5988ee8d767322e6bc DB=http://mlrun-api:8080\n", + "> 2022-06-07 14:21:19,935 [info] Job is running in the background, pod: dasking-4tmzj\n", + "> 2022-06-07 14:21:37,411 [info] run executed, status=completed\n", "final state: completed\n" ] }, @@ -528,26 +575,26 @@ " \n", " \n", " default\n", - "
...5d77c97c
\n", + "
...7322e6bc
\n", " 0\n", - " Oct 12 09:44:11\n", + " Jun 07 14:21:25\n", " completed\n", - " test-dask-test_dask\n", - "
v3io_user=dani
kind=job
owner=dani
host=test-dask-test-dask-w28ff
\n", - "
dataset
\n", - "
dask_client=tcp://mlrun-dask-init-b76f44f5-0.default-tenant:8786
\n", + " dasking\n", + "
v3io_user=avia
kind=job
owner=avia
mlrun/client_version=1.0.2
host=dasking-4tmzj
\n", + "
dataset
\n", + "
dask_client=tcp://mlrun-dask-init-d1179375-8.default-tenant:8786
\n", " \n", " \n", " \n", " \n", "\n", "\n", - "
\n", + "
\n", "
\n", - " Title\n", - " ×\n", + " Title\n", + " ×\n", "
\n", - " \n", + " \n", "
\n", "
\n" ], @@ -568,7 +615,7 @@ { "data": { "text/html": [ - " > to track results use the .show() or .logs() methods or click here to open in UI" + " > to track results use the .show() or .logs() methods or click here to open in UI" ], "text/plain": [ "" @@ -581,25 +628,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "> 2021-10-12 09:44:25,557 [info] run executed, status=completed\n" + "> 2022-06-07 14:21:39,307 [info] run executed, status=completed\n" ] }, { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 14, + "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "fn.deploy()\n", - "fn.run(handler = test_dask,\n", + "fn.run(name ='dasking',\n", + " handler = 'test_dask',\n", " inputs={\"dataset\": DATA_URL},\n", - " params={\"dask_client\": DASK_CLIENT})" + " params={\"dask_client\": DASK_CLIENT}\n", + " )" ] }, { @@ -639,4 +687,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +}