diff --git a/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample.py b/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample.py new file mode 100644 index 0000000000..414e4e25f4 --- /dev/null +++ b/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample.py @@ -0,0 +1,24 @@ +# Copyright 2022 Google LLC +# +# 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 +# +# https://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. + +from google.cloud import aiplatform + + +# [START aiplatform_sdk_get_execution_input_artifacts_sample] +def get_execution_input_artifacts_sample( + execution: aiplatform.Execution +): + return execution.get_input_artifacts() + +# [END aiplatform_sdk_get_execution_input_artifacts_sample] diff --git a/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample_test.py b/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample_test.py new file mode 100644 index 0000000000..0998c5a32e --- /dev/null +++ b/samples/model-builder/experiment_tracking/get_execution_input_artifacts_sample_test.py @@ -0,0 +1,27 @@ +# Copyright 2022 Google LLC +# +# 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 +# +# https://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. + +import get_execution_input_artifacts_sample +from google.cloud import aiplatform + + +def test_aiplatform_sdk_get_execution_input_artifacts_sample( + mock_get_execution +): + exc = aiplatform.Execution() + get_execution_input_artifacts_sample.get_execution_input_artifacts_sample( + execution=exc + ) + + exc.get_input_artifacts.assert_called_with() diff --git a/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample.py b/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample.py new file mode 100644 index 0000000000..31485ec3e6 --- /dev/null +++ b/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample.py @@ -0,0 +1,24 @@ +# Copyright 2022 Google LLC +# +# 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 +# +# https://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. + +from google.cloud import aiplatform + + +# [START aiplatform_sdk_get_execution_output_artifacts_sample] +def get_execution_output_artifacts_sample( + execution: aiplatform.Execution +): + return execution.get_output_artifacts() + +# [END aiplatform_sdk_get_execution_output_artifacts_sample] diff --git a/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample_test.py b/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample_test.py new file mode 100644 index 0000000000..dfb1b7b95b --- /dev/null +++ b/samples/model-builder/experiment_tracking/get_execution_output_artifacts_sample_test.py @@ -0,0 +1,27 @@ +# Copyright 2022 Google LLC +# +# 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 +# +# https://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. + +import get_execution_output_artifacts_sample +from google.cloud import aiplatform + + +def test_aiplatform_sdk_get_execution_output_artifacts_sample( + mock_get_execution +): + exc = aiplatform.Execution() + get_execution_output_artifacts_sample.get_execution_output_artifacts_sample( + execution=exc + ) + + exc.get_output_artifacts.assert_called_with()