Skip to content

Instantly share code, notes, and snippets.

@amygdala
Created June 1, 2020 18:12
Show Gist options
  • Save amygdala/0a36e1abe22b77a9ad4b18e25252a550 to your computer and use it in GitHub Desktop.
Save amygdala/0a36e1abe22b77a9ad4b18e25252a550 to your computer and use it in GitHub Desktop.
Connecting to AI Platform Pipelines when 'gcloud' is not installed
from google.oauth2 import service_account
from google.auth.transport import requests
import kfp
# change this to point to your service account credentials file
credentials = service_account.Credentials.from_service_account_file(“/path/to/credentials/service_acct_creds.json", scopes=["https://www.googleapis.com/auth/cloud-platform"])
credentials.refresh(requests.Request())
token = credentials.token
# change this to point to the endpoint of your AI Platform Pipelines installation
client=kfp.Client(host=‘<your_pipelines_endpoint>.pipelines.googleusercontent.com', existing_token=token)
client.list_pipelines()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment