Updates notebooks. Adds documentation and fixes links
This commit is contained in:
Родитель
735b3fb56b
Коммит
7897c03b47
|
@ -20,7 +20,7 @@
|
|||
"import tensorflow as tf\n",
|
||||
"from IPython.display import Image as show_image\n",
|
||||
"from PIL import Image\n",
|
||||
"from tensorflow.contrib.slim.nets import resnet_v1\n"
|
||||
"from tensorflow.contrib.slim.nets import resnet_v1"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -32,23 +32,23 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"--2018-04-04 17:59:42-- http://download.tensorflow.org/models/resnet_v1_152_2016_08_28.tar.gz\n",
|
||||
"Resolving download.tensorflow.org (download.tensorflow.org)... 172.217.14.176, 2607:f8b0:4000:806::2010\n",
|
||||
"Connecting to download.tensorflow.org (download.tensorflow.org)|172.217.14.176|:80... connected.\n",
|
||||
"--2018-04-10 10:16:47-- http://download.tensorflow.org/models/resnet_v1_152_2016_08_28.tar.gz\n",
|
||||
"Resolving download.tensorflow.org (download.tensorflow.org)... 216.58.216.176, 2607:f8b0:400a:807::2010\n",
|
||||
"Connecting to download.tensorflow.org (download.tensorflow.org)|216.58.216.176|:80... connected.\n",
|
||||
"HTTP request sent, awaiting response... 200 OK\n",
|
||||
"Length: 224342140 (214M) [application/x-tar]\n",
|
||||
"Saving to: ‘resnet_v1_152_2016_08_28.tar.gz’\n",
|
||||
"Saving to: ‘resnet_v1_152_2016_08_28.tar.gz.1’\n",
|
||||
"\n",
|
||||
"resnet_v1_152_2016_ 100%[===================>] 213.95M 120MB/s in 1.8s \n",
|
||||
"resnet_v1_152_2016_ 100%[===================>] 213.95M 57.1MB/s in 4.9s \n",
|
||||
"\n",
|
||||
"2018-04-04 17:59:44 (120 MB/s) - ‘resnet_v1_152_2016_08_28.tar.gz’ saved [224342140/224342140]\n",
|
||||
"2018-04-10 10:16:52 (43.8 MB/s) - ‘resnet_v1_152_2016_08_28.tar.gz.1’ saved [224342140/224342140]\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
@ -83,23 +83,23 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"--2018-04-04 17:59:48-- http://data.dmlc.ml/mxnet/models/imagenet/synset.txt\n",
|
||||
"--2018-04-10 10:16:54-- http://data.dmlc.ml/mxnet/models/imagenet/synset.txt\n",
|
||||
"Resolving data.dmlc.ml (data.dmlc.ml)... 54.208.175.7\n",
|
||||
"Connecting to data.dmlc.ml (data.dmlc.ml)|54.208.175.7|:80... connected.\n",
|
||||
"HTTP request sent, awaiting response... 200 OK\n",
|
||||
"Length: 31675 (31K) [text/plain]\n",
|
||||
"Saving to: ‘synset.txt’\n",
|
||||
"Saving to: ‘synset.txt.1’\n",
|
||||
"\n",
|
||||
"synset.txt 100%[===================>] 30.93K --.-KB/s in 0.03s \n",
|
||||
"synset.txt.1 100%[===================>] 30.93K --.-KB/s in 0.03s \n",
|
||||
"\n",
|
||||
"2018-04-04 17:59:48 (888 KB/s) - ‘synset.txt’ saved [31675/31675]\n",
|
||||
"2018-04-10 10:16:55 (912 KB/s) - ‘synset.txt.1’ saved [31675/31675]\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
|
@ -202,16 +202,16 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"--2018-04-02 20:08:37-- https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Lynx_lynx_poing.jpg/220px-Lynx_lynx_poing.jpg\n",
|
||||
"--2018-04-10 10:17:17-- https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Lynx_lynx_poing.jpg/220px-Lynx_lynx_poing.jpg\n",
|
||||
"Resolving upload.wikimedia.org (upload.wikimedia.org)... 208.80.153.240, 2620:0:860:ed1a::2:b\n",
|
||||
"Connecting to upload.wikimedia.org (upload.wikimedia.org)|208.80.153.240|:443... connected.\n",
|
||||
"HTTP request sent, awaiting response... 200 OK\n",
|
||||
"Length: 27183 (27K) [image/jpeg]\n",
|
||||
"Saving to: ‘220px-Lynx_lynx_poing.jpg’\n",
|
||||
"\n",
|
||||
"220px-Lynx_lynx_poi 100%[===================>] 26.55K --.-KB/s in 0.01s \n",
|
||||
"220px-Lynx_lynx_poi 100%[===================>] 26.55K --.-KB/s in 0.02s \n",
|
||||
"\n",
|
||||
"2018-04-02 20:08:37 (2.52 MB/s) - ‘220px-Lynx_lynx_poing.jpg’ saved [27183/27183]\n",
|
||||
"2018-04-10 10:17:18 (1.04 MB/s) - ‘220px-Lynx_lynx_poing.jpg’ saved [27183/27183]\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"\n",
|
||||
"def _base64img_to_numpy(base64_img_string):\n",
|
||||
" if base64_img_string.startswith('b\\''):\n",
|
||||
" base64_img_string = base64_img_string[2:-1]\n",
|
||||
" base64_img_string = base64_img_string[2:-1]\n",
|
||||
" base64Img = base64_img_string.encode('utf-8')\n",
|
||||
"\n",
|
||||
" # Preprocess the input data \n",
|
||||
|
@ -163,7 +163,9 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%run driver.py"
|
||||
|
@ -201,7 +203,9 @@
|
|||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"jsonimg = img_url_to_json(IMAGEURL)"
|
||||
|
@ -235,7 +239,7 @@
|
|||
"output_type": "stream",
|
||||
"text": [
|
||||
"INFO:tensorflow:Restoring parameters from resnet_v1_152.ckpt\n",
|
||||
"INFO:model_driver:Model loading time: 11896.44 ms\n"
|
||||
"INFO:model_driver:Model loading time: 12726.69 ms\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -258,7 +262,7 @@
|
|||
"DEBUG:PIL.PngImagePlugin:Compression method 0\n",
|
||||
"DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 345 65536\n",
|
||||
"INFO:model_driver:Predictions: {'image': [('n02127052 lynx, catamount', 0.99745172262191772), ('n02128385 leopard, Panthera pardus', 0.0015076899435371161), ('n02128757 snow leopard, ounce, Panthera uncia', 0.00051647447980940342)]}\n",
|
||||
"INFO:model_driver:Predictions took 897.97 ms\n"
|
||||
"INFO:model_driver:Predictions took 920.8 ms\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -281,7 +285,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'[{\"image\": [[\"n02127052 lynx, catamount\", 0.9974517226219177], [\"n02128385 leopard, Panthera pardus\", 0.001507689943537116], [\"n02128757 snow leopard, ounce, Panthera uncia\", 0.0005164744798094034]]}, \"Computed in 897.97 ms\"]'"
|
||||
"'[{\"image\": [[\"n02127052 lynx, catamount\", 0.9974517226219177], [\"n02128385 leopard, Panthera pardus\", 0.001507689943537116], [\"n02128757 snow leopard, ounce, Panthera uncia\", 0.0005164744798094034]]}, \"Computed in 920.8 ms\"]'"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -7,16 +7,15 @@
|
|||
},
|
||||
"source": [
|
||||
"### Deploy Web App on Azure Container Services (AKS)\n",
|
||||
"In this notebook we will set up an Azure Container Service which will be managed by Kubernetes. We will then take the Docker image we created earlier that contains our app and deploy it to the ACS cluster. Then we will check everything is working by sending an image to it and getting it scored.\n",
|
||||
"\n",
|
||||
"In this notebook, we will set up an Azure Container Service which will be managed by Kubernetes. We will then take the Docker image we created earlier that contains our app and deploy it to the AKS cluster. Then, we will check everything is working by sending an image to it and getting it scored.\n",
|
||||
" \n",
|
||||
"The process is split into the following steps:\n",
|
||||
"* [Define our resource names](#section1)\n",
|
||||
"* [Login to Azure](#section2)\n",
|
||||
"* [Create the ACS](#section3)\n",
|
||||
"* [Create a tunnel to the head node](#section4)\n",
|
||||
"* [Create a JSON schema of our APP and push it to the cluster](#section5)\n",
|
||||
"* [Test our app](TestWebApp.ipynb)\n",
|
||||
"* [Tear it all down](#section7)\n",
|
||||
"* [Create resource group and create AKS](#section3)\n",
|
||||
"* [Connect to AKS](#section4)\n",
|
||||
"* [Deploy our app](#section5)\n",
|
||||
"* [Tear it all down](#section6)\n",
|
||||
"\n",
|
||||
"This guide assumes is designed to be run on linux and requires that the Azure CLI is installed."
|
||||
]
|
||||
|
@ -25,13 +24,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section1'></a>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section1'></a>\n",
|
||||
"## Setup\n",
|
||||
"Below are the various name definitions for the resources needed to setup ACS as well as the name of the Docker image we will be using."
|
||||
]
|
||||
|
@ -62,19 +55,11 @@
|
|||
" # the subscription you want to use here"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"<a id='section2'></a>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section2'></a>\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."
|
||||
]
|
||||
|
@ -134,14 +119,8 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section3'></a>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Create resources and dependencies"
|
||||
"<a id='section3'></a>\n",
|
||||
"## Create resource group and create AKS"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -178,6 +157,13 @@
|
|||
"!az group create --name $resource_group --location $location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Below, we create the AKS cluster in the resource group we created earlier."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
|
@ -246,7 +232,9 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Install cli from comamnd prompt"
|
||||
"### Install kubectl CLI\n",
|
||||
"\n",
|
||||
"To connect to the Kubernetes cluster, we will use kubectl, the Kubernetes command-line client. To install, run the following:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -271,7 +259,67 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Below we define our manifest file for our service and load balancer. Note that we have to specify the volume mounts to the drivers that are located on the node."
|
||||
"<a id='section4'></a>\n",
|
||||
"## Connect to AKS cluster\n",
|
||||
"\n",
|
||||
"To configure kubectl to connect to the Kubernetes cluster, run the following command:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!az aks get-credentials --resource-group $resource_group --name $aks_name"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's verify connection by listing the nodes."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!kubectl get nodes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's check the pods on our cluster."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!kubectl get pods --all-namespaces"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section5'></a>\n",
|
||||
"## Deploy application\n",
|
||||
"\n",
|
||||
"Below we define our Kubernetes manifest file for our service and load balancer. Note that we have to specify the volume mounts to the drivers that are located on the node.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -398,6 +446,13 @@
|
|||
"write_json_to_file(service_temp, 'az-dl.json', mode='a') # We add the loadbelanacer template to the json file"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's check the manifest created."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
|
@ -493,70 +548,11 @@
|
|||
"!cat az-dl.json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Merged \"msAKSTFCluster\" as current context in /home/mat/.kube/config\r\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!az aks get-credentials --resource-group=$resource_group --name=$aks_name"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"NAME STATUS ROLES AGE VERSION\r\n",
|
||||
"aks-nodepool1-27496346-0 Ready agent 2m v1.7.9\r\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!kubectl get nodes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"NAMESPACE NAME READY STATUS RESTARTS AGE\r\n",
|
||||
"kube-system heapster-2574232661-07lzh 2/2 Running 0 1m\r\n",
|
||||
"kube-system kube-dns-v20-2253765213-730n6 3/3 Running 0 2m\r\n",
|
||||
"kube-system kube-dns-v20-2253765213-m9d9q 3/3 Running 0 2m\r\n",
|
||||
"kube-system kube-proxy-3d25d 1/1 Running 0 2m\r\n",
|
||||
"kube-system kube-svc-redirect-psp3n 1/1 Running 0 2m\r\n",
|
||||
"kube-system kubernetes-dashboard-2898242510-7h28r 1/1 Running 0 2m\r\n",
|
||||
"kube-system tunnelfront-527646831-lj63z 1/1 Running 0 2m\r\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!kubectl get pods --all-namespaces"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"This command will create everything we specified in the az-dl.json manifest file."
|
||||
"Next, we will use kubectl create command to deploy our application."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -581,7 +577,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"After a few seconds you should see the pod start running on the cluster."
|
||||
"Let's check if the pod is deployed."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -724,19 +720,11 @@
|
|||
"Below are the instructions to tear everything down once we are done with the cluster"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"<a id='section7'></a>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a id='section6'></a>\n",
|
||||
"## Tear it all down \n",
|
||||
"Once you are done with your cluster you can use the following two commands to destroy it all."
|
||||
]
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Загрузка…
Ссылка в новой задаче