From c39864108daef27b64614c5e7e4504f883f7b6b1 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 13 Aug 2020 05:57:29 +0000 Subject: [PATCH] chore: add codeowners and fix tests --- .github/CODEOWNERS | 8 ++++++++ samples/tables/automl_tables_predict.py | 8 +++++++- samples/tables/batch_predict_test.py | 6 ++++-- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..a5567cb9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,8 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. +# +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + + +/samples/**/*.py @telpirion @sirtorry @googleapis/python-samples-owners diff --git a/samples/tables/automl_tables_predict.py b/samples/tables/automl_tables_predict.py index e9654272..9787e1b9 100644 --- a/samples/tables/automl_tables_predict.py +++ b/samples/tables/automl_tables_predict.py @@ -87,6 +87,7 @@ def batch_predict_bq( model_display_name, bq_input_uri, bq_output_uri, + params ): """Make a batch of predictions.""" # [START automl_tables_batch_predict_bq] @@ -96,6 +97,7 @@ def batch_predict_bq( # model_display_name = 'MODEL_DISPLAY_NAME_HERE' # bq_input_uri = 'bq://my-project.my-dataset.my-table' # bq_output_uri = 'bq://my-project' + # params = {} from google.cloud import automl_v1beta1 as automl @@ -104,7 +106,8 @@ def batch_predict_bq( # Query model response = client.batch_predict(bigquery_input_uri=bq_input_uri, bigquery_output_uri=bq_output_uri, - model_display_name=model_display_name) + model_display_name=model_display_name, + params=params) print("Making batch prediction... ") # `response` is a async operation descriptor, # you can register a callback for the operation to complete via `add_done_callback`: @@ -130,6 +133,7 @@ def batch_predict( model_display_name, gcs_input_uri, gcs_output_uri, + params, ): """Make a batch of predictions.""" # [START automl_tables_batch_predict] @@ -139,6 +143,7 @@ def batch_predict( # model_display_name = 'MODEL_DISPLAY_NAME_HERE' # gcs_input_uri = 'gs://YOUR_BUCKET_ID/path_to_your_input_csv' # gcs_output_uri = 'gs://YOUR_BUCKET_ID/path_to_save_results/' + # params = {} from google.cloud import automl_v1beta1 as automl @@ -149,6 +154,7 @@ def batch_predict( gcs_input_uris=gcs_input_uri, gcs_output_uri_prefix=gcs_output_uri, model_display_name=model_display_name, + params=params ) print("Making batch prediction... ") # `response` is a async operation descriptor, diff --git a/samples/tables/batch_predict_test.py b/samples/tables/batch_predict_test.py index f77404de..203f4c8d 100644 --- a/samples/tables/batch_predict_test.py +++ b/samples/tables/batch_predict_test.py @@ -32,13 +32,15 @@ GCS_OUTPUT = "gs://{}-automl-tables-test/TABLE_TEST_OUTPUT/".format(PROJECT) BQ_INPUT = "bq://{}.automl_test.bank_marketing".format(PROJECT) BQ_OUTPUT = "bq://{}".format(PROJECT) +PARAMS = {} @pytest.mark.slow def test_batch_predict(capsys): ensure_model_online() + automl_tables_predict.batch_predict( - PROJECT, REGION, STATIC_MODEL, GCS_INPUT, GCS_OUTPUT + PROJECT, REGION, STATIC_MODEL, GCS_INPUT, GCS_OUTPUT, PARAMS ) out, _ = capsys.readouterr() assert "Batch prediction complete" in out @@ -48,7 +50,7 @@ def test_batch_predict(capsys): def test_batch_predict_bq(capsys): ensure_model_online() automl_tables_predict.batch_predict_bq( - PROJECT, REGION, STATIC_MODEL, BQ_INPUT, BQ_OUTPUT + PROJECT, REGION, STATIC_MODEL, BQ_INPUT, BQ_OUTPUT, PARAMS ) out, _ = capsys.readouterr() assert "Batch prediction complete" in out