Skip to content

Instantly share code, notes, and snippets.

View sophwats's full-sized avatar

Sophie Watson sophwats

  • UK
View GitHub Profile
@sophwats
sophwats / servicepodmonitor.yaml
Last active December 6, 2020 18:42
Create service pod monitor for service with label serving.knative.dev/service=pipeline
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
selfLink: >-
/apis/monitoring.coreos.com/v1/namespaces/opendatahub-user2/podmonitors/serverless
resourceVersion: '3064349'
name: serverless
uid: 46255b3c-494d-4ce4-84a2-e872e4c0ce5c
creationTimestamp: '2020-12-06T17:52:19Z'
generation: 1
@sophwats
sophwats / seldon-service-requests.py
Created November 24, 2020 15:28
interact with model service
DEFAULT_BASE_URL = "http://seldon-deployment-example-sklearn-iris-predictor-ml-mon.apps.cluster-d038.d038.example.opentlc.com%s"
import requests
from urllib.parse import urlencode
import json
def score_text(text, url = None):
url = (url or (DEFAULT_BASE_URL % "/api/v1.0/predictions"))
print(url)
payload = '{"data": {"ndarray":[[5.964,4.006,2.081,1.031]]}}'
print(payload)
headers = {'content-type': 'application/json'}
s2i build --loglevel=5 https://github.com/sophwats/multiclass-cookie-cutter -e S2I_MAKE_TARGETS=download,data cc-s2i:latest
I0727 15:19:23.732548 12186 build.go:51] Running S2I version "v1.3.0"
I0727 15:19:23.733227 12186 util.go:58] Getting docker credentials for cc-s2i:latest
I0727 15:19:23.738402 12186 docker.go:490] Using locally available image "cc-s2i:latest"
I0727 15:19:23.741102 12186 build.go:164]
Builder Name: Jupyter (S2i)
Builder Image: registry.access.redhat.com/ubi7/python-36
Source: https://github.com/sophwats/multiclass-cookie-cutter
Output Image Tag:
Environment: S2I_MAKE_TARGETS=download,data
#!/bin/sh
while getopts ":if:" opt; do
case $opt in
f)
useFile=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
# packages in environment at /anaconda2:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py36_0
absl-py 0.7.1 pypi_0 pypi
alabaster 0.7.12 py36_0
anaconda custom py36ha4fed55_0
anaconda-client 1.7.2 py36_0
anaconda-navigator 1.9.7 py36_0
anaconda-project 0.8.2 py36_0
# packages in environment at /anaconda2:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py36_0
absl-py 0.7.1 pypi_0 pypi
alabaster 0.7.12 py36_0
anaconda custom py36ha4fed55_0
anaconda-client 1.7.2 py36_0
anaconda-navigator 1.9.7 py36_0
anaconda-project 0.8.2 py36_0