Skip to content

Instantly share code, notes, and snippets.

@Geremie
Created December 16, 2020 12:06
Show Gist options
  • Save Geremie/706946557278a3de8fc6e616b1d7588e to your computer and use it in GitHub Desktop.
Save Geremie/706946557278a3de8fc6e616b1d7588e to your computer and use it in GitHub Desktop.
Automate your ML model retraining with Kubeflow
def trigger(project_id, bucket_name, train_steps, model_folder, host):
client = kfp.Client(namespace='default', host=host)
params = {
'project_id': project_id,
'bucket_name': bucket_name,
'train_steps': train_steps,
'model_folder': model_folder
}
experiments = client.list_experiments()
experiment_id = experiments.experiments[0].id
pipeline_id = client.get_pipeline_id(PIPELINE_NAME)
job_name = '{}-run-{}'.format(PIPELINE_NAME, str(round(datetime.utcnow().timestamp())))
try:
my_run = client.run_pipeline(experiment_id=experiment_id, job_name=job_name,
pipeline_id=pipeline_id, params=params)
except Exception as error:
print(error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment