Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
chore: add codeowners and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Aug 13, 2020
1 parent c5720e8 commit c398641
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -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
8 changes: 7 additions & 1 deletion samples/tables/automl_tables_predict.py
Expand Up @@ -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]
Expand All @@ -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

Expand All @@ -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`:
Expand All @@ -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]
Expand All @@ -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

Expand All @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions samples/tables/batch_predict_test.py
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c398641

Please sign in to comment.