From e818f52d231ac44a2517729a8bf3063f53efcd7b Mon Sep 17 00:00:00 2001 From: Mario Bourgoin Date: Tue, 25 Sep 2018 19:31:17 +0000 Subject: [PATCH] Replace 'az login' with a conditional expression. --- Keras_Tensorflow/04_DeployOnAKS.ipynb | 149 ++++++- Tensorflow/04_DeployOnAKS.ipynb | 600 +++++++++++++++----------- 2 files changed, 498 insertions(+), 251 deletions(-) diff --git a/Keras_Tensorflow/04_DeployOnAKS.ipynb b/Keras_Tensorflow/04_DeployOnAKS.ipynb index 915a378..bd46c62 100644 --- a/Keras_Tensorflow/04_DeployOnAKS.ipynb +++ b/Keras_Tensorflow/04_DeployOnAKS.ipynb @@ -51,12 +51,17 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 2, "metadata": { "tags": [ "parameters" ] }, +======= + "execution_count": null, + "metadata": {}, +>>>>>>> Stashed changes "outputs": [], "source": [ "%%writefile --append .env\n", @@ -93,7 +98,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The command below will initiate a login to your Azure account. It will pop up with an url to go to where you will enter a one off code and log into your Azure account using your browser." + "If you are not already logged in to an Azure account, the command below will initiate a login. This will pop up a browser where you can select your login." ] }, { @@ -102,7 +107,13 @@ "metadata": {}, "outputs": [], "source": [ - "!az login -o table" + "%%bash\n", + "list=`az account list -o table`\n", + "if [ \"$list\" == '[]' ] || [ \"$list\" == '' ]; then \n", + " az login -o table\n", + "else\n", + " az account list -o table \n", + "fi" ] }, { @@ -211,6 +222,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 5, "metadata": {}, "outputs": [ @@ -223,6 +235,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!sudo env \"PATH=$PATH\" az aks install-cli" ] @@ -259,6 +276,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 7, "metadata": {}, "outputs": [ @@ -271,6 +289,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get nodes" ] @@ -284,6 +307,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 8, "metadata": {}, "outputs": [ @@ -303,6 +327,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get pods --all-namespaces" ] @@ -323,7 +352,11 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 11, +======= + "execution_count": null, +>>>>>>> Stashed changes "metadata": {}, "outputs": [], "source": [ @@ -409,7 +442,24 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 12, +======= + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "def write_json_to_file(json_dict, filename, mode='w'):\n", + " with open(filename, mode) as outfile:\n", + " json.dump(json_dict, outfile, indent=4, sort_keys=True)\n", + " outfile.write('\\n\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": null, +>>>>>>> Stashed changes "metadata": {}, "outputs": [], "source": [ @@ -418,7 +468,11 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 13, +======= + "execution_count": null, +>>>>>>> Stashed changes "metadata": {}, "outputs": [], "source": [ @@ -434,6 +488,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 14, "metadata": {}, "outputs": [ @@ -523,6 +578,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!cat az-dl.json" ] @@ -536,6 +596,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 15, "metadata": {}, "outputs": [ @@ -548,6 +609,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl create -f az-dl.json" ] @@ -561,6 +627,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 17, "metadata": {}, "outputs": [ @@ -581,6 +648,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get pods --all-namespaces" ] @@ -594,6 +666,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 18, "metadata": {}, "outputs": [ @@ -623,6 +696,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get events" ] @@ -636,7 +714,11 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 19, +======= + "execution_count": null, +>>>>>>> Stashed changes "metadata": {}, "outputs": [], "source": [ @@ -646,6 +728,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 20, "metadata": {}, "outputs": [ @@ -723,12 +806,18 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl logs {pod_dict['items'][0]['metadata']['name']}" ] }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 21, "metadata": {}, "outputs": [ @@ -741,6 +830,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get deployment" ] @@ -754,6 +848,7 @@ }, { "cell_type": "code", +<<<<<<< Updated upstream "execution_count": 22, "metadata": {}, "outputs": [ @@ -766,6 +861,11 @@ ] } ], +======= + "execution_count": null, + "metadata": {}, + "outputs": [], +>>>>>>> Stashed changes "source": [ "!kubectl get service azure-dl" ] @@ -774,7 +874,52 @@ "cell_type": "markdown", "metadata": {}, "source": [ +<<<<<<< Updated upstream "Next, we will [test our web application deployed on AKS](05_TestWebApp.ipynb)." +======= + "Next, we will [test our web application deployed on AKS](05_TestWebApp.ipynb). Once, we are done with all the notebooks of the tutorial, below instructions can be used to delete the cluster and free resources." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Tear it all down" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once you are done with your cluster you can use the following two commands to destroy it all." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!kubectl delete -f az-dl.json" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!az aks delete -n $aks_name -g $resource_group -y" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!az group delete --name $resource_group -y" +>>>>>>> Stashed changes ] } ], diff --git a/Tensorflow/04_DeployOnAKS.ipynb b/Tensorflow/04_DeployOnAKS.ipynb index 8fa6d73..3bd415c 100644 --- a/Tensorflow/04_DeployOnAKS.ipynb +++ b/Tensorflow/04_DeployOnAKS.ipynb @@ -42,34 +42,42 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "metadata": { "tags": [ "parameters" ] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Appending to .env\n" + ] + } + ], "source": [ "%%writefile --append .env\n", "# This cell is tagged `parameters`\n", "# Please modify the values below as you see fit\n", "\n", "# If you have multiple subscriptions select the subscription you want to use \n", - "selected_subscription = \"YOUR_SUBSCRIPTION\"\n", + "selected_subscription = \"Team Danielle Internal\"\n", "\n", "# Resource group, name and location for AKS cluster.\n", - "resource_group = \"RESOURCE_GROUP\" \n", - "aks_name = \"AKS_CLUSTER_NAME\"\n", + "resource_group = \"mabouaks\" \n", + "aks_name = \"mabouaks\"\n", "location = \"eastus\"" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ - "%dotenv\n", + "%dotenv -o\n", "image_name = os.getenv('docker_login') + os.getenv('image_repo')" ] }, @@ -79,52 +87,325 @@ "source": [ "\n", "## Azure account login\n", - "The command below will initiate a login to your Azure account. It will pop up with an url to go to where you will enter a one off code and log into your Azure account using your browser." + "If you are not already logged in to an Azure account, the command below will initiate a login. It will pop up a browser where you can select an Azure account." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "scrolled": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name CloudName SubscriptionId State IsDefault\n", + "---------------------------------------------- ----------- ------------------------------------ ------- -----------\n", + "Boston DS Dev AzureCloud 0ca618d2-22a8-413a-96d0-0f1b531129c3 Enabled False\n", + "Solution Template Testing AzureCloud 3bcfa59c-82a0-44f9-ac08-b3479370bace Enabled False\n", + "DEMO - how RepDemo are you AzureCloud fe4d94f0-dc5b-4c09-9b85-863413b0192b Enabled False\n", + "Microsoft Azure Internal - Demos AzureCloud b3a823e7-7472-4111-becc-9a211a558a05 Enabled False\n", + "Azure Stack Diagnostics CI and Production VaaS AzureCloud a8183b2d-7a4c-45e9-8736-dac11b84ff14 Enabled False\n", + "Azure Cat E2E AzureCloud fc4ea3c9-1d30-4f18-b33b-7404e7da0123 Enabled False\n", + "Core-ES-BLD AzureCloud 54e18c35-3863-4a17-8e52-b5aa1e65847e Enabled False\n", + "Cosmos_WDG_Core_BnB_100348 AzureCloud dae41bd3-9db4-4b9b-943e-832b57cac828 Enabled False\n", + "CFPlatformBuild AzureCloud e326c6f8-2c46-450f-9706-a03b90f06a0f Enabled False\n", + "Data Wrangling Preview AzureCloud 215613ac-9dfb-488c-be46-c387e999b127 Enabled False\n", + "Microsoft Azure Internal - Mohamed AzureCloud cc53b927-25cb-43c2-a741-a50b97c46532 Enabled False\n", + "Boston-DS-Brandon-Dev AzureCloud e984a9db-1a27-4f54-98fc-282cf0dcda04 Enabled False\n", + "Team Danielle Internal AzureCloud edf507a2-6235-46c5-b560-fd463ba2e771 Enabled True\n", + "Boston Engineering AzureCloud bc4170f0-cc6e-49d2-ba65-bc00a7a4df6b Enabled False\n", + "Team TJ AzureCloud 0eccc365-be66-4b08-a242-3c6fdb53cb61 Enabled False\n", + "Azure Internal - TATK AzureCloud 872ff0da-188e-4461-8cf7-26e1c3e28ebb Enabled False\n" + ] + } + ], "source": [ - "!az login -o table" + "%%bash\n", + "list=`az account list -o table`\n", + "if [ \"$list\" == '[]' ] || [ \"$list\" == '' ]; then \n", + " az login -o table\n", + "else\n", + " az account list -o table \n", + "fi" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[0m" + ] + } + ], "source": [ "!az account set --subscription \"$selected_subscription\"" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\r\n", + " \"environmentName\": \"AzureCloud\",\r\n", + " \"id\": \"edf507a2-6235-46c5-b560-fd463ba2e771\",\r\n", + " \"isDefault\": true,\r\n", + " \"name\": \"Team Danielle Internal\",\r\n", + " \"state\": \"Enabled\",\r\n", + " \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\",\r\n", + " \"user\": {\r\n", + " \"name\": \"mabou@microsoft.com\",\r\n", + " \"type\": \"user\"\r\n", + " }\r\n", + "}\r\n", + "\u001b[0m" + ] + } + ], "source": [ "!az account show" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33mRegistering is still on-going. You can monitor using 'az provider show -n Microsoft.ContainerService'\u001b[0m\r\n", + "\u001b[0m" + ] + } + ], "source": [ "!az provider register -n Microsoft.ContainerService" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\r\n", + " \"authorization\": {\r\n", + " \"applicationId\": \"7319c514-987d-4e9b-ac3d-d38c4f427f4c\",\r\n", + " \"managedByRoleDefinitionId\": \"8e3af657-a8ff-443c-a75c-2fe8c4bcb635\",\r\n", + " \"roleDefinitionId\": \"1b4a0c7f-2217-416f-acfa-cf73452fdc1c\"\r\n", + " },\r\n", + " \"id\": \"/subscriptions/edf507a2-6235-46c5-b560-fd463ba2e771/providers/Microsoft.ContainerService\",\r\n", + " \"namespace\": \"Microsoft.ContainerService\",\r\n", + " \"registrationState\": \"Registered\",\r\n", + " \"resourceTypes\": [\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2017-07-01\",\r\n", + " \"2017-01-31\",\r\n", + " \"2016-09-30\",\r\n", + " \"2016-03-30\"\r\n", + " ],\r\n", + " \"capabilities\": \"None\",\r\n", + " \"locations\": [\r\n", + " \"Japan East\",\r\n", + " \"Central US\",\r\n", + " \"East US 2\",\r\n", + " \"Japan West\",\r\n", + " \"East Asia\",\r\n", + " \"South Central US\",\r\n", + " \"Australia East\",\r\n", + " \"Australia Southeast\",\r\n", + " \"Brazil South\",\r\n", + " \"Southeast Asia\",\r\n", + " \"West US\",\r\n", + " \"North Central US\",\r\n", + " \"West Europe\",\r\n", + " \"North Europe\",\r\n", + " \"East US\",\r\n", + " \"UK West\",\r\n", + " \"UK South\",\r\n", + " \"West Central US\",\r\n", + " \"West US 2\",\r\n", + " \"South India\",\r\n", + " \"Central India\",\r\n", + " \"West India\",\r\n", + " \"Canada East\",\r\n", + " \"Canada Central\",\r\n", + " \"Korea South\",\r\n", + " \"Korea Central\"\r\n", + " ],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"containerServices\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2018-03-31\",\r\n", + " \"2017-08-31\"\r\n", + " ],\r\n", + " \"capabilities\": \"None\",\r\n", + " \"locations\": [\r\n", + " \"East US\",\r\n", + " \"West Europe\",\r\n", + " \"Central US\",\r\n", + " \"Canada Central\",\r\n", + " \"Canada East\",\r\n", + " \"UK South\",\r\n", + " \"West US\",\r\n", + " \"West US 2\",\r\n", + " \"Australia East\",\r\n", + " \"North Europe\",\r\n", + " \"Japan East\",\r\n", + " \"East US 2\",\r\n", + " \"Southeast Asia\"\r\n", + " ],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"managedClusters\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2017-08-31\",\r\n", + " \"2017-01-31\",\r\n", + " \"2016-09-30\",\r\n", + " \"2016-03-30\",\r\n", + " \"2015-11-01-preview\"\r\n", + " ],\r\n", + " \"locations\": [],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"locations\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2017-08-31\",\r\n", + " \"2016-03-30\"\r\n", + " ],\r\n", + " \"locations\": [\r\n", + " \"East US\",\r\n", + " \"West Europe\",\r\n", + " \"Central US\",\r\n", + " \"UK West\",\r\n", + " \"West Central US\",\r\n", + " \"West US 2\",\r\n", + " \"South India\",\r\n", + " \"Central India\",\r\n", + " \"West India\",\r\n", + " \"Canada East\",\r\n", + " \"Canada Central\",\r\n", + " \"Korea South\",\r\n", + " \"Korea Central\",\r\n", + " \"UK South\",\r\n", + " \"Australia East\",\r\n", + " \"North Europe\",\r\n", + " \"Japan East\",\r\n", + " \"East US 2\",\r\n", + " \"Southeast Asia\"\r\n", + " ],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"locations/operationresults\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2017-07-01\",\r\n", + " \"2017-01-31\",\r\n", + " \"2016-09-30\",\r\n", + " \"2016-03-30\"\r\n", + " ],\r\n", + " \"locations\": [\r\n", + " \"Japan East\",\r\n", + " \"Central US\",\r\n", + " \"East US 2\",\r\n", + " \"Japan West\",\r\n", + " \"East Asia\",\r\n", + " \"South Central US\",\r\n", + " \"Australia East\",\r\n", + " \"Australia Southeast\",\r\n", + " \"Brazil South\",\r\n", + " \"Southeast Asia\",\r\n", + " \"West US\",\r\n", + " \"North Central US\",\r\n", + " \"West Europe\",\r\n", + " \"North Europe\",\r\n", + " \"East US\",\r\n", + " \"UK West\",\r\n", + " \"UK South\",\r\n", + " \"West Central US\",\r\n", + " \"West US 2\",\r\n", + " \"South India\",\r\n", + " \"Central India\",\r\n", + " \"West India\",\r\n", + " \"Canada East\",\r\n", + " \"Canada Central\",\r\n", + " \"Korea South\",\r\n", + " \"Korea Central\"\r\n", + " ],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"locations/operations\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2018-03-31\",\r\n", + " \"2017-08-31\",\r\n", + " \"2017-07-01\",\r\n", + " \"2017-01-31\",\r\n", + " \"2016-09-30\",\r\n", + " \"2016-03-30\",\r\n", + " \"2015-11-01-preview\"\r\n", + " ],\r\n", + " \"locations\": [],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"operations\"\r\n", + " },\r\n", + " {\r\n", + " \"aliases\": null,\r\n", + " \"apiVersions\": [\r\n", + " \"2017-09-30\"\r\n", + " ],\r\n", + " \"locations\": [\r\n", + " \"East US\",\r\n", + " \"West Europe\",\r\n", + " \"Central US\",\r\n", + " \"Canada East\",\r\n", + " \"Canada Central\",\r\n", + " \"UK South\",\r\n", + " \"West US\",\r\n", + " \"West US 2\",\r\n", + " \"Australia East\",\r\n", + " \"North Europe\",\r\n", + " \"Japan East\",\r\n", + " \"East US 2\",\r\n", + " \"Southeast Asia\"\r\n", + " ],\r\n", + " \"properties\": null,\r\n", + " \"resourceType\": \"locations/orchestrators\"\r\n", + " }\r\n", + " ]\r\n", + "}\r\n", + "\u001b[0m" + ] + } + ], "source": [ "!az provider show -n Microsoft.ContainerService" ] @@ -147,9 +428,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\r\n", + " \"id\": \"/subscriptions/edf507a2-6235-46c5-b560-fd463ba2e771/resourceGroups/mabouaks\",\r\n", + " \"location\": \"eastus\",\r\n", + " \"managedBy\": null,\r\n", + " \"name\": \"mabouaks\",\r\n", + " \"properties\": {\r\n", + " \"provisioningState\": \"Succeeded\"\r\n", + " },\r\n", + " \"tags\": null\r\n", + "}\r\n", + "\u001b[0m" + ] + } + ], "source": [ " !az group create --name $resource_group --location $location" ] @@ -165,7 +464,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33mSSH key files '/home/mabou/.ssh/id_rsa' and '/home/mabou/.ssh/id_rsa.pub' have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage like Azure Cloud Shell without an attached file share, back up your keys to a safe location\u001b[0m\n", + "\u001b[K - Running ...principal creation[##################################] 100.0000%\r" + ] + } + ], "source": [ "!az aks create --resource-group $resource_group --name $aks_name --node-count 1 --generate-ssh-keys -s Standard_NC6" ] @@ -181,18 +489,9 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[33mDownloading client to /usr/local/bin/kubectl from https://storage.googleapis.com/kubernetes-release/release/v1.11.1/bin/linux/amd64/kubectl\u001b[0m\n", - "\u001b[33mPlease ensure that /usr/local/bin is in your search PATH, so the `kubectl` command can be found.\u001b[0m\n" - ] - } - ], + "outputs": [], "source": [ "!sudo az aks install-cli" ] @@ -225,18 +524,9 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NAME STATUS ROLES AGE VERSION\r\n", - "aks-nodepool1-28016997-0 Ready agent 59d v1.9.6\r\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl get nodes" ] @@ -250,25 +540,9 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NAMESPACE NAME READY STATUS RESTARTS AGE\r\n", - "kube-system azureproxy-79c5db744-r5ggd 1/1 Running 2 59d\r\n", - "kube-system heapster-55f855b47-4m7xr 2/2 Running 0 59d\r\n", - "kube-system kube-dns-v20-7c556f89c5-4z4z6 3/3 Running 0 59d\r\n", - "kube-system kube-dns-v20-7c556f89c5-mp5fh 3/3 Running 0 59d\r\n", - "kube-system kube-proxy-k8t2c 1/1 Running 0 59d\r\n", - "kube-system kube-svc-redirect-z6ppp 1/1 Running 8 59d\r\n", - "kube-system kubernetes-dashboard-546f987686-8krxm 1/1 Running 2 59d\r\n", - "kube-system tunnelfront-695bcbdc68-t4l8t 1/1 Running 28 59d\r\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl get pods --all-namespaces" ] @@ -285,7 +559,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -371,7 +645,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -380,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -396,95 +670,9 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{\r\n", - " \"apiVersion\": \"apps/v1beta1\",\r\n", - " \"kind\": \"Deployment\",\r\n", - " \"metadata\": {\r\n", - " \"name\": \"azure-dl\"\r\n", - " },\r\n", - " \"spec\": {\r\n", - " \"replicas\": 1,\r\n", - " \"template\": {\r\n", - " \"metadata\": {\r\n", - " \"labels\": {\r\n", - " \"app\": \"azure-dl\"\r\n", - " }\r\n", - " },\r\n", - " \"spec\": {\r\n", - " \"containers\": [\r\n", - " {\r\n", - " \"env\": [\r\n", - " {\r\n", - " \"name\": \"LD_LIBRARY_PATH\",\r\n", - " \"value\": \"$LD_LIBRARY_PATH:/usr/local/nvidia/lib64:/opt/conda/envs/py3.6/lib\"\r\n", - " }\r\n", - " ],\r\n", - " \"image\": \"caia/tfresnet-gpu\",\r\n", - " \"name\": \"azure-dl\",\r\n", - " \"ports\": [\r\n", - " {\r\n", - " \"containerPort\": 80,\r\n", - " \"name\": \"model\"\r\n", - " }\r\n", - " ],\r\n", - " \"resources\": {\r\n", - " \"limits\": {\r\n", - " \"alpha.kubernetes.io/nvidia-gpu\": 1\r\n", - " },\r\n", - " \"requests\": {\r\n", - " \"alpha.kubernetes.io/nvidia-gpu\": 1\r\n", - " }\r\n", - " },\r\n", - " \"volumeMounts\": [\r\n", - " {\r\n", - " \"mountPath\": \"/usr/local/nvidia\",\r\n", - " \"name\": \"nvidia\"\r\n", - " }\r\n", - " ]\r\n", - " }\r\n", - " ],\r\n", - " \"volumes\": [\r\n", - " {\r\n", - " \"hostPath\": {\r\n", - " \"path\": \"/usr/local/nvidia\"\r\n", - " },\r\n", - " \"name\": \"nvidia\"\r\n", - " }\r\n", - " ]\r\n", - " }\r\n", - " }\r\n", - " }\r\n", - "}\r\n", - "\r\n", - "{\r\n", - " \"apiVersion\": \"v1\",\r\n", - " \"kind\": \"Service\",\r\n", - " \"metadata\": {\r\n", - " \"name\": \"azure-dl\"\r\n", - " },\r\n", - " \"spec\": {\r\n", - " \"ports\": [\r\n", - " {\r\n", - " \"port\": 80\r\n", - " }\r\n", - " ],\r\n", - " \"selector\": {\r\n", - " \"app\": \"azure-dl\"\r\n", - " },\r\n", - " \"type\": \"LoadBalancer\"\r\n", - " }\r\n", - "}\r\n", - "\r\n" - ] - } - ], + "outputs": [], "source": [ "!cat az-dl.json" ] @@ -498,18 +686,9 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "deployment.apps/azure-dl created\n", - "service/azure-dl created\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl create -f az-dl.json" ] @@ -523,26 +702,9 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NAMESPACE NAME READY STATUS RESTARTS AGE\r\n", - "default azure-dl-c6b866d47-mn8pr 1/1 Running 0 10m\r\n", - "kube-system azureproxy-79c5db744-r5ggd 1/1 Running 2 59d\r\n", - "kube-system heapster-55f855b47-4m7xr 2/2 Running 0 59d\r\n", - "kube-system kube-dns-v20-7c556f89c5-4z4z6 3/3 Running 0 59d\r\n", - "kube-system kube-dns-v20-7c556f89c5-mp5fh 3/3 Running 0 59d\r\n", - "kube-system kube-proxy-k8t2c 1/1 Running 0 59d\r\n", - "kube-system kube-svc-redirect-z6ppp 1/1 Running 8 59d\r\n", - "kube-system kubernetes-dashboard-546f987686-8krxm 1/1 Running 2 59d\r\n", - "kube-system tunnelfront-695bcbdc68-t4l8t 1/1 Running 28 59d\r\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl get pods --all-namespaces" ] @@ -556,69 +718,18 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "LAST SEEN FIRST SEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE\r\n", - "12m 12m 1 azure-dl-b47cf8cdd-4gg6v.15485effd8145de4 Pod spec.containers{azure-dl} Normal Killing kubelet, aks-nodepool1-28016997-0 Killing container with id docker://azure-dl:Need to kill Pod\r\n", - "10m 10m 1 azure-dl-c6b866d47-mn8pr.15485f14253c78d6 Pod Normal Scheduled default-scheduler Successfully assigned azure-dl-c6b866d47-mn8pr to aks-nodepool1-28016997-0\r\n", - "10m 10m 1 azure-dl-c6b866d47-mn8pr.15485f1432f1e899 Pod Normal SuccessfulMountVolume kubelet, aks-nodepool1-28016997-0 MountVolume.SetUp succeeded for volume \"nvidia\" \r\n", - "10m 10m 1 azure-dl-c6b866d47-mn8pr.15485f1434ed3ff5 Pod Normal SuccessfulMountVolume kubelet, aks-nodepool1-28016997-0 MountVolume.SetUp succeeded for volume \"default-token-crgnj\" \r\n", - "10m 10m 1 azure-dl-c6b866d47-mn8pr.15485f145faeeb7b Pod spec.containers{azure-dl} Normal Pulling kubelet, aks-nodepool1-28016997-0 pulling image \"caia/tfresnet-gpu\"\r\n", - "7m 7m 1 azure-dl-c6b866d47-mn8pr.15485f3ec9c43c59 Pod spec.containers{azure-dl} Normal Pulled kubelet, aks-nodepool1-28016997-0 Successfully pulled image \"caia/tfresnet-gpu\"\r\n", - "7m 7m 1 azure-dl-c6b866d47-mn8pr.15485f3ed4d030d6 Pod spec.containers{azure-dl} Normal Created kubelet, aks-nodepool1-28016997-0 Created container\r\n", - "7m 7m 1 azure-dl-c6b866d47-mn8pr.15485f3edc58897b Pod spec.containers{azure-dl} Normal Started kubelet, aks-nodepool1-28016997-0 Started container\r\n", - "10m 10m 1 azure-dl-c6b866d47.15485f1424ed5001 ReplicaSet Normal SuccessfulCreate replicaset-controller Created pod: azure-dl-c6b866d47-mn8pr\r\n", - "12m 12m 1 azure-dl.15485efd312f727a Service Normal DeletingLoadBalancer service-controller Deleting load balancer\r\n", - "10m 10m 1 azure-dl.15485f14238f49da Deployment Normal ScalingReplicaSet deployment-controller Scaled up replica set azure-dl-c6b866d47 to 1\r\n", - "9m 9m 1 azure-dl.15485f1eb448e622 Service Normal DeletedLoadBalancer service-controller Deleted load balancer\r\n", - "9m 9m 1 azure-dl.15485f1eb449d728 Service Normal EnsuringLoadBalancer service-controller Ensuring load balancer\r\n", - "6m 6m 1 azure-dl.15485f4a6f913ac5 Service Normal EnsuredLoadBalancer service-controller Ensured load balancer\r\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl get events" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2018-08-06 18:33:16,788 CRIT Supervisor running as root (no user in config file)\r\n", - "2018-08-06 18:33:16,790 INFO supervisord started with pid 1\r\n", - "2018-08-06 18:33:17,792 INFO spawned: 'program_exit' with pid 9\r\n", - "2018-08-06 18:33:17,794 INFO spawned: 'nginx' with pid 10\r\n", - "2018-08-06 18:33:17,796 INFO spawned: 'gunicorn' with pid 11\r\n", - "2018-08-06 18:33:18,828 INFO success: program_exit entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\r\n", - "2018-08-06 18:33:22.752422: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\r\n", - "2018-08-06 18:33:22.947363: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties: \r\n", - "name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235\r\n", - "pciBusID: ddde:00:00.0\r\n", - "totalMemory: 11.17GiB freeMemory: 11.10GiB\r\n", - "2018-08-06 18:33:22.947410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0\r\n", - "2018-08-06 18:33:22,947 INFO success: nginx entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)\r\n", - "2018-08-06 18:33:23.298234: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:\r\n", - "2018-08-06 18:33:23.298552: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958] 0 \r\n", - "2018-08-06 18:33:23.298694: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: N \r\n", - "2018-08-06 18:33:23.299099: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10761 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: ddde:00:00.0, compute capability: 3.7)\r\n", - "{\"message\": \"Restoring parameters from resnet_v1_152.ckpt\", \"logger\": \"tensorflow\", \"path\": \"/opt/conda/envs/py3.5/lib/python3.5/site-packages/tensorflow/python/platform/tf_logging.py\", \"host\": \"azure-dl-c6b866d47-mn8pr\", \"level\": \"INFO\", \"stack_info\": null, \"tags\": [], \"timestamp\": \"2018-08-06T18:33:30.336488Z\", \"msg\": \"Restoring parameters from %s\"}\r\n", - "{\"message\": \"Model loading time: 8247.39 ms\", \"logger\": \"model_driver\", \"path\": \"/code/driver.py\", \"host\": \"azure-dl-c6b866d47-mn8pr\", \"level\": \"INFO\", \"stack_info\": null, \"tags\": [], \"timestamp\": \"2018-08-06T18:33:30.998172Z\"}\r\n", - "Initialising\r\n", - "{\"message\": \" * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\", \"logger\": \"werkzeug\", \"path\": \"/opt/conda/envs/py3.5/lib/python3.5/site-packages/werkzeug/_internal.py\", \"host\": \"azure-dl-c6b866d47-mn8pr\", \"level\": \"INFO\", \"stack_info\": null, \"tags\": [], \"timestamp\": \"2018-08-06T18:33:31.003895Z\", \"msg\": \" * Running on %s://%s:%d/ %s\"}\r\n", - "2018-08-06 18:33:38,015 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 20 seconds (startsecs)\r\n" - ] - } - ], + "outputs": [], "source": [ "pod_json = !kubectl get pods -o json\n", "pod_dict = json.loads(''.join(pod_json))\n", @@ -634,18 +745,9 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", - "azure-dl LoadBalancer 10.0.153.149 40.121.110.33 80:32087/TCP 11m\r\n" - ] - } - ], + "outputs": [], "source": [ "!kubectl get service azure-dl" ]