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

feat: enabling AutoML Forecasting training response to include BigQuery location of exported evaluated examples #657

Merged
22 commits merged into from Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
66b565d
Added BigQuery location of exported evaluated examples from AutoML Fo…
Aug 16, 2021
b899511
Testing BQ uri output feature for AutoML Forecasting
Aug 16, 2021
c225ac7
Testing BQ uri output feature for AutoML Forecasting
Aug 16, 2021
29e32bf
Testing BQ uri output feature for AutoML Forecasting
Aug 16, 2021
4dfb8b9
Testing BQ uri output feature for AutoML Forecasting
Aug 17, 2021
bf869b6
Testing BQ uri output feature for AutoML Forecasting
Aug 17, 2021
fca235b
Testing BQ uri output feature for AutoML Forecasting
Aug 17, 2021
e519e64
Testing BQ uri output feature for AutoML Forecasting
Aug 18, 2021
73bd6b1
Merge branch 'googleapis:master' into master
mansiachuthan Aug 25, 2021
ef03a20
Adding changes from dev to master branch
mansiachuthan Aug 25, 2021
c236824
Merge branch 'master' into master
vinnysenthil Aug 25, 2021
9af9db9
Merge branch 'main' into master
vinnysenthil Aug 30, 2021
31d0622
Removed extra try/except block
mansiachuthan Aug 30, 2021
a8c10bb
Fix lint errors
hardik-vala Aug 31, 2021
dd30216
Address comments
hardik-vala Sep 23, 2021
1e11c5c
Merge branch 'main' into master
sasha-gitg Oct 4, 2021
b1c3e79
Add metadata existence check
hardik-vala Oct 4, 2021
5583190
Merge branch 'master' of https://github.com/mansiachuthan/python-aipl…
hardik-vala Oct 4, 2021
66d3b62
Merge branch 'main' into master
Oct 12, 2021
3d78777
Merge branch 'main' into master
Oct 12, 2021
fed80c6
Merge branch 'main' into master
Oct 12, 2021
cbf044d
Merge branch 'main' into master
vinnysenthil Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 26 additions & 1 deletion google/cloud/aiplatform/training_jobs.py
Expand Up @@ -4315,7 +4315,7 @@ def _run(
labels=model_labels or self._labels,
)

return self._run_job(
new_model = self._run_job(
training_task_definition=training_task_definition,
training_task_inputs=training_task_inputs_dict,
dataset=dataset,
Expand All @@ -4326,6 +4326,14 @@ def _run(
model=model,
)

if export_evaluated_data_items:
_LOGGER.info(
"Exported examples available at:\n%s"
% self.evaluated_data_items_bigquery_uri
)

return new_model

@property
def _model_upload_fail_string(self) -> str:
"""Helper property for model upload failure."""
Expand All @@ -4334,6 +4342,23 @@ def _model_upload_fail_string(self) -> str:
"Model."
)

@property
def evaluated_data_items_bigquery_uri(self) -> Optional[str]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the scenarios where this method:

  1. returns str
  2. returns None
  3. raises ValueError

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the method doc string.

"""BigQuery location of exported evaluated examples from the Training Job
Returns:
str: BigQuery uri for the exported evaluated examples if the export
feature is enabled for training.
None: If the export feature was not enabled for training.
"""

self._assert_gca_resource_is_available()

metadata = self._gca_resource.training_task_metadata
if "evaluatedDataItemsBigqueryUri" in metadata:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safer to do this: if metadata and "evaluatedDataItemsBigqueryUri" in metadata:

See this issue b/192601601. training_task_metadata may not be populated by the service.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return metadata["evaluatedDataItemsBigqueryUri"]
sasha-gitg marked this conversation as resolved.
Show resolved Hide resolved

return None

def _add_additional_experiments(self, additional_experiments: List[str]):
"""Add experiment flags to the training job.
Args:
Expand Down
Expand Up @@ -138,6 +138,9 @@ def mock_pipeline_service_get():
name=_TEST_PIPELINE_RESOURCE_NAME,
state=gca_pipeline_state.PipelineState.PIPELINE_STATE_SUCCEEDED,
model_to_upload=gca_model.Model(name=_TEST_MODEL_NAME),
training_task_metadata={
"evaluatedDataItemsBigqueryUri": _TEST_TRAINING_EXPORT_EVALUATED_DATA_ITEMS_BIGQUERY_DESTINATION_URI
},
)
yield mock_get_training_pipeline

Expand Down