def ensure_model_ready(): name = STATIC_MODEL try: return automl_tables_model.get_model(PROJECT, REGION, name) except exceptions.NotFound: pass dataset = dataset_test.ensure_dataset_ready() return automl_tables_model.create_model(PROJECT, REGION, dataset.display_name, name, 1000)
def ensure_model_online(): model = model_test.ensure_model_ready() if model.deployment_state != enums.Model.DeploymentState.DEPLOYED: automl_tables_model.deploy_model(PROJECT, REGION, model.display_name) return automl_tables_model.get_model(PROJECT, REGION, model.display_name)