def main()

in retail/recommendation-system/bqml-mlops/part_2/pipeline.py [0:0]


def main(**args):
    #Specify pipeline argument values
    arguments = {
        'project_id': args['project_id'],
        'dataset_name': args['dataset_name'],
        'model_storage': args['model_storage']
    }
    
    pipeline_func = training_pipeline
    pipeline_filename = pipeline_func.__name__ + '.zip'
    import kfp.compiler as compiler
    import kfp
    compiler.Compiler().compile(pipeline_func, pipeline_filename)


    #Get or create an experiment and submit a pipeline run
    client = kfp.Client(args['kfp_host'])
    experiment = client.create_experiment('hotel_recommender_experiment')

    #Submit a pipeline run
    run_name = pipeline_func.__name__ + ' run'
    run_result = client.run_pipeline(experiment.id, run_name, pipeline_filename, arguments)