Verifying the MLOps environment on GCP

Listing the installed packages


In [ ]:
!pip install -U -q pip

In [ ]:
!pip list | grep 'tfx\|kfp\|beam\|tensorflow'

Connecting to KFP and listing experiments


In [ ]:
%%bash

PREFIX=<YOUR-PREFIX>
ZONE=<YOUR-ZONE>
NAMESPACE=<YOUR-NAMESPACE>

gcloud container clusters get-credentials $PREFIX-cluster --zone $ZONE

echo "https://"$(kubectl describe configmap inverse-proxy-config -n $NAMESPACE | \
grep "googleusercontent.com")

Use the URL produced by the previous cell as the HOST_URL


In [ ]:
import kfp
 
HOST_URL = ''
NAMESPACE = 'kfp' # Change to your namespace
  
client = kfp.Client(host=HOST_URL, namespace=NAMESPACE)
[pipeline.name for pipeline in client.list_pipelines().pipelines]

Connectiong to Cloud SQL ML Metadata and list tables

This page describes how to connect a mysql client to your Cloud SQL instance using the Cloud SQL Proxy.


In [ ]:
!pip install -U -q mysql-connector

In [ ]:
import mysql.connector

metadb = mysql.connector.connect(
    host='127.0.0.1',
    port=3306,
    database='metadb',
    user="root",
    passwd="" # set root password 
)

cursor = metadb.cursor(buffered=True)

In [ ]:
cursor.execute("SHOW TABLES FROM metadb;")
cursor.fetchall()