From bca09d9fac89e344d396455c4afca3b3d875bdea Mon Sep 17 00:00:00 2001 From: Brendan Schell Date: Thu, 19 Sep 2024 11:55:11 -0400 Subject: [PATCH] small fix on delete nb --- .../sync/001-scale-delete-worker-pools.ipynb | 83 ++++++++----------- 1 file changed, 35 insertions(+), 48 deletions(-) diff --git a/notebooks/scenarios/bigquery/sync/001-scale-delete-worker-pools.ipynb b/notebooks/scenarios/bigquery/sync/001-scale-delete-worker-pools.ipynb index fb4bd0379e6..d2ca74cd56f 100644 --- a/notebooks/scenarios/bigquery/sync/001-scale-delete-worker-pools.ipynb +++ b/notebooks/scenarios/bigquery/sync/001-scale-delete-worker-pools.ipynb @@ -27,7 +27,7 @@ { "cell_type": "code", "execution_count": null, - "id": "589bbac0", + "id": "1", "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1", + "id": "2", "metadata": {}, "outputs": [], "source": [ @@ -57,22 +57,20 @@ { "cell_type": "code", "execution_count": null, - "id": "2", + "id": "3", "metadata": {}, "outputs": [], "source": [ - "environment = os.environ.get(\"ORCHESTRA_DEPLOYMENT_TYPE\", \"python\")\n", - "\n", "num_workers = int(os.environ.get(\"NUM_TEST_WORKERS\", 1))\n", "\n", - "ROOT_EMAIL = \"admin@bigquery.org\"\n", - "ROOT_PASSWORD = \"bqpw\"\n", + "# ROOT_EMAIL = \"admin@bigquery.org\"\n", + "# ROOT_PASSWORD = \"bqpw\"\n", "environment" ] }, { "cell_type": "markdown", - "id": "3", + "id": "4", "metadata": {}, "source": [ "### Launch server & login" @@ -81,7 +79,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -89,7 +87,6 @@ " name=\"bigquery-low\",\n", " server_side_type=\"low\",\n", " dev_mode=True,\n", - " reset=True,\n", " n_consumers=1,\n", " create_producer=True,\n", " port=low_port,\n", @@ -99,7 +96,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -109,29 +106,27 @@ { "cell_type": "code", "execution_count": null, - "id": "6", + "id": "7", "metadata": {}, "outputs": [], "source": [ - "low_client = server_low.login(\n", - " email=ROOT_EMAIL, password=ROOT_PASSWORD\n", - ")" + "low_client = server_low.login(email=\"info@openmined.org\", password=\"changethis\")" ] }, { "cell_type": "code", "execution_count": null, - "id": "7", + "id": "8", "metadata": {}, "outputs": [], "source": [ - "low_client.worker_pools" + "assert len(low_client.worker_pools.get_all()) == 2" ] }, { "cell_type": "code", "execution_count": null, - "id": "8", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -141,7 +136,7 @@ }, { "cell_type": "markdown", - "id": "9", + "id": "10", "metadata": {}, "source": [ "### Scale Worker pool" @@ -149,7 +144,7 @@ }, { "cell_type": "markdown", - "id": "10", + "id": "11", "metadata": {}, "source": [ "##### Scale up" @@ -158,7 +153,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -172,7 +167,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -182,7 +177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -195,14 +190,13 @@ " assert scale_up_result, scale_up_result\n", "\n", " assert (\n", - " low_client.api.services.worker_pool[default_worker_pool.name].max_count\n", - " == 5\n", + " low_client.api.services.worker_pool[default_worker_pool.name].max_count == 5\n", " )" ] }, { "cell_type": "markdown", - "id": "14", + "id": "15", "metadata": {}, "source": [ "##### Scale down" @@ -211,7 +205,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -226,7 +220,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -245,7 +239,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -258,7 +252,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "19", "metadata": {}, "source": [ "#### Delete Worker Pool" @@ -267,7 +261,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -280,7 +274,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -290,7 +284,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "22", "metadata": {}, "source": [ "#### Re-launch the default worker pool" @@ -299,7 +293,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -309,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -323,7 +317,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24", + "id": "25", "metadata": {}, "outputs": [], "source": [ @@ -337,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -347,20 +341,13 @@ { "cell_type": "code", "execution_count": null, - "id": "26", + "id": "27", "metadata": {}, "outputs": [], "source": [ - "server_low.land()" + "if environment != \"remote\":\n", + " server_low.land()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "27", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -379,7 +366,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.4" } }, "nbformat": 4,