Content-Length: 1501483 | pFad | https://www.github.com/googleapis/python-aiplatform/commit/e5c1b1a4909d701efeb27f29af43a95516c51475

61E feat: add Vizier service (#266) · googleapis/python-aiplatform@e5c1b1a · GitHub
Skip to content

Commit e5c1b1a

Browse files
feat: add Vizier service (#266)
* feat: add Vizier service * chore: blacken Co-authored-by: Bu Sun Kim <busunkim@google.com>
1 parent 47b7f38 commit e5c1b1a

File tree

141 files changed

+13458
-884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+13458
-884
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ docs.metadata
5050

5151
# Virtual environment
5252
env/
53+
54+
# Test logs
5355
coverage.xml
54-
sponge_log.xml
56+
*sponge_log.xml
5557

5658
# System test environment variables.
5759
system_tests/local_test_setup

.kokoro/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ python3 -m pip uninstall --yes --quiet nox-automation
4040
python3 -m pip install --upgrade --quiet nox
4141
python3 -m nox --version
4242

43+
# If this is a continuous build, send the test log to the FlakyBot.
44+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
45+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
46+
cleanup() {
47+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
48+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
49+
}
50+
trap cleanup EXIT HUP
51+
fi
52+
4353
# If NOX_SESSION is set, it only runs the specified session,
4454
# otherwise run all the sessions.
4555
if [[ -n "${NOX_SESSION:-}" ]]; then

.kokoro/test-samples-against-head.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# A customized test runner for samples.
17+
#
18+
# For periodic builds, you can specify this file for testing against head.
19+
20+
# `-e` enables the script to automatically fail when a command fails
21+
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
22+
set -eo pipefail
23+
# Enables `**` to include files nested inside sub-folders
24+
shopt -s globstar
25+
26+
cd github/python-aiplatform
27+
28+
exec .kokoro/test-samples-impl.sh

.kokoro/test-samples-impl.sh

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
# Copyright 2021 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
# `-e` enables the script to automatically fail when a command fails
18+
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
19+
set -eo pipefail
20+
# Enables `**` to include files nested inside sub-folders
21+
shopt -s globstar
22+
23+
# Exit early if samples directory doesn't exist
24+
if [ ! -d "./samples" ]; then
25+
echo "No tests run. `./samples` not found"
26+
exit 0
27+
fi
28+
29+
# Disable buffering, so that the logs stream through.
30+
export PYTHONUNBUFFERED=1
31+
32+
# Debug: show build environment
33+
env | grep KOKORO
34+
35+
# Install nox
36+
python3.6 -m pip install --upgrade --quiet nox
37+
38+
# Use secrets acessor service account to get secrets
39+
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
40+
gcloud auth activate-service-account \
41+
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
42+
--project="cloud-devrel-kokoro-resources"
43+
fi
44+
45+
# This script will create 3 files:
46+
# - testing/test-env.sh
47+
# - testing/service-account.json
48+
# - testing/client-secrets.json
49+
./scripts/decrypt-secrets.sh
50+
51+
source ./testing/test-env.sh
52+
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
53+
54+
# For cloud-run session, we activate the service account for gcloud sdk.
55+
gcloud auth activate-service-account \
56+
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
57+
58+
export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
59+
60+
echo -e "\n******************** TESTING PROJECTS ********************"
61+
62+
# Switch to 'fail at end' to allow all tests to complete before exiting.
63+
set +e
64+
# Use RTN to return a non-zero value if the test fails.
65+
RTN=0
66+
ROOT=$(pwd)
67+
# Find all requirements.txt in the samples directory (may break on whitespace).
68+
for file in samples/**/requirements.txt; do
69+
cd "$ROOT"
70+
# Navigate to the project folder.
71+
file=$(dirname "$file")
72+
cd "$file"
73+
74+
echo "------------------------------------------------------------"
75+
echo "- testing $file"
76+
echo "------------------------------------------------------------"
77+
78+
# Use nox to execute the tests for the project.
79+
python3.6 -m nox -s "$RUN_TESTS_SESSION"
80+
EXIT=$?
81+
82+
# If this is a periodic build, send the test log to the FlakyBot.
83+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
84+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
85+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
86+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
87+
fi
88+
89+
if [[ $EXIT -ne 0 ]]; then
90+
RTN=1
91+
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
92+
else
93+
echo -e "\n Testing completed.\n"
94+
fi
95+
96+
done
97+
cd "$ROOT"
98+
99+
# Workaround for Kokoro permissions issue: delete secrets
100+
rm testing/{test-env.sh,client-secrets.json,service-account.json}
101+
102+
exit "$RTN"

.kokoro/test-samples.sh

Lines changed: 16 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# The default test runner for samples.
17+
#
18+
# For periodic builds, we rewinds the repo to the latest release, and
19+
# run test-samples-impl.sh.
1620

1721
# `-e` enables the script to automatically fail when a command fails
1822
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
@@ -24,87 +28,19 @@ cd github/python-aiplatform
2428

2529
# Run periodic samples tests at latest release
2630
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
31+
# preserving the test runner implementation.
32+
cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh"
33+
echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
34+
echo "Now we rewind the repo back to the latest release..."
2735
LATEST_RELEASE=$(git describe --abbrev=0 --tags)
2836
git checkout $LATEST_RELEASE
29-
fi
30-
31-
# Exit early if samples directory doesn't exist
32-
if [ ! -d "./samples" ]; then
33-
echo "No tests run. `./samples` not found"
34-
exit 0
35-
fi
36-
37-
# Disable buffering, so that the logs stream through.
38-
export PYTHONUNBUFFERED=1
39-
40-
# Debug: show build environment
41-
env | grep KOKORO
42-
43-
# Install nox
44-
python3.6 -m pip install --upgrade --quiet nox
45-
46-
# Use secrets acessor service account to get secrets
47-
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
48-
gcloud auth activate-service-account \
49-
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
50-
--project="cloud-devrel-kokoro-resources"
51-
fi
52-
53-
# This script will create 3 files:
54-
# - testing/test-env.sh
55-
# - testing/service-account.json
56-
# - testing/client-secrets.json
57-
./scripts/decrypt-secrets.sh
58-
59-
source ./testing/test-env.sh
60-
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
61-
62-
# For cloud-run session, we activate the service account for gcloud sdk.
63-
gcloud auth activate-service-account \
64-
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
65-
66-
export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
67-
68-
echo -e "\n******************** TESTING PROJECTS ********************"
69-
70-
# Switch to 'fail at end' to allow all tests to complete before exiting.
71-
set +e
72-
# Use RTN to return a non-zero value if the test fails.
73-
RTN=0
74-
ROOT=$(pwd)
75-
# Find all requirements.txt in the samples directory (may break on whitespace).
76-
for file in samples/**/requirements.txt; do
77-
cd "$ROOT"
78-
# Navigate to the project folder.
79-
file=$(dirname "$file")
80-
cd "$file"
81-
82-
echo "------------------------------------------------------------"
83-
echo "- testing $file"
84-
echo "------------------------------------------------------------"
85-
86-
# Use nox to execute the tests for the project.
87-
python3.6 -m nox -s "$RUN_TESTS_SESSION"
88-
EXIT=$?
89-
90-
# If this is a periodic build, send the test log to the FlakyBot.
91-
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
92-
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
93-
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
94-
$KOKORO_GFILE_DIR/linux_amd64/flakybot
37+
echo "The current head is: "
38+
echo $(git rev-parse --verify HEAD)
39+
echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
40+
# move back the test runner implementation if there's no file.
41+
if [ ! -f .kokoro/test-samples-impl.sh ]; then
42+
cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh
9543
fi
44+
fi
9645

97-
if [[ $EXIT -ne 0 ]]; then
98-
RTN=1
99-
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
100-
else
101-
echo -e "\n Testing completed.\n"
102-
fi
103-
104-
done
105-
cd "$ROOT"
106-
107-
# Workaround for Kokoro permissions issue: delete secrets
108-
rm testing/{test-env.sh,client-secrets.json,service-account.json}
109-
110-
exit "$RTN"
46+
exec .kokoro/test-samples-impl.sh

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ repos:
1212
hooks:
1313
- id: black
1414
- repo: https://gitlab.com/pycqa/flake8
15-
rev: 3.9.0
15+
rev: 3.8.4
1616
hooks:
1717
- id: flake8

CONTRIBUTING.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7070
- To test your changes, run unit tests with ``nox``::
7171

7272
$ nox -s unit-2.7
73-
$ nox -s unit-3.7
73+
$ nox -s unit-3.8
7474
$ ...
7575

76+
- Args to pytest can be passed through the nox command separated by a `--`. For
77+
example, to run a single test::
78+
79+
$ nox -s unit-3.8 -- -k <name of test>
80+
7681
.. note::
7782

7883
The unit tests and system tests are described in the
@@ -93,8 +98,12 @@ On Debian/Ubuntu::
9398
************
9499
Coding Style
95100
************
101+
- We use the automatic code formatter ``black``. You can run it using
102+
the nox session ``blacken``. This will eliminate many lint errors. Run via::
103+
104+
$ nox -s blacken
96105

97-
- PEP8 compliance, with exceptions defined in the linter configuration.
106+
- PEP8 compliance is required, with exceptions defined in the linter configuration.
98107
If you have ``nox`` installed, you can test that you have not introduced
99108
any non-compliant code via::
100109

@@ -133,13 +142,18 @@ Running System Tests
133142

134143
- To run system tests, you can execute::
135144

136-
$ nox -s system-3.7
145+
# Run all system tests
146+
$ nox -s system-3.8
137147
$ nox -s system-2.7
138148

149+
# Run a single system test
150+
$ nox -s system-3.8 -- -k <name of test>
151+
152+
139153
.. note::
140154

141155
System tests are only configured to run under Python 2.7 and
142-
Python 3.7. For expediency, we do not run them in older versions
156+
Python 3.8. For expediency, we do not run them in older versions
143157
of Python 3.
144158

145159
This alone will not run the tests. You'll need to change some local

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
# Generated by synthtool. DO NOT EDIT!
1818
include README.rst LICENSE
19-
recursive-include google *.json *.proto
19+
recursive-include google *.json *.proto py.typed
2020
recursive-include tests *
2121
global-exclude *.py[co]
2222
global-exclude __pycache__
2323

2424
# Exclude scripts for samples readmegen
25-
prune scripts/readme-gen
25+
prune scripts/readme-gen

docs/aiplatform_v1beta1/services.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Services for Google Cloud Aiplatform v1beta1 API
1111
pipeline_service
1212
prediction_service
1313
specialist_pool_service
14+
vizier_service
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
VizierService
2+
-------------------------------
3+
4+
.. automodule:: google.cloud.aiplatform_v1beta1.services.vizier_service
5+
:members:
6+
:inherited-members:
7+
8+
9+
.. automodule:: google.cloud.aiplatform_v1beta1.services.vizier_service.pagers
10+
:members:
11+
:inherited-members:

google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
AutoMlImageSegmentationInputs,
3131
AutoMlImageSegmentationMetadata,
3232
)
33-
from .export_evaluated_data_items_config import ExportEvaluatedDataItemsConfig
3433
from .automl_tables import (
3534
AutoMlTables,
3635
AutoMlTablesInputs,
@@ -60,6 +59,7 @@
6059
AutoMlVideoObjectTracking,
6160
AutoMlVideoObjectTrackingInputs,
6261
)
62+
from .export_evaluated_data_items_config import ExportEvaluatedDataItemsConfig
6363

6464
__all__ = (
6565
"AutoMlImageClassification",
@@ -71,7 +71,6 @@
7171
"AutoMlImageSegmentation",
7272
"AutoMlImageSegmentationInputs",
7373
"AutoMlImageSegmentationMetadata",
74-
"ExportEvaluatedDataItemsConfig",
7574
"AutoMlTables",
7675
"AutoMlTablesInputs",
7776
"AutoMlTablesMetadata",
@@ -87,4 +86,5 @@
8786
"AutoMlVideoClassificationInputs",
8887
"AutoMlVideoObjectTracking",
8988
"AutoMlVideoObjectTrackingInputs",
89+
"ExportEvaluatedDataItemsConfig",
9090
)

google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17+
1718
from google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1.types.image_classification import (
1819
ImageClassificationPredictionInstance,
1920
)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://www.github.com/googleapis/python-aiplatform/commit/e5c1b1a4909d701efeb27f29af43a95516c51475

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy