From 2dac90b16ffa7d7b8b334c6c5d0bef85aac33853 Mon Sep 17 00:00:00 2001 From: Mike Ganbold Date: Mon, 18 May 2020 14:02:53 -0700 Subject: [PATCH 1/6] added rtest req.txt --- jobs/v4beta1/requirements-test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 jobs/v4beta1/requirements-test.txt diff --git a/jobs/v4beta1/requirements-test.txt b/jobs/v4beta1/requirements-test.txt new file mode 100644 index 00000000000..7e2ff41603d --- /dev/null +++ b/jobs/v4beta1/requirements-test.txt @@ -0,0 +1 @@ +pytest==5.3.2 \ No newline at end of file From e88b49c2ad28125f95e6a0b4d2efe8c94c496787 Mon Sep 17 00:00:00 2001 From: Mike Ganbold Date: Mon, 18 May 2020 14:02:53 -0700 Subject: [PATCH 2/6] added rtest req.txt --- jobs/v4beta1/requirements-test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 jobs/v4beta1/requirements-test.txt diff --git a/jobs/v4beta1/requirements-test.txt b/jobs/v4beta1/requirements-test.txt new file mode 100644 index 00000000000..7e2ff41603d --- /dev/null +++ b/jobs/v4beta1/requirements-test.txt @@ -0,0 +1 @@ +pytest==5.3.2 \ No newline at end of file From 3d3aa8fdd470fd7aef61b1cbbf2c2810868be133 Mon Sep 17 00:00:00 2001 From: Mike Ganbold Date: Mon, 18 May 2020 14:02:53 -0700 Subject: [PATCH 3/6] added rtest req.txt --- jobs/v4beta1/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jobs/v4beta1/requirements-test.txt b/jobs/v4beta1/requirements-test.txt index 10b405fa748..bbef4fe11b9 100644 --- a/jobs/v4beta1/requirements-test.txt +++ b/jobs/v4beta1/requirements-test.txt @@ -1 +1 @@ -pytest==5.4.2 \ No newline at end of file +pytest==5.4.2 From d036a2b73cb704ff5e12bb84d7ab399a166bd4a6 Mon Sep 17 00:00:00 2001 From: Mike Ganbold Date: Wed, 8 Jul 2020 17:10:57 -0700 Subject: [PATCH 4/6] samples: added automl batch predict test --- tables/automl/batch_predict_test.py | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tables/automl/batch_predict_test.py diff --git a/tables/automl/batch_predict_test.py b/tables/automl/batch_predict_test.py new file mode 100644 index 00000000000..f6fd9ecdfba --- /dev/null +++ b/tables/automl/batch_predict_test.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +from google.cloud.automl_v1beta1.gapic import enums + +import automl_tables_model +import automl_tables_predict +import model_test + + +PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] +REGION = "us-central1" +STATIC_MODEL = model_test.STATIC_MODEL +GCS_INPUT = "gs://{}-automl-tables-test/bank-marketing.csv".format(PROJECT) +GCS_OUTPUT = "gs://{}-automl-tables-test/TABLE_TEST_OUTPUT/".format(PROJECT) + + +@pytest.mark.slow +def test_batch_predict(capsys): + ensure_model_online() + automl_tables_predict.batch_predict( + PROJECT, REGION, STATIC_MODEL, GCS_INPUT, GCS_OUTPUT + ) + out, _ = capsys.readouterr() + assert "Batch prediction complete" in out + + +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) From 1dff8a2ed86a07d9b0535a0b7b2b7590fea5fed3 Mon Sep 17 00:00:00 2001 From: Mike Ganbold Date: Wed, 8 Jul 2020 17:19:10 -0700 Subject: [PATCH 5/6] added missing package --- tables/automl/batch_predict_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tables/automl/batch_predict_test.py b/tables/automl/batch_predict_test.py index f6fd9ecdfba..c234ae90c8f 100644 --- a/tables/automl/batch_predict_test.py +++ b/tables/automl/batch_predict_test.py @@ -18,6 +18,8 @@ from google.cloud.automl_v1beta1.gapic import enums +import pytest + import automl_tables_model import automl_tables_predict import model_test From 2747cb799764444ab0b7b2ffc094a116cdbaf77c Mon Sep 17 00:00:00 2001 From: Mike <45373284+munkhuushmgl@users.noreply.github.com> Date: Thu, 9 Jul 2020 09:52:47 -0700 Subject: [PATCH 6/6] Update tables/automl/batch_predict_test.py Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- tables/automl/batch_predict_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tables/automl/batch_predict_test.py b/tables/automl/batch_predict_test.py index c234ae90c8f..37b5f0e09c3 100644 --- a/tables/automl/batch_predict_test.py +++ b/tables/automl/batch_predict_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.