GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: merge main into dev (#162) · googleapis/python-aiplatform@9e1087a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • CODEOWNERS
  • .sample_configs/param_handlers
    • create_batch_prediction_job_tabular_forecasting_sample.py
  • samples/snippets
    • create_batch_prediction_job_tabular_forecasting_sample.py
    • create_batch_prediction_job_tabular_forecasting_sample_test.py
  • testing
    • constraints-3.10.txt
    • constraints-3.11.txt
    • constraints-3.6.txt
    • constraints-3.7.txt
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/CODEOWNERS‎

Copy file name to clipboardExpand all lines: .github/CODEOWNERS
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
# yoshi-python is the default owner
88
* @googleapis/yoshi-python
99

10+
# The AI Platform GAPIC libraries are owned by Cloud AI DPE
11+
/google/cloud/aiplatform* @googleapis/cdpe-cloudai
12+
13+
# The AI Platform SDK is owned by Model Builder SDK Dev team
14+
/google/cloud/aiplatform/* @googleapis/cloud-aiplatform-model-builder-sdk
15+
1016
# The python-samples-owners team is the default owner for samples
1117
/samples/**/*.py @dizcology @googleapis/python-samples-owners
1218

1319
# The enhanced client library tests are owned by @telpirion
14-
/tests/unit/enhanced_library/*.py @telpirion
20+
/tests/unit/enhanced_library/*.py @telpirion
Collapse file

‎.sample_configs/param_handlers/create_batch_prediction_job_tabular_forecasting_sample.py‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
def make_parent(parent: str) -> str:
2+
parent = parent
3+
4+
return parent
5+
6+
7+
def make_batch_prediction_job(
8+
display_name: str,
9+
model_name: str,
10+
gcs_source_uri: str,
11+
gcs_destination_output_uri_prefix: str,
12+
predictions_format: str,
13+
) -> google.cloud.aiplatform_v1beta1.types.batch_prediction_job.BatchPredictionJob:
14+
batch_prediction_job = {
15+
"display_name": display_name,
16+
# Format: 'projects/{project}/locations/{location}/models/{model_id}'
17+
"model": model_name,
18+
"input_config": {
19+
"instances_format": predictions_format,
20+
"gcs_source": {"uris": [gcs_source_uri]},
21+
},
22+
"output_config": {
23+
"predictions_format": predictions_format,
24+
"gcs_destination": {"output_uri_prefix": gcs_destination_output_uri_prefix},
25+
},
26+
}
27+
return batch_prediction_job
28+
Collapse file

‎samples/snippets/create_batch_prediction_job_tabular_forecasting_sample.py‎

Copy file name to clipboard
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# [START aiplatform_create_batch_prediction_job_tabular_forecasting_sample]
16+
from google.cloud import aiplatform
17+
18+
19+
def create_batch_prediction_job_tabular_forecasting_sample(
20+
project: str,
21+
display_name: str,
22+
model_name: str,
23+
gcs_source_uri: str,
24+
gcs_destination_output_uri_prefix: str,
25+
predictions_format: str,
26+
location: str = "us-central1",
27+
api_endpoint: str = "us-central1-aiplatform.googleapis.com",
28+
):
29+
# The AI Platform services require regional API endpoints.
30+
client_options = {"api_endpoint": api_endpoint}
31+
# Initialize client that will be used to create and send requests.
32+
# This client only needs to be created once, and can be reused for multiple requests.
33+
client = aiplatform.gapic.JobServiceClient(client_options=client_options)
34+
batch_prediction_job = {
35+
"display_name": display_name,
36+
# Format: 'projects/{project}/locations/{location}/models/{model_id}'
37+
"model": model_name,
38+
"input_config": {
39+
"instances_format": predictions_format,
40+
"gcs_source": {"uris": [gcs_source_uri]},
41+
},
42+
"output_config": {
43+
"predictions_format": predictions_format,
44+
"gcs_destination": {"output_uri_prefix": gcs_destination_output_uri_prefix},
45+
},
46+
}
47+
parent = f"projects/{project}/locations/{location}"
48+
response = client.create_batch_prediction_job(
49+
parent=parent, batch_prediction_job=batch_prediction_job
50+
)
51+
print("response:", response)
52+
53+
54+
# [END aiplatform_create_batch_prediction_job_tabular_forecasting_sample]
Collapse file

‎samples/snippets/create_batch_prediction_job_tabular_forecasting_sample_test.py‎

Copy file name to clipboard
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
from uuid import uuid4
17+
18+
import pytest
19+
20+
import create_batch_prediction_job_tabular_forecasting_sample
21+
import helpers
22+
23+
PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT")
24+
LOCATION = "us-central1"
25+
MODEL_ID = "8531330622239539200" # Permanent restaurant rating model
26+
DISPLAY_NAME = f"temp_create_batch_prediction_tabular_forecasting_test_{uuid4()}"
27+
GCS_SOURCE_URI = "gs://cloud-samples-data/ai-platform/covid/bigquery-public-covid-nyt-us-counties-train.csv"
28+
GCS_OUTPUT_URI = "gs://ucaip-samples-test-output/"
29+
PREDICTIONS_FORMAT = "csv"
30+
31+
32+
@pytest.fixture(scope="function", autouse=True)
33+
def teardown(teardown_batch_prediction_job):
34+
yield
35+
36+
37+
# Creating AutoML Tabular Forecasting Classification batch prediction job
38+
def test_create_batch_prediction_job_tabular_forecasting_sample(capsys, shared_state):
39+
40+
model_name = f"projects/{PROJECT_ID}/locations/{LOCATION}/models/{MODEL_ID}"
41+
42+
create_batch_prediction_job_tabular_forecasting_sample.create_batch_prediction_job_tabular_forecasting_sample(
43+
project=PROJECT_ID,
44+
display_name=DISPLAY_NAME,
45+
model_name=model_name,
46+
gcs_source_uri=GCS_SOURCE_URI,
47+
gcs_destination_output_uri_prefix=GCS_OUTPUT_URI,
48+
predictions_format=PREDICTIONS_FORMAT,
49+
)
50+
51+
out, _ = capsys.readouterr()
52+
53+
# Save resource name of the newly created batch prediction job
54+
shared_state["batch_prediction_job_name"] = helpers.get_name(out)
Collapse file

‎testing/constraints-3.10.txt‎

Copy file name to clipboardExpand all lines: testing/constraints-3.10.txt
Whitespace-only changes.
Collapse file

‎testing/constraints-3.11.txt‎

Copy file name to clipboardExpand all lines: testing/constraints-3.11.txt
Whitespace-only changes.
Collapse file

‎testing/constraints-3.6.txt‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This constraints file is used to check that lower bounds
2+
# are correct in setup.py
3+
# List *all* library dependencies and extras in this file.
4+
# Pin the version to the lower bound.
5+
#
6+
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
7+
# Then this file should have foo==1.14.0
8+
google-api-core==1.22.2
9+
libcst==0.2.5
10+
proto-plus==1.10.1
11+
mock==4.0.2
12+
google-cloud-storage==1.26.0
Collapse file

‎testing/constraints-3.7.txt‎

Copy file name to clipboardExpand all lines: testing/constraints-3.7.txt
Whitespace-only changes.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.