-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,215 additions
and
132 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...gle-cloud/docs/source/google_cloud_pipeline_components.v1.batch_predict_job.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.batch_predict_job module | ||
=============================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.batch_predict_job | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...nents/google-cloud/docs/source/google_cloud_pipeline_components.v1.bigquery.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.bigquery module | ||
====================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.bigquery | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...nts/google-cloud/docs/source/google_cloud_pipeline_components.v1.custom_job.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.custom\_job module | ||
========================================================= | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.custom_job | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...nents/google-cloud/docs/source/google_cloud_pipeline_components.v1.dataflow.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.dataflow module | ||
====================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.dataflow | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...onents/google-cloud/docs/source/google_cloud_pipeline_components.v1.dataset.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.dataset module | ||
===================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.dataset | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...nents/google-cloud/docs/source/google_cloud_pipeline_components.v1.endpoint.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.endpoint module | ||
====================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.endpoint | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
...d/docs/source/google_cloud_pipeline_components.v1.hyperparameter_tuning_job.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.hyperparameter_tuning_job package | ||
========================================================================= | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.hyperparameter_tuning_job | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
7 changes: 7 additions & 0 deletions
7
components/google-cloud/docs/source/google_cloud_pipeline_components.v1.model.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.model module | ||
=================================================== | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.model | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
18 changes: 18 additions & 0 deletions
18
components/google-cloud/docs/source/google_cloud_pipeline_components.v1.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
google\_cloud\_pipeline\_components.v1 components | ||
================================================= | ||
|
||
Components | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
google_cloud_pipeline_components.v1.batch_predict_job | ||
google_cloud_pipeline_components.v1.bigquery | ||
google_cloud_pipeline_components.v1.custom_job | ||
google_cloud_pipeline_components.v1.dataflow | ||
google_cloud_pipeline_components.v1.dataset | ||
google_cloud_pipeline_components.v1.endpoint | ||
google_cloud_pipeline_components.v1.hyperparameter_tuning_job | ||
google_cloud_pipeline_components.v1.model | ||
google_cloud_pipeline_components.v1.wait_gcp_resources |
7 changes: 7 additions & 0 deletions
7
...le-cloud/docs/source/google_cloud_pipeline_components.v1.wait_gcp_resources.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
google\_cloud\_pipeline\_components.v1.wait_gcp_resources package | ||
================================================================= | ||
|
||
.. automodule:: google_cloud_pipeline_components.v1.wait_gcp_resources | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
components/google-cloud/google_cloud_pipeline_components/container/utils/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2022 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 Components Container Utils.""" |
52 changes: 52 additions & 0 deletions
52
...onents/google-cloud/google_cloud_pipeline_components/container/utils/execution_context.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2022 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. | ||
"""Execution context for launcher clients to support cancellation propagation.""" | ||
import logging | ||
import os | ||
import signal | ||
|
||
|
||
class ExecutionContext: | ||
"""Execution context for running inside Google Cloud Pipeline Components. | ||
The base class is aware of the GCPC environment and can cascade | ||
a pipeline cancel event to the operation through ``on_cancel`` handler. | ||
Args: | ||
on_cancel: optional, function to handle KFP cancel event. | ||
""" | ||
|
||
def __init__(self, on_cancel=None): | ||
logging.info('Starting GCPC context') | ||
self._on_cancel = on_cancel | ||
self._original_sigterm_handler = None | ||
|
||
def __enter__(self): | ||
logging.info('Adding signal handler') | ||
self._original_sigterm_handler = signal.signal(signal.SIGTERM, | ||
self._exit_gracefully) | ||
return self | ||
|
||
def __exit__(self, *_): | ||
logging.info('Exiting GCPC context') | ||
signal.signal(signal.SIGTERM, self._original_sigterm_handler) | ||
|
||
def _exit_gracefully(self, *_): | ||
logging.info('SIGTERM signal received.') | ||
if self._on_cancel: | ||
logging.info('Cancelling...') | ||
self._on_cancel() | ||
|
||
# Exiting here to prevent any downstream errors due to the cancelled job | ||
logging.info('Exiting GCPC context due to cancellation.') | ||
os._exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.