Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(components/google-cloud): Update args and location of ForecastingPreprocessingOp and ForecastingValidationOp #6403

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,5 @@
# limitations under the License.
"""Google Cloud Pipeline Experimental Components."""

import os
from .custom_job.custom_job import run_as_vertex_ai_custom_job
from kfp.components import load_component_from_file
from .tensorflow_probability.anomaly_detection import tfp_anomaly_detection

__all__ = [
'ForecastingPreprocessingOp',
'ForecastingValidationOp',
]


def ForecastingPreprocessingOp(**kwargs):
"""Preprocesses BigQuery tables for training or prediction.

Creates a BigQuery table for training or prediction based on the input tables.
For training, a primary table is required. Optionally, you can include some
attribute tables. For prediction, you need to include all the tables that were
used in the training, plus a plan table.

Accepted kwargs:
input_tables (str): Serialized Json array that specifies input BigQuery
tables and specs.
preprocess_metadata (str): Path to a file used by the component to save
the output BigQuery table uri and column metadata. Do not set value to
this arg. The value will be automatically overriden by Managed Pipeline.

Args:
**kwargs: See Accepted kwargs.

Returns:
None
"""
# TODO(yzhaozh): update the documentation with Json object reference and
# example.
return load_component_from_file(
os.path.join(
os.path.dirname(__file__),
'forecasting/preprocess/component.yaml'))(**kwargs)


def ForecastingValidationOp(**kwargs):
"""Validates BigQuery tables for training or prediction.

Validates BigQuery tables for training or prediction based on predefined
requirements. For training, a primary table is required. Optionally, you
can include some attribute tables. For prediction, you need to include all
the tables that were used in the training, plus a plan table.

Accepted kwargs:
input_tables (str): Serialized Json array that specifies input BigQuery
tables and specs.

Args:
**kwargs: See Accepted kwargs.

Returns:
None
"""
# TODO(yzhaozh): update the documentation with Json object reference, example
# and predefined validation requirements.
return load_component_from_file(
os.path.join(
os.path.dirname(__file__),
'forecasting/validate/component.yaml'))(**kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2021 The Kubeflow Authors. All Rights Reserved.
#
# 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.
"""Google Cloud Pipeline Experimental Forecasting Components."""

import os
from kfp.components import load_component_from_file

__all__ = [
'ForecastingPreprocessingOp',
'ForecastingValidationOp',
]


def ForecastingPreprocessingOp(input_tables: str):
"""Preprocesses BigQuery tables for training or prediction.

Creates a BigQuery table for training or prediction based on the input tables.
For training, a primary table is required. Optionally, you can include some
attribute tables. For prediction, you need to include all the tables that were
used in the training, plus a plan table.

Args:
input_tables (str): Serialized Json array that specifies input BigQuery
tables and specs.

Returns:
None
"""
# TODO(yzhaozh): update the documentation with Json object reference and
# example.
return load_component_from_file(
os.path.join(
os.path.dirname(__file__), 'preprocess/component.yaml'))(
input_tables=input_tables)


def ForecastingValidationOp(input_tables: str, validation_theme: str):
"""Validates BigQuery tables for training or prediction.

Validates BigQuery tables for training or prediction based on predefined
requirements. For training, a primary table is required. Optionally, you
can include some attribute tables. For prediction, you need to include all
the tables that were used in the training, plus a plan table.

Args:
input_tables (str): Serialized Json array that specifies input BigQuery
tables and specs.
validation_theme (str): Theme to use for validating the BigQuery tables.
Acceptable values are FORECASTING_TRAINING and FORECASTING_PREDICTION.

Returns:
None
"""
# TODO(yzhaozh): update the documentation with Json object reference, example
# and predefined validation requirements.
return load_component_from_file(
os.path.join(
os.path.dirname(__file__), 'validate/component.yaml'))(
input_tables=input_tables, validation_theme=validation_theme)