Skip to content

Commit

Permalink
upgrade black and fix nbqa on notebooks (#3545)
Browse files Browse the repository at this point in the history
* upgrade black and fix nbqa on notebooks

* update nbqa to 1.1.0
  • Loading branch information
RafalSkolasinski committed Aug 27, 2021
1 parent 0d0997e commit d951c34
Show file tree
Hide file tree
Showing 44 changed files with 470 additions and 481 deletions.
32 changes: 16 additions & 16 deletions components/drift-detection/cifar10/cifar10_drift.ipynb
Expand Up @@ -328,8 +328,8 @@
"metadata": {},
"outputs": [],
"source": [
"CLUSTER_IPS=!(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP=CLUSTER_IPS[0]\n",
"CLUSTER_IPS = !(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP = CLUSTER_IPS[0]\n",
"print(CLUSTER_IP)"
]
},
Expand All @@ -355,8 +355,8 @@
"metadata": {},
"outputs": [],
"source": [
"SERVICE_HOSTNAMES=!(kubectl get ksvc -n cifar10drift drift-detector -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_CD=SERVICE_HOSTNAMES[0]\n",
"SERVICE_HOSTNAMES = !(kubectl get ksvc -n cifar10drift drift-detector -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_CD = SERVICE_HOSTNAMES[0]\n",
"print(SERVICE_HOSTNAME_CD)"
]
},
Expand Down Expand Up @@ -519,13 +519,13 @@
"metadata": {},
"outputs": [],
"source": [
"res=!kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[0]))\n",
"print(\"Drift\",j[\"data\"][\"is_drift\"]==1)"
"print(\"Drift\", j[\"data\"][\"is_drift\"] == 1)"
]
},
{
Expand Down Expand Up @@ -590,13 +590,13 @@
"metadata": {},
"outputs": [],
"source": [
"res=!kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[-1]))\n",
"print(\"Drift\",j[\"data\"][\"is_drift\"]==1)"
"print(\"Drift\", j[\"data\"][\"is_drift\"] == 1)"
]
},
{
Expand Down
Expand Up @@ -411,8 +411,8 @@
}
],
"source": [
"CLUSTER_IPS=!(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP=CLUSTER_IPS[0]\n",
"CLUSTER_IPS = !(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP = CLUSTER_IPS[0]\n",
"print(CLUSTER_IP)"
]
},
Expand Down Expand Up @@ -462,8 +462,8 @@
}
],
"source": [
"SERVICE_HOSTNAMES=!(kubectl get ksvc -n cifar10drift drift-detector -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_CD=SERVICE_HOSTNAMES[0]\n",
"SERVICE_HOSTNAMES = !(kubectl get ksvc -n cifar10drift drift-detector -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_CD = SERVICE_HOSTNAMES[0]\n",
"print(SERVICE_HOSTNAME_CD)"
]
},
Expand Down Expand Up @@ -696,13 +696,13 @@
}
],
"source": [
"res=!kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[0]))\n",
"print(\"Drift\",j[\"data\"][\"is_drift\"]==1)"
"print(\"Drift\", j[\"data\"][\"is_drift\"] == 1)"
]
},
{
Expand Down Expand Up @@ -829,13 +829,13 @@
}
],
"source": [
"res=!kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10drift $(kubectl get pod -n cifar10drift -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[-1]))\n",
"print(\"Drift\",j[\"data\"][\"is_drift\"]==1)"
"print(\"Drift\", j[\"data\"][\"is_drift\"] == 1)"
]
},
{
Expand Down
32 changes: 16 additions & 16 deletions components/outlier-detection/cifar10/cifar10_outlier.ipynb
Expand Up @@ -337,8 +337,8 @@
"metadata": {},
"outputs": [],
"source": [
"CLUSTER_IPS=!(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP=CLUSTER_IPS[0]\n",
"CLUSTER_IPS = !(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP = CLUSTER_IPS[0]\n",
"print(CLUSTER_IP)"
]
},
Expand Down Expand Up @@ -380,8 +380,8 @@
"metadata": {},
"outputs": [],
"source": [
"SERVICE_HOSTNAMES=!(kubectl get ksvc -n cifar10 vae-outlier -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_VAEOD=SERVICE_HOSTNAMES[0]\n",
"SERVICE_HOSTNAMES = !(kubectl get ksvc -n cifar10 vae-outlier -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_VAEOD = SERVICE_HOSTNAMES[0]\n",
"print(SERVICE_HOSTNAME_VAEOD)"
]
},
Expand Down Expand Up @@ -507,13 +507,13 @@
"metadata": {},
"outputs": [],
"source": [
"res=!kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[0]))\n",
"print(\"Outlier\",j[\"data\"][\"is_outlier\"]==[1])"
"print(\"Outlier\", j[\"data\"][\"is_outlier\"] == [1])"
]
},
{
Expand Down Expand Up @@ -564,13 +564,13 @@
"metadata": {},
"outputs": [],
"source": [
"res=!kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[-1]))\n",
"print(\"Outlier\",j[\"data\"][\"is_outlier\"]==[1])"
"print(\"Outlier\", j[\"data\"][\"is_outlier\"] == [1])"
]
},
{
Expand Down
Expand Up @@ -409,8 +409,8 @@
}
],
"source": [
"CLUSTER_IPS=!(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP=CLUSTER_IPS[0]\n",
"CLUSTER_IPS = !(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n",
"CLUSTER_IP = CLUSTER_IPS[0]\n",
"print(CLUSTER_IP)"
]
},
Expand Down Expand Up @@ -460,8 +460,8 @@
}
],
"source": [
"SERVICE_HOSTNAMES=!(kubectl get ksvc -n cifar10 vae-outlier -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_VAEOD=SERVICE_HOSTNAMES[0]\n",
"SERVICE_HOSTNAMES = !(kubectl get ksvc -n cifar10 vae-outlier -o jsonpath='{.status.url}' | cut -d \"/\" -f 3)\n",
"SERVICE_HOSTNAME_VAEOD = SERVICE_HOSTNAMES[0]\n",
"print(SERVICE_HOSTNAME_VAEOD)"
]
},
Expand Down Expand Up @@ -644,13 +644,13 @@
}
],
"source": [
"res=!kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[0]))\n",
"print(\"Outlier\",j[\"data\"][\"is_outlier\"]==[1])"
"print(\"Outlier\", j[\"data\"][\"is_outlier\"] == [1])"
]
},
{
Expand Down Expand Up @@ -732,13 +732,13 @@
}
],
"source": [
"res=!kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}') \n",
"data= []\n",
"for i in range(0,len(res)):\n",
" if res[i] == 'Data,':\n",
" data.append(res[i+1])\n",
"res = !kubectl logs -n cifar10 $(kubectl get pod -n cifar10 -l app=hello-display -o jsonpath='{.items[0].metadata.name}')\n",
"data = []\n",
"for i in range(0, len(res)):\n",
" if res[i] == \"Data,\":\n",
" data.append(res[i + 1])\n",
"j = json.loads(json.loads(data[-1]))\n",
"print(\"Outlier\",j[\"data\"][\"is_outlier\"]==[1])"
"print(\"Outlier\", j[\"data\"][\"is_outlier\"] == [1])"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions components/routers/epsilon-greedy/egreedy.ipynb
Expand Up @@ -98,8 +98,8 @@
}
],
"source": [
"VERSION=!cat ../../../version.txt\n",
"VERSION=VERSION[0]\n",
"VERSION = !cat ../../../version.txt\n",
"VERSION = VERSION[0]\n",
"VERSION"
]
},
Expand Down
8 changes: 4 additions & 4 deletions examples/ambassador/canary/ambassador_canary.ipynb
Expand Up @@ -82,8 +82,8 @@
}
],
"source": [
"VERSION=!cat ../../../version.txt\n",
"VERSION=VERSION[0]\n",
"VERSION = !cat ../../../version.txt\n",
"VERSION = VERSION[0]\n",
"VERSION"
]
},
Expand Down Expand Up @@ -385,7 +385,7 @@
"metadata": {},
"outputs": [],
"source": [
"default_count=!kubectl logs $(kubectl get pod -lseldon-app=example-main -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root:predict\" | wc -l "
"default_count = !kubectl logs $(kubectl get pod -lseldon-app=example-main -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root:predict\" | wc -l"
]
},
{
Expand All @@ -394,7 +394,7 @@
"metadata": {},
"outputs": [],
"source": [
"canary_count=!kubectl logs $(kubectl get pod -lseldon-app=example-canary -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root:predict\" | wc -l"
"canary_count = !kubectl logs $(kubectl get pod -lseldon-app=example-canary -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root:predict\" | wc -l"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/ambassador/custom/ambassador_custom.ipynb
Expand Up @@ -41,8 +41,8 @@
}
],
"source": [
"VERSION=!cat ../../../version.txt\n",
"VERSION=VERSION[0]\n",
"VERSION = !cat ../../../version.txt\n",
"VERSION = VERSION[0]\n",
"VERSION"
]
},
Expand Down
8 changes: 4 additions & 4 deletions examples/ambassador/headers/ambassador_headers.ipynb
Expand Up @@ -84,8 +84,8 @@
}
],
"source": [
"VERSION=!cat ../../../version.txt\n",
"VERSION=VERSION[0]\n",
"VERSION = !cat ../../../version.txt\n",
"VERSION = VERSION[0]\n",
"VERSION"
]
},
Expand Down Expand Up @@ -356,7 +356,7 @@
"metadata": {},
"outputs": [],
"source": [
"default_count=!kubectl logs $(kubectl get pod -lseldon-app=example-single -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l "
"default_count = !kubectl logs $(kubectl get pod -lseldon-app=example-single -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l"
]
},
{
Expand Down Expand Up @@ -421,7 +421,7 @@
"metadata": {},
"outputs": [],
"source": [
"header_count=!kubectl logs $(kubectl get pod -lseldon-app=example-header-single -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l "
"header_count = !kubectl logs $(kubectl get pod -lseldon-app=example-header-single -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/ambassador/shadow/ambassador_shadow.ipynb
Expand Up @@ -86,8 +86,8 @@
}
],
"source": [
"VERSION=!cat ../../../version.txt\n",
"VERSION=VERSION[0]\n",
"VERSION = !cat ../../../version.txt\n",
"VERSION = VERSION[0]\n",
"VERSION"
]
},
Expand Down Expand Up @@ -340,7 +340,7 @@
"metadata": {},
"outputs": [],
"source": [
"default_count=!kubectl logs $(kubectl get pod -lseldon-app=example-default -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l "
"default_count = !kubectl logs $(kubectl get pod -lseldon-app=example-default -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l"
]
},
{
Expand All @@ -349,7 +349,7 @@
"metadata": {},
"outputs": [],
"source": [
"shadow_count=!kubectl logs $(kubectl get pod -lseldon-app=example-shadow -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l "
"shadow_count = !kubectl logs $(kubectl get pod -lseldon-app=example-shadow -o jsonpath='{.items[0].metadata.name}') classifier | grep \"root.predict\" | wc -l"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions examples/batch/argo-workflows-batch/README.ipynb
Expand Up @@ -565,6 +565,7 @@
],
"source": [
"import json\n",
"\n",
"wf_arr = !argo get -n default seldon-batch-process -o json\n",
"wf = json.loads(\"\".join(wf_arr))\n",
"WF_UID = wf[\"metadata\"][\"uid\"]\n",
Expand Down
Expand Up @@ -705,18 +705,20 @@
}
],
"source": [
"from seldon_core.seldon_client import SeldonClient\n",
"import numpy as np\n",
"\n",
"from seldon_core.seldon_client import SeldonClient\n",
"\n",
"url = !kubectl get svc ambassador -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\n",
"\n",
"sc = SeldonClient(\n",
" gateway=\"ambassador\", \n",
" gateway=\"ambassador\",\n",
" gateway_endpoint=\"localhost:80\",\n",
" deployment_name=\"mlops-server\",\n",
" payload_type=\"ndarray\",\n",
" namespace=\"jx-staging\",\n",
" transport=\"rest\")\n",
" transport=\"rest\",\n",
")\n",
"\n",
"response = sc.predict(data=np.array([twenty_test.data[0]]))\n",
"\n",
Expand Down

0 comments on commit d951c34

Please sign in to comment.