Skip to content

Instantly share code, notes, and snippets.

@Geremie
Geremie / produce_small_data_using_python_function.py
Created February 28, 2021 17:33
Never struggle again to share data between your Kubeflow Pipelines components
def get_model_location(bucket_name: str, model_folder: str) -> NamedTuple('returns', [('location', 'GCSPath')]):
from google.cloud import storage
folder = 'model/{}/export/exporter/'.format(model_folder)
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blobs = bucket.list_blobs(prefix=folder)
blob_name = None
for blob in blobs:
tmp = len(blob.name.rstrip('/').split('/'))