sagemaker-core 1.0.62__py3-none-any.whl → 2.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sagemaker/core/__init__.py +16 -0
- sagemaker/core/_studio.py +116 -0
- sagemaker/core/_version.py +11 -0
- sagemaker/core/accept_types.py +131 -0
- sagemaker/core/analytics.py +744 -0
- sagemaker/core/apiutils/__init__.py +13 -0
- sagemaker/core/apiutils/_base_types.py +228 -0
- sagemaker/core/apiutils/_boto_functions.py +130 -0
- sagemaker/core/apiutils/_utils.py +34 -0
- sagemaker/core/base_deserializers.py +35 -0
- sagemaker/core/base_serializers.py +35 -0
- sagemaker/core/clarify/__init__.py +2898 -0
- sagemaker/core/collection.py +467 -0
- sagemaker/core/common_utils.py +2281 -0
- sagemaker/core/compute_resource_requirements/__init__.py +18 -0
- sagemaker/core/compute_resource_requirements/resource_requirements.py +94 -0
- sagemaker/core/config/__init__.py +181 -0
- sagemaker/core/config/config.py +238 -0
- sagemaker/core/config/config_manager.py +595 -0
- sagemaker/core/config/config_schema.py +1220 -0
- sagemaker/core/config/config_utils.py +297 -0
- {sagemaker_core/main → sagemaker/core}/config_schema.py +408 -3
- sagemaker/core/constants.py +73 -0
- sagemaker/core/content_types.py +137 -0
- sagemaker/core/debugger/__init__.py +39 -0
- sagemaker/core/debugger/debugger.py +945 -0
- sagemaker/core/debugger/framework_profile.py +292 -0
- sagemaker/core/debugger/metrics_config.py +468 -0
- sagemaker/core/debugger/profiler.py +42 -0
- sagemaker/core/debugger/profiler_config.py +190 -0
- sagemaker/core/debugger/profiler_constants.py +40 -0
- sagemaker/core/debugger/utils.py +148 -0
- sagemaker/core/deprecations.py +254 -0
- sagemaker/core/deserializers/__init__.py +10 -0
- sagemaker/core/deserializers/base.py +424 -0
- sagemaker/core/deserializers/implementations.py +157 -0
- sagemaker/core/drift_check_baselines.py +106 -0
- sagemaker/core/enums.py +51 -0
- sagemaker/core/environment_variables.py +101 -0
- sagemaker/core/exceptions.py +108 -0
- sagemaker/core/experiments/__init__.py +53 -0
- sagemaker/core/experiments/_api_types.py +251 -0
- sagemaker/core/experiments/_environment.py +124 -0
- sagemaker/core/experiments/_helper.py +294 -0
- sagemaker/core/experiments/_metrics.py +333 -0
- sagemaker/core/experiments/_run_context.py +58 -0
- sagemaker/core/experiments/_utils.py +216 -0
- sagemaker/core/experiments/experiment.py +244 -0
- sagemaker/core/experiments/run.py +970 -0
- sagemaker/core/experiments/trial.py +296 -0
- sagemaker/core/experiments/trial_component.py +387 -0
- sagemaker/core/explainer/__init__.py +24 -0
- sagemaker/core/explainer/clarify_explainer_config.py +298 -0
- sagemaker/core/explainer/explainer_config.py +44 -0
- sagemaker/core/fw_utils.py +1176 -0
- sagemaker/core/git_utils.py +349 -0
- sagemaker/core/helper/pipeline_variable.py +82 -0
- sagemaker/core/helper/session_helper.py +2965 -0
- sagemaker/core/huggingface/__init__.py +29 -0
- sagemaker/core/huggingface/llm_utils.py +150 -0
- sagemaker/core/huggingface/processing.py +139 -0
- sagemaker/core/huggingface/training_compiler/config.py +167 -0
- sagemaker/core/hyperparameters.py +172 -0
- sagemaker/core/image_retriever/__init__.py +3 -0
- sagemaker/core/image_retriever/image_retriever.py +640 -0
- sagemaker/core/image_retriever/image_retriever_utils.py +511 -0
- sagemaker/core/image_retriever/test.py +7 -0
- sagemaker/core/image_uri_config/__init__.py +13 -0
- sagemaker/core/image_uri_config/autogluon.json +1335 -0
- sagemaker/core/image_uri_config/blazingtext.json +50 -0
- sagemaker/core/image_uri_config/chainer.json +104 -0
- sagemaker/core/image_uri_config/clarify.json +39 -0
- sagemaker/core/image_uri_config/coach-mxnet.json +70 -0
- sagemaker/core/image_uri_config/coach-tensorflow.json +186 -0
- sagemaker/core/image_uri_config/data-wrangler.json +91 -0
- sagemaker/core/image_uri_config/debugger.json +34 -0
- sagemaker/core/image_uri_config/detailed-profiler.json +18 -0
- sagemaker/core/image_uri_config/djl-deepspeed.json +385 -0
- sagemaker/core/image_uri_config/djl-fastertransformer.json +167 -0
- sagemaker/core/image_uri_config/djl-lmi.json +136 -0
- sagemaker/core/image_uri_config/djl-neuronx.json +258 -0
- sagemaker/core/image_uri_config/djl-tensorrtllm.json +262 -0
- sagemaker/core/image_uri_config/factorization-machines.json +50 -0
- sagemaker/core/image_uri_config/forecasting-deepar.json +50 -0
- sagemaker/core/image_uri_config/huggingface-llm-neuronx.json +660 -0
- sagemaker/core/image_uri_config/huggingface-llm.json +1158 -0
- sagemaker/core/image_uri_config/huggingface-neuron.json +52 -0
- sagemaker/core/image_uri_config/huggingface-neuronx.json +510 -0
- sagemaker/core/image_uri_config/huggingface-tei-cpu.json +298 -0
- sagemaker/core/image_uri_config/huggingface-tei.json +298 -0
- sagemaker/core/image_uri_config/huggingface-training-compiler.json +195 -0
- sagemaker/core/image_uri_config/huggingface.json +2138 -0
- sagemaker/core/image_uri_config/hyperpod-recipes-neuron.json +52 -0
- sagemaker/core/image_uri_config/image-classification-neo.json +43 -0
- sagemaker/core/image_uri_config/image-classification.json +50 -0
- sagemaker/core/image_uri_config/inferentia-mxnet.json +88 -0
- sagemaker/core/image_uri_config/inferentia-pytorch.json +127 -0
- sagemaker/core/image_uri_config/inferentia-tensorflow.json +88 -0
- sagemaker/core/image_uri_config/instance_gpu_info.json +782 -0
- sagemaker/core/image_uri_config/ipinsights.json +50 -0
- sagemaker/core/image_uri_config/kmeans.json +50 -0
- sagemaker/core/image_uri_config/knn.json +50 -0
- sagemaker/core/image_uri_config/lda.json +26 -0
- sagemaker/core/image_uri_config/linear-learner.json +50 -0
- sagemaker/core/image_uri_config/model-monitor.json +42 -0
- sagemaker/core/image_uri_config/mxnet.json +1154 -0
- sagemaker/core/image_uri_config/neo-mxnet.json +64 -0
- sagemaker/core/image_uri_config/neo-pytorch.json +341 -0
- sagemaker/core/image_uri_config/neo-tensorflow.json +109 -0
- sagemaker/core/image_uri_config/ntm.json +50 -0
- sagemaker/core/image_uri_config/object-detection.json +50 -0
- sagemaker/core/image_uri_config/object2vec.json +50 -0
- sagemaker/core/image_uri_config/pca.json +50 -0
- sagemaker/core/image_uri_config/pytorch-neuron.json +43 -0
- sagemaker/core/image_uri_config/pytorch-smp.json +218 -0
- sagemaker/core/image_uri_config/pytorch-training-compiler.json +80 -0
- sagemaker/core/image_uri_config/pytorch.json +3101 -0
- sagemaker/core/image_uri_config/randomcutforest.json +50 -0
- sagemaker/core/image_uri_config/ray-pytorch.json +46 -0
- sagemaker/core/image_uri_config/ray-tensorflow.json +194 -0
- sagemaker/core/image_uri_config/sagemaker-base-python.json +46 -0
- sagemaker/core/image_uri_config/sagemaker-distribution.json +37 -0
- sagemaker/core/image_uri_config/sagemaker-geospatial.json +13 -0
- sagemaker/core/image_uri_config/sagemaker-tritonserver.json +212 -0
- sagemaker/core/image_uri_config/semantic-segmentation.json +50 -0
- sagemaker/core/image_uri_config/seq2seq.json +50 -0
- sagemaker/core/image_uri_config/sklearn.json +446 -0
- sagemaker/core/image_uri_config/spark.json +280 -0
- sagemaker/core/image_uri_config/sparkml-serving.json +97 -0
- sagemaker/core/image_uri_config/stabilityai.json +53 -0
- sagemaker/core/image_uri_config/tensorflow.json +5086 -0
- sagemaker/core/image_uri_config/vw.json +25 -0
- sagemaker/core/image_uri_config/xgboost-neo.json +43 -0
- sagemaker/core/image_uri_config/xgboost.json +888 -0
- sagemaker/core/image_uris.py +810 -0
- sagemaker/core/inference_config.py +144 -0
- sagemaker/core/inference_recommender/__init__.py +18 -0
- sagemaker/core/inference_recommender/inference_recommender_mixin.py +622 -0
- sagemaker/core/inputs.py +366 -0
- sagemaker/core/instance_group.py +61 -0
- sagemaker/core/instance_types.py +164 -0
- sagemaker/core/instance_types_gpu_info.py +43 -0
- sagemaker/core/interactive_apps/__init__.py +41 -0
- sagemaker/core/interactive_apps/base_interactive_app.py +204 -0
- sagemaker/core/interactive_apps/detail_profiler_app.py +139 -0
- sagemaker/core/interactive_apps/tensorboard.py +149 -0
- sagemaker/core/iterators.py +186 -0
- sagemaker/core/job.py +380 -0
- sagemaker/core/jumpstart/__init__.py +156 -0
- sagemaker/core/jumpstart/accessors.py +390 -0
- sagemaker/core/jumpstart/artifacts/__init__.py +69 -0
- sagemaker/core/jumpstart/artifacts/environment_variables.py +252 -0
- sagemaker/core/jumpstart/artifacts/hyperparameters.py +120 -0
- sagemaker/core/jumpstart/artifacts/image_uris.py +139 -0
- sagemaker/core/jumpstart/artifacts/incremental_training.py +87 -0
- sagemaker/core/jumpstart/artifacts/instance_types.py +223 -0
- sagemaker/core/jumpstart/artifacts/kwargs.py +289 -0
- sagemaker/core/jumpstart/artifacts/metric_definitions.py +117 -0
- sagemaker/core/jumpstart/artifacts/model_packages.py +202 -0
- sagemaker/core/jumpstart/artifacts/model_uris.py +252 -0
- sagemaker/core/jumpstart/artifacts/payloads.py +96 -0
- sagemaker/core/jumpstart/artifacts/predictors.py +540 -0
- sagemaker/core/jumpstart/artifacts/resource_names.py +86 -0
- sagemaker/core/jumpstart/artifacts/resource_requirements.py +162 -0
- sagemaker/core/jumpstart/artifacts/script_uris.py +172 -0
- sagemaker/core/jumpstart/cache.py +663 -0
- sagemaker/core/jumpstart/configs.py +50 -0
- sagemaker/core/jumpstart/constants.py +198 -0
- sagemaker/core/jumpstart/deserializers.py +81 -0
- sagemaker/core/jumpstart/document.py +76 -0
- sagemaker/core/jumpstart/enums.py +168 -0
- sagemaker/core/jumpstart/exceptions.py +236 -0
- sagemaker/core/jumpstart/factory/utils.py +833 -0
- sagemaker/core/jumpstart/filters.py +597 -0
- sagemaker/core/jumpstart/hub/constants.py +16 -0
- sagemaker/core/jumpstart/hub/hub.py +291 -0
- sagemaker/core/jumpstart/hub/interfaces.py +936 -0
- sagemaker/core/jumpstart/hub/parser_utils.py +70 -0
- sagemaker/core/jumpstart/hub/parsers.py +288 -0
- sagemaker/core/jumpstart/hub/types.py +35 -0
- sagemaker/core/jumpstart/hub/utils.py +260 -0
- sagemaker/core/jumpstart/models.py +499 -0
- sagemaker/core/jumpstart/notebook_utils.py +575 -0
- sagemaker/core/jumpstart/parameters.py +20 -0
- sagemaker/core/jumpstart/payload_utils.py +239 -0
- sagemaker/core/jumpstart/region_config.json +163 -0
- sagemaker/core/jumpstart/search.py +171 -0
- sagemaker/core/jumpstart/serializers.py +81 -0
- sagemaker/core/jumpstart/session_utils.py +234 -0
- sagemaker/core/jumpstart/types.py +3044 -0
- sagemaker/core/jumpstart/utils.py +1731 -0
- sagemaker/core/jumpstart/validators.py +257 -0
- sagemaker/core/lambda_helper.py +312 -0
- sagemaker/core/lineage/__init__.py +42 -0
- sagemaker/core/lineage/_api_types.py +239 -0
- sagemaker/core/lineage/_utils.py +49 -0
- sagemaker/core/lineage/action.py +345 -0
- sagemaker/core/lineage/artifact.py +646 -0
- sagemaker/core/lineage/association.py +190 -0
- sagemaker/core/lineage/context.py +505 -0
- sagemaker/core/lineage/lineage_trial_component.py +191 -0
- sagemaker/core/lineage/query.py +732 -0
- sagemaker/core/lineage/visualizer.py +346 -0
- sagemaker/core/local/__init__.py +18 -0
- sagemaker/core/local/data.py +413 -0
- sagemaker/core/local/entities.py +678 -0
- sagemaker/core/local/exceptions.py +17 -0
- sagemaker/core/local/image.py +1243 -0
- sagemaker/core/local/local_session.py +739 -0
- sagemaker/core/local/utils.py +245 -0
- sagemaker/core/logs.py +181 -0
- sagemaker/core/metadata_properties.py +56 -0
- sagemaker/core/metric_definitions.py +91 -0
- sagemaker/core/mlflow/__init__.py +38 -0
- sagemaker/core/mlflow/forward_sagemaker_metrics.py +44 -0
- sagemaker/core/model_card/__init__.py +26 -0
- sagemaker/core/model_life_cycle.py +51 -0
- sagemaker/core/model_metrics.py +160 -0
- sagemaker/core/model_monitor/__init__.py +66 -0
- sagemaker/core/model_monitor/clarify_model_monitoring.py +1495 -0
- sagemaker/core/model_monitor/cron_expression_generator.py +82 -0
- sagemaker/core/model_monitor/data_capture_config.py +115 -0
- sagemaker/core/model_monitor/data_quality_monitoring_config.py +66 -0
- sagemaker/core/model_monitor/dataset_format.py +102 -0
- sagemaker/core/model_monitor/model_monitoring.py +4266 -0
- sagemaker/core/model_monitor/monitoring_alert.py +76 -0
- sagemaker/core/model_monitor/monitoring_files.py +506 -0
- sagemaker/core/model_monitor/utils.py +793 -0
- sagemaker/core/model_registry.py +480 -0
- sagemaker/core/model_uris.py +97 -0
- sagemaker/core/modules/__init__.py +19 -0
- sagemaker/core/modules/configs.py +226 -0
- sagemaker/core/modules/constants.py +37 -0
- sagemaker/core/modules/distributed.py +182 -0
- sagemaker/core/modules/local_core/__init__.py +0 -0
- sagemaker/core/modules/local_core/local_container.py +605 -0
- sagemaker/core/modules/templates.py +83 -0
- sagemaker/core/modules/train/__init__.py +14 -0
- sagemaker/core/modules/train/container_drivers/__init__.py +14 -0
- sagemaker/core/modules/train/container_drivers/common/__init__.py +14 -0
- sagemaker/core/modules/train/container_drivers/common/utils.py +213 -0
- sagemaker/core/modules/train/container_drivers/distributed_drivers/__init__.py +14 -0
- sagemaker/core/modules/train/container_drivers/distributed_drivers/basic_script_driver.py +81 -0
- sagemaker/core/modules/train/container_drivers/distributed_drivers/mpi_driver.py +123 -0
- sagemaker/core/modules/train/container_drivers/distributed_drivers/mpi_utils.py +302 -0
- sagemaker/core/modules/train/container_drivers/distributed_drivers/torchrun_driver.py +129 -0
- sagemaker/core/modules/train/container_drivers/scripts/__init__.py +14 -0
- sagemaker/core/modules/train/container_drivers/scripts/environment.py +305 -0
- sagemaker/core/modules/train/sm_recipes/__init__.py +0 -0
- sagemaker/core/modules/train/sm_recipes/utils.py +330 -0
- sagemaker/core/modules/types.py +19 -0
- sagemaker/core/modules/utils.py +194 -0
- sagemaker/core/network.py +185 -0
- sagemaker/core/parameter.py +173 -0
- sagemaker/core/payloads.py +185 -0
- sagemaker/core/processing.py +1597 -0
- sagemaker/core/remote_function/__init__.py +19 -0
- sagemaker/core/remote_function/checkpoint_location.py +47 -0
- sagemaker/core/remote_function/client.py +1285 -0
- sagemaker/core/remote_function/core/__init__.py +0 -0
- sagemaker/core/remote_function/core/_custom_dispatch_table.py +72 -0
- sagemaker/core/remote_function/core/pipeline_variables.py +353 -0
- sagemaker/core/remote_function/core/serialization.py +422 -0
- sagemaker/core/remote_function/core/stored_function.py +226 -0
- sagemaker/core/remote_function/custom_file_filter.py +128 -0
- sagemaker/core/remote_function/errors.py +104 -0
- sagemaker/core/remote_function/invoke_function.py +172 -0
- sagemaker/core/remote_function/job.py +2140 -0
- sagemaker/core/remote_function/logging_config.py +38 -0
- sagemaker/core/remote_function/runtime_environment/__init__.py +14 -0
- sagemaker/core/remote_function/runtime_environment/bootstrap_runtime_environment.py +605 -0
- sagemaker/core/remote_function/runtime_environment/mpi_utils_remote.py +252 -0
- sagemaker/core/remote_function/runtime_environment/runtime_environment_manager.py +554 -0
- sagemaker/core/remote_function/runtime_environment/spark_app.py +18 -0
- sagemaker/core/remote_function/spark_config.py +149 -0
- sagemaker/core/resource_requirements.py +168 -0
- {sagemaker_core/main → sagemaker/core}/resources.py +19098 -10895
- sagemaker/core/s3/__init__.py +41 -0
- sagemaker/core/s3/client.py +367 -0
- sagemaker/core/s3/utils.py +175 -0
- sagemaker/core/script_uris.py +93 -0
- sagemaker/core/serializers/__init__.py +11 -0
- sagemaker/core/serializers/base.py +510 -0
- sagemaker/core/serializers/implementations.py +159 -0
- sagemaker/core/serializers/utils.py +223 -0
- sagemaker/core/serverless_inference_config.py +63 -0
- sagemaker/core/session_settings.py +55 -0
- sagemaker/core/shapes/__init__.py +3 -0
- sagemaker/core/shapes/model_card_shapes.py +159 -0
- {sagemaker_core/main → sagemaker/core/shapes}/shapes.py +5810 -1806
- sagemaker/core/spark/__init__.py +16 -0
- sagemaker/core/spark/defaults.py +16 -0
- sagemaker/core/spark/processing.py +1380 -0
- sagemaker/core/telemetry/__init__.py +23 -0
- sagemaker/core/telemetry/constants.py +84 -0
- sagemaker/core/telemetry/telemetry_logging.py +284 -0
- sagemaker/core/tools/__init__.py +1 -0
- {sagemaker_core → sagemaker/core}/tools/codegen.py +4 -4
- {sagemaker_core → sagemaker/core}/tools/constants.py +23 -15
- {sagemaker_core → sagemaker/core}/tools/data_extractor.py +1 -1
- {sagemaker_core → sagemaker/core}/tools/method.py +1 -1
- sagemaker/core/tools/model_card/generate_model_card_from_schema.py +562 -0
- {sagemaker_core → sagemaker/core}/tools/resources_codegen.py +165 -98
- {sagemaker_core → sagemaker/core}/tools/resources_extractor.py +5 -13
- {sagemaker_core → sagemaker/core}/tools/shapes_codegen.py +16 -17
- {sagemaker_core → sagemaker/core}/tools/shapes_extractor.py +29 -67
- {sagemaker_core → sagemaker/core}/tools/templates.py +39 -17
- sagemaker/core/training/__init__.py +14 -0
- sagemaker/core/training/configs.py +333 -0
- sagemaker/core/training/constants.py +37 -0
- sagemaker/core/training/utils.py +77 -0
- sagemaker/core/training_compiler/__init__.py +16 -0
- sagemaker/core/training_compiler/config.py +197 -0
- sagemaker/core/training_compiler_config.py +197 -0
- sagemaker/core/transformer.py +793 -0
- sagemaker/core/user_agent.py +76 -0
- sagemaker/core/utilities/__init__.py +24 -0
- sagemaker/core/utilities/cache.py +169 -0
- sagemaker/core/utilities/search_expression.py +133 -0
- sagemaker/core/utils/__init__.py +48 -0
- sagemaker/core/utils/code_injection/__init__.py +0 -0
- {sagemaker_core/main → sagemaker/core/utils}/code_injection/codec.py +2 -2
- {sagemaker_core/main → sagemaker/core/utils}/code_injection/shape_dag.py +5979 -176
- {sagemaker_core/main → sagemaker/core/utils}/exceptions.py +8 -8
- sagemaker_core/main/default_configs_helper.py → sagemaker/core/utils/intelligent_defaults_helper.py +5 -6
- {sagemaker_core/main → sagemaker/core/utils}/logs.py +1 -2
- {sagemaker_core/main → sagemaker/core/utils}/utils.py +27 -22
- sagemaker/core/workflow/__init__.py +152 -0
- sagemaker/core/workflow/conditions.py +313 -0
- sagemaker/core/workflow/entities.py +58 -0
- sagemaker/core/workflow/execution_variables.py +89 -0
- sagemaker/core/workflow/functions.py +193 -0
- sagemaker/core/workflow/parameters.py +222 -0
- sagemaker/core/workflow/pipeline_context.py +394 -0
- sagemaker/core/workflow/pipeline_definition_config.py +31 -0
- sagemaker/core/workflow/properties.py +285 -0
- sagemaker/core/workflow/step_outputs.py +65 -0
- sagemaker/core/workflow/utilities.py +507 -0
- sagemaker/lineage/__init__.py +33 -0
- sagemaker/lineage/action.py +28 -0
- sagemaker/lineage/artifact.py +28 -0
- sagemaker/lineage/context.py +28 -0
- sagemaker/lineage/lineage_trial_component.py +28 -0
- {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/METADATA +28 -9
- sagemaker_core-2.1.1.dist-info/RECORD +355 -0
- sagemaker_core-2.1.1.dist-info/top_level.txt +1 -0
- sagemaker_core/_version.py +0 -3
- sagemaker_core/helper/session_helper.py +0 -769
- sagemaker_core/resources/__init__.py +0 -1
- sagemaker_core/shapes/__init__.py +0 -1
- sagemaker_core/tools/__init__.py +0 -1
- sagemaker_core-1.0.62.dist-info/RECORD +0 -35
- sagemaker_core-1.0.62.dist-info/top_level.txt +0 -1
- {sagemaker_core → sagemaker/core/helper}/__init__.py +0 -0
- {sagemaker_core/helper → sagemaker/core/huggingface/training_compiler}/__init__.py +0 -0
- {sagemaker_core/main → sagemaker/core/jumpstart/factory}/__init__.py +0 -0
- {sagemaker_core/main/code_injection → sagemaker/core/jumpstart/hub}/__init__.py +0 -0
- {sagemaker_core/main → sagemaker/core/utils}/code_injection/base.py +0 -0
- {sagemaker_core/main → sagemaker/core/utils}/code_injection/constants.py +0 -0
- {sagemaker_core/main → sagemaker/core/utils}/user_agent.py +0 -0
- {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/WHEEL +0 -0
- {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
|
5
|
+
# the License is located at
|
|
6
|
+
#
|
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
|
8
|
+
#
|
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
# language governing permissions and limitations under the License.
|
|
13
|
+
"""Contains API objects for SageMaker Lineage."""
|
|
14
|
+
from __future__ import absolute_import
|
|
15
|
+
|
|
16
|
+
from sagemaker.core.apiutils import _base_types
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ArtifactSource(_base_types.ApiObject):
|
|
20
|
+
"""ArtifactSource.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
source_uri (str): The URI of the source.
|
|
24
|
+
source_types(list[ArtifactSourceType]): List of source types
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
source_uri = None
|
|
28
|
+
source_types = None
|
|
29
|
+
|
|
30
|
+
def __init__(self, source_uri=None, source_types=None, **kwargs):
|
|
31
|
+
"""Initialize ArtifactSource.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
source_uri (str): Source S3 URI of the artifact.
|
|
35
|
+
source_types (array): Array of artifact source types.
|
|
36
|
+
**kwargs: Arbitrary keyword arguments.
|
|
37
|
+
"""
|
|
38
|
+
super(ArtifactSource, self).__init__(
|
|
39
|
+
source_uri=source_uri, source_types=source_types, **kwargs
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ArtifactSourceType(_base_types.ApiObject):
|
|
44
|
+
"""ArtifactSourceType.
|
|
45
|
+
|
|
46
|
+
Attributes:
|
|
47
|
+
source_id_type (str): The source id type of artifact source.
|
|
48
|
+
value(str): The value of source
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
source_id_type = None
|
|
52
|
+
value = None
|
|
53
|
+
|
|
54
|
+
def __init__(self, source_id_type=None, value=None, **kwargs):
|
|
55
|
+
"""Initialize ArtifactSourceType.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
source_id_type (str): The type of the source id.
|
|
59
|
+
value (str): The source id.
|
|
60
|
+
**kwargs: Arbitrary keyword arguments.
|
|
61
|
+
"""
|
|
62
|
+
super(ArtifactSourceType, self).__init__(
|
|
63
|
+
source_id_type=source_id_type, value=value, **kwargs
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ActionSource(_base_types.ApiObject):
|
|
68
|
+
"""ActionSource.
|
|
69
|
+
|
|
70
|
+
Attributes:
|
|
71
|
+
source_uri (str): The URI of the source.
|
|
72
|
+
source_type (str): The type of the source URI.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
source_uri = None
|
|
76
|
+
source_type = None
|
|
77
|
+
|
|
78
|
+
def __init__(self, source_uri=None, source_type=None, **kwargs):
|
|
79
|
+
"""Initialize ActionSource.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
source_uri (str): The URI of the source.
|
|
83
|
+
source_type (str): The type of the source.
|
|
84
|
+
**kwargs: Arbitrary keyword arguments.
|
|
85
|
+
"""
|
|
86
|
+
super(ActionSource, self).__init__(source_uri=source_uri, source_type=source_type, **kwargs)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class ContextSource(_base_types.ApiObject):
|
|
90
|
+
"""ContextSource.
|
|
91
|
+
|
|
92
|
+
Attributes:
|
|
93
|
+
source_uri (str): The URI of the source.
|
|
94
|
+
source_type (str): The type of the source.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
source_uri = None
|
|
98
|
+
source_type = None
|
|
99
|
+
|
|
100
|
+
def __init__(self, source_uri=None, source_type=None, **kwargs):
|
|
101
|
+
"""Initialize ContextSource.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
source_uri (str): The URI of the source.
|
|
105
|
+
source_type (str): The type of the source.
|
|
106
|
+
**kwargs: Arbitrary keyword arguments.
|
|
107
|
+
"""
|
|
108
|
+
super(ContextSource, self).__init__(
|
|
109
|
+
source_uri=source_uri, source_type=source_type, **kwargs
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ArtifactSummary(_base_types.ApiObject):
|
|
114
|
+
"""Summary model of an Artifact.
|
|
115
|
+
|
|
116
|
+
Attributes:
|
|
117
|
+
artifact_arn (str): ARN of artifact.
|
|
118
|
+
artifact_name (str): Name of artifact.
|
|
119
|
+
source (obj): Source of artifact.
|
|
120
|
+
artifact_type (str): Type of artifact.
|
|
121
|
+
creation_time (datetime): Creation time.
|
|
122
|
+
last_modified_time (datetime): Date last modified.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
_custom_boto_types = {
|
|
126
|
+
"source": (ArtifactSource, False),
|
|
127
|
+
}
|
|
128
|
+
artifact_arn = None
|
|
129
|
+
artifact_name = None
|
|
130
|
+
source = None
|
|
131
|
+
artifact_type = None
|
|
132
|
+
creation_time = None
|
|
133
|
+
last_modified_time = None
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ActionSummary(_base_types.ApiObject):
|
|
137
|
+
"""Summary model of an action.
|
|
138
|
+
|
|
139
|
+
Attributes:
|
|
140
|
+
action_arn (str): ARN of action.
|
|
141
|
+
action_name (str): Name of action.
|
|
142
|
+
source (obj): Source of action.
|
|
143
|
+
action_type (str): Type of action.
|
|
144
|
+
status (str): The status of the action.
|
|
145
|
+
creation_time (datetime): Creation time.
|
|
146
|
+
last_modified_time (datetime): Date last modified.
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
_custom_boto_types = {
|
|
150
|
+
"source": (ActionSource, False),
|
|
151
|
+
}
|
|
152
|
+
action_arn = None
|
|
153
|
+
action_name = None
|
|
154
|
+
source = None
|
|
155
|
+
action_type = None
|
|
156
|
+
status = None
|
|
157
|
+
creation_time = None
|
|
158
|
+
last_modified_time = None
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class ContextSummary(_base_types.ApiObject):
|
|
162
|
+
"""Summary model of an context.
|
|
163
|
+
|
|
164
|
+
Attributes:
|
|
165
|
+
context_arn (str): ARN of context.
|
|
166
|
+
context_name (str): Name of context.
|
|
167
|
+
source (obj): Source of context.
|
|
168
|
+
context_type (str): Type of context.
|
|
169
|
+
creation_time (datetime): Creation time.
|
|
170
|
+
last_modified_time (datetime): Date last modified.
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
_custom_boto_types = {
|
|
174
|
+
"source": (ContextSource, False),
|
|
175
|
+
}
|
|
176
|
+
context_arn = None
|
|
177
|
+
context_name = None
|
|
178
|
+
source = None
|
|
179
|
+
context_type = None
|
|
180
|
+
creation_time = None
|
|
181
|
+
last_modified_time = None
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class UserContext(_base_types.ApiObject):
|
|
185
|
+
"""Summary model of a user context.
|
|
186
|
+
|
|
187
|
+
Attributes:
|
|
188
|
+
user_profile_arn (str): User profile ARN.
|
|
189
|
+
user_profile_name (str): User profile name.
|
|
190
|
+
domain_id (str): DomainId.
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
user_profile_arn = None
|
|
194
|
+
user_profile_name = None
|
|
195
|
+
domain_id = None
|
|
196
|
+
|
|
197
|
+
def __init__(self, user_profile_arn=None, user_profile_name=None, domain_id=None, **kwargs):
|
|
198
|
+
"""Initialize UserContext.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
user_profile_arn (str): User profile ARN.
|
|
202
|
+
user_profile_name (str): User profile name.
|
|
203
|
+
domain_id (str): DomainId.
|
|
204
|
+
**kwargs: Arbitrary keyword arguments.
|
|
205
|
+
"""
|
|
206
|
+
super(UserContext, self).__init__(
|
|
207
|
+
user_profile_arn=user_profile_arn,
|
|
208
|
+
user_profile_name=user_profile_name,
|
|
209
|
+
domain_id=domain_id,
|
|
210
|
+
**kwargs,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class AssociationSummary(_base_types.ApiObject):
|
|
215
|
+
"""Summary model of an association.
|
|
216
|
+
|
|
217
|
+
Attributes:
|
|
218
|
+
source_arn (str): ARN of source entity.
|
|
219
|
+
source_name (str): Name of the source entity.
|
|
220
|
+
destination_arn (str): ARN of the destination entity.
|
|
221
|
+
destination_name (str): Name of the destination entity.
|
|
222
|
+
source_type (obj): Type of the source entity.
|
|
223
|
+
destination_type (str): Type of destination entity.
|
|
224
|
+
association_type (str): The type of the association.
|
|
225
|
+
creation_time (datetime): Creation time.
|
|
226
|
+
created_by (obj): Context on creator.
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
_custom_boto_types = {
|
|
230
|
+
"created_by": (UserContext, False),
|
|
231
|
+
}
|
|
232
|
+
source_arn = None
|
|
233
|
+
source_name = None
|
|
234
|
+
destination_arn = None
|
|
235
|
+
destination_name = None
|
|
236
|
+
source_type = None
|
|
237
|
+
destination_type = None
|
|
238
|
+
association_type = None
|
|
239
|
+
creation_time = None
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
|
5
|
+
# the License is located at
|
|
6
|
+
#
|
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
|
8
|
+
#
|
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
# language governing permissions and limitations under the License.
|
|
13
|
+
"""SageMaker lineage utility methods."""
|
|
14
|
+
from __future__ import absolute_import
|
|
15
|
+
from sagemaker.core.lineage import association
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _disassociate(source_arn=None, destination_arn=None, sagemaker_session=None):
|
|
19
|
+
"""Remove the association.
|
|
20
|
+
|
|
21
|
+
Remove incoming association when source_arn is provided, remove outgoing association when
|
|
22
|
+
destination_arn is provided.
|
|
23
|
+
"""
|
|
24
|
+
association_summaries = association.Association.list(
|
|
25
|
+
source_arn=source_arn,
|
|
26
|
+
destination_arn=destination_arn,
|
|
27
|
+
sagemaker_session=sagemaker_session,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
for association_summary in association_summaries:
|
|
31
|
+
|
|
32
|
+
curr_association = association.Association(
|
|
33
|
+
sagemaker_session=sagemaker_session,
|
|
34
|
+
source_arn=association_summary.source_arn,
|
|
35
|
+
destination_arn=association_summary.destination_arn,
|
|
36
|
+
)
|
|
37
|
+
curr_association.delete()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_resource_name_from_arn(arn):
|
|
41
|
+
"""Extract the resource name from an ARN string.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
arn (str): An ARN.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
str: The resource name.
|
|
48
|
+
"""
|
|
49
|
+
return arn.split(":", 5)[5].split("/", 1)[1]
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
|
5
|
+
# the License is located at
|
|
6
|
+
#
|
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
|
8
|
+
#
|
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
# language governing permissions and limitations under the License.
|
|
13
|
+
"""This module contains code to create and manage SageMaker ``Actions``."""
|
|
14
|
+
from __future__ import absolute_import
|
|
15
|
+
|
|
16
|
+
from typing import Optional, Iterator, List
|
|
17
|
+
from datetime import datetime
|
|
18
|
+
|
|
19
|
+
from sagemaker.core.helper.session_helper import Session
|
|
20
|
+
from sagemaker.core.apiutils import _base_types
|
|
21
|
+
from sagemaker.core.lineage import _api_types, _utils
|
|
22
|
+
from sagemaker.core.lineage._api_types import ActionSource, ActionSummary
|
|
23
|
+
from sagemaker.core.lineage.artifact import Artifact
|
|
24
|
+
from sagemaker.core.common_utils import format_tags
|
|
25
|
+
|
|
26
|
+
from sagemaker.core.lineage.query import (
|
|
27
|
+
LineageQuery,
|
|
28
|
+
LineageFilter,
|
|
29
|
+
LineageSourceEnum,
|
|
30
|
+
LineageEntityEnum,
|
|
31
|
+
LineageQueryDirectionEnum,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Action(_base_types.Record):
|
|
36
|
+
"""An Amazon SageMaker action, which is part of a SageMaker lineage.
|
|
37
|
+
|
|
38
|
+
Examples:
|
|
39
|
+
.. code-block:: python
|
|
40
|
+
|
|
41
|
+
from sagemaker.lineage import action
|
|
42
|
+
|
|
43
|
+
my_action = action.Action.create(
|
|
44
|
+
action_name='MyAction',
|
|
45
|
+
action_type='EndpointDeployment',
|
|
46
|
+
source_uri='s3://...')
|
|
47
|
+
|
|
48
|
+
my_action.properties["added"] = "property"
|
|
49
|
+
my_action.save()
|
|
50
|
+
|
|
51
|
+
for actn in action.Action.list():
|
|
52
|
+
print(actn)
|
|
53
|
+
|
|
54
|
+
my_action.delete()
|
|
55
|
+
|
|
56
|
+
Attributes:
|
|
57
|
+
action_arn (str): The ARN of the action.
|
|
58
|
+
action_name (str): The name of the action.
|
|
59
|
+
action_type (str): The type of the action.
|
|
60
|
+
description (str): A description of the action.
|
|
61
|
+
status (str): The status of the action.
|
|
62
|
+
source (obj): The source of the action with a URI and type.
|
|
63
|
+
properties (dict): Dictionary of properties.
|
|
64
|
+
tags (List[dict[str, str]]): A list of tags to associate with the action.
|
|
65
|
+
creation_time (datetime): When the action was created.
|
|
66
|
+
created_by (obj): Contextual info on which account created the action.
|
|
67
|
+
last_modified_time (datetime): When the action was last modified.
|
|
68
|
+
last_modified_by (obj): Contextual info on which account created the action.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
action_arn: str = None
|
|
72
|
+
action_name: str = None
|
|
73
|
+
action_type: str = None
|
|
74
|
+
description: str = None
|
|
75
|
+
status: str = None
|
|
76
|
+
source: ActionSource = None
|
|
77
|
+
properties: dict = None
|
|
78
|
+
properties_to_remove: list = None
|
|
79
|
+
tags: list = None
|
|
80
|
+
creation_time: datetime = None
|
|
81
|
+
created_by: str = None
|
|
82
|
+
last_modified_time: datetime = None
|
|
83
|
+
last_modified_by: str = None
|
|
84
|
+
|
|
85
|
+
_boto_create_method: str = "create_action"
|
|
86
|
+
_boto_load_method: str = "describe_action"
|
|
87
|
+
_boto_update_method: str = "update_action"
|
|
88
|
+
_boto_delete_method: str = "delete_action"
|
|
89
|
+
|
|
90
|
+
_boto_update_members = [
|
|
91
|
+
"action_name",
|
|
92
|
+
"description",
|
|
93
|
+
"status",
|
|
94
|
+
"properties",
|
|
95
|
+
"properties_to_remove",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
_boto_delete_members = ["action_name"]
|
|
99
|
+
|
|
100
|
+
_custom_boto_types = {"source": (_api_types.ActionSource, False)}
|
|
101
|
+
|
|
102
|
+
def save(self) -> "Action":
|
|
103
|
+
"""Save the state of this Action to SageMaker.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Action: A SageMaker ``Action``object.
|
|
107
|
+
"""
|
|
108
|
+
return self._invoke_api(self._boto_update_method, self._boto_update_members)
|
|
109
|
+
|
|
110
|
+
def delete(self, disassociate: bool = False):
|
|
111
|
+
"""Delete the action.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
disassociate (bool): When set to true, disassociate incoming and outgoing association.
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
if disassociate:
|
|
118
|
+
_utils._disassociate(
|
|
119
|
+
source_arn=self.action_arn, sagemaker_session=self.sagemaker_session
|
|
120
|
+
)
|
|
121
|
+
_utils._disassociate(
|
|
122
|
+
destination_arn=self.action_arn,
|
|
123
|
+
sagemaker_session=self.sagemaker_session,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
self._invoke_api(self._boto_delete_method, self._boto_delete_members)
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def load(cls, action_name: str, sagemaker_session=None) -> "Action":
|
|
130
|
+
"""Load an existing action and return an ``Action`` object representing it.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
action_name (str): Name of the action
|
|
134
|
+
sagemaker_session (sagemaker.session.Session): Session object which
|
|
135
|
+
manages interactions with Amazon SageMaker APIs and any other
|
|
136
|
+
AWS services needed. If not specified, one is created using the
|
|
137
|
+
default AWS configuration chain.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
Action: A SageMaker ``Action`` object
|
|
141
|
+
"""
|
|
142
|
+
result = cls._construct(
|
|
143
|
+
cls._boto_load_method,
|
|
144
|
+
action_name=action_name,
|
|
145
|
+
sagemaker_session=sagemaker_session,
|
|
146
|
+
)
|
|
147
|
+
return result
|
|
148
|
+
|
|
149
|
+
def set_tag(self, tag=None):
|
|
150
|
+
"""Add a tag to the object.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
list({str:str}): a list of key value pairs
|
|
156
|
+
"""
|
|
157
|
+
return self._set_tags(resource_arn=self.action_arn, tags=[tag])
|
|
158
|
+
|
|
159
|
+
def set_tags(self, tags=None):
|
|
160
|
+
"""Add tags to the object.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
tags (Optional[Tags]): list of key value pairs.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
list({str:str}): a list of key value pairs
|
|
167
|
+
"""
|
|
168
|
+
return self._set_tags(resource_arn=self.action_arn, tags=format_tags(tags))
|
|
169
|
+
|
|
170
|
+
@classmethod
|
|
171
|
+
def create(
|
|
172
|
+
cls,
|
|
173
|
+
action_name: str = None,
|
|
174
|
+
source_uri: str = None,
|
|
175
|
+
source_type: str = None,
|
|
176
|
+
action_type: str = None,
|
|
177
|
+
description: str = None,
|
|
178
|
+
status: str = None,
|
|
179
|
+
properties: dict = None,
|
|
180
|
+
tags: dict = None,
|
|
181
|
+
sagemaker_session: Session = None,
|
|
182
|
+
) -> "Action":
|
|
183
|
+
"""Create an action and return an ``Action`` object representing it.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
action_name (str): Name of the action
|
|
187
|
+
source_uri (str): Source URI of the action
|
|
188
|
+
source_type (str): Source type of the action
|
|
189
|
+
action_type (str): The type of the action
|
|
190
|
+
description (str): Description of the action
|
|
191
|
+
status (str): Status of the action.
|
|
192
|
+
properties (dict): key/value properties
|
|
193
|
+
tags (dict): AWS tags for the action
|
|
194
|
+
sagemaker_session (sagemaker.session.Session): Session object which
|
|
195
|
+
manages interactions with Amazon SageMaker APIs and any other
|
|
196
|
+
AWS services needed. If not specified, one is created using the
|
|
197
|
+
default AWS configuration chain.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
Action: A SageMaker ``Action`` object.
|
|
201
|
+
"""
|
|
202
|
+
return super(Action, cls)._construct(
|
|
203
|
+
cls._boto_create_method,
|
|
204
|
+
action_name=action_name,
|
|
205
|
+
source=_api_types.ActionSource(source_uri=source_uri, source_type=source_type),
|
|
206
|
+
action_type=action_type,
|
|
207
|
+
description=description,
|
|
208
|
+
status=status,
|
|
209
|
+
properties=properties,
|
|
210
|
+
tags=tags,
|
|
211
|
+
sagemaker_session=sagemaker_session,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
@classmethod
|
|
215
|
+
def list(
|
|
216
|
+
cls,
|
|
217
|
+
source_uri: Optional[str] = None,
|
|
218
|
+
action_type: Optional[str] = None,
|
|
219
|
+
created_after: Optional[datetime] = None,
|
|
220
|
+
created_before: Optional[datetime] = None,
|
|
221
|
+
sort_by: Optional[str] = None,
|
|
222
|
+
sort_order: Optional[str] = None,
|
|
223
|
+
sagemaker_session: Session = None,
|
|
224
|
+
max_results: Optional[int] = None,
|
|
225
|
+
next_token: Optional[str] = None,
|
|
226
|
+
) -> Iterator[ActionSummary]:
|
|
227
|
+
"""Return a list of action summaries.
|
|
228
|
+
|
|
229
|
+
Args:
|
|
230
|
+
source_uri (str, optional): A source URI.
|
|
231
|
+
action_type (str, optional): An action type.
|
|
232
|
+
created_before (datetime.datetime, optional): Return actions created before this
|
|
233
|
+
instant.
|
|
234
|
+
created_after (datetime.datetime, optional): Return actions created after this instant.
|
|
235
|
+
sort_by (str, optional): Which property to sort results by.
|
|
236
|
+
One of 'SourceArn', 'CreatedBefore', 'CreatedAfter'
|
|
237
|
+
sort_order (str, optional): One of 'Ascending', or 'Descending'.
|
|
238
|
+
max_results (int, optional): maximum number of actions to retrieve
|
|
239
|
+
next_token (str, optional): token for next page of results
|
|
240
|
+
sagemaker_session (sagemaker.session.Session): Session object which
|
|
241
|
+
manages interactions with Amazon SageMaker APIs and any other
|
|
242
|
+
AWS services needed. If not specified, one is created using the
|
|
243
|
+
default AWS configuration chain.
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
collections.Iterator[ActionSummary]: An iterator
|
|
247
|
+
over ``ActionSummary`` objects.
|
|
248
|
+
"""
|
|
249
|
+
return super(Action, cls)._list(
|
|
250
|
+
"list_actions",
|
|
251
|
+
_api_types.ActionSummary.from_boto,
|
|
252
|
+
"ActionSummaries",
|
|
253
|
+
source_uri=source_uri,
|
|
254
|
+
action_type=action_type,
|
|
255
|
+
created_before=created_before,
|
|
256
|
+
created_after=created_after,
|
|
257
|
+
sort_by=sort_by,
|
|
258
|
+
sort_order=sort_order,
|
|
259
|
+
sagemaker_session=sagemaker_session,
|
|
260
|
+
max_results=max_results,
|
|
261
|
+
next_token=next_token,
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
def artifacts(
|
|
265
|
+
self, direction: LineageQueryDirectionEnum = LineageQueryDirectionEnum.BOTH
|
|
266
|
+
) -> List[Artifact]:
|
|
267
|
+
"""Use a lineage query to retrieve all artifacts that use this action.
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
direction (LineageQueryDirectionEnum, optional): The query direction.
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
list of Artifacts: Artifacts.
|
|
274
|
+
"""
|
|
275
|
+
query_filter = LineageFilter(entities=[LineageEntityEnum.ARTIFACT])
|
|
276
|
+
query_result = LineageQuery(self.sagemaker_session).query(
|
|
277
|
+
start_arns=[self.action_arn],
|
|
278
|
+
query_filter=query_filter,
|
|
279
|
+
direction=direction,
|
|
280
|
+
include_edges=False,
|
|
281
|
+
)
|
|
282
|
+
return [vertex.to_lineage_object() for vertex in query_result.vertices]
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class ModelPackageApprovalAction(Action):
|
|
286
|
+
"""An Amazon SageMaker model package approval action, which is part of a SageMaker lineage."""
|
|
287
|
+
|
|
288
|
+
def datasets(
|
|
289
|
+
self, direction: LineageQueryDirectionEnum = LineageQueryDirectionEnum.ASCENDANTS
|
|
290
|
+
) -> List[Artifact]:
|
|
291
|
+
"""Use a lineage query to retrieve all upstream datasets that use this action.
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
direction (LineageQueryDirectionEnum, optional): The query direction.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
list of Artifacts: Artifacts representing a dataset.
|
|
298
|
+
"""
|
|
299
|
+
query_filter = LineageFilter(
|
|
300
|
+
entities=[LineageEntityEnum.ARTIFACT], sources=[LineageSourceEnum.DATASET]
|
|
301
|
+
)
|
|
302
|
+
query_result = LineageQuery(self.sagemaker_session).query(
|
|
303
|
+
start_arns=[self.action_arn],
|
|
304
|
+
query_filter=query_filter,
|
|
305
|
+
direction=direction,
|
|
306
|
+
include_edges=False,
|
|
307
|
+
)
|
|
308
|
+
return [vertex.to_lineage_object() for vertex in query_result.vertices]
|
|
309
|
+
|
|
310
|
+
def model_package(self):
|
|
311
|
+
"""Get model package from model package approval action.
|
|
312
|
+
|
|
313
|
+
Returns:
|
|
314
|
+
Model package.
|
|
315
|
+
"""
|
|
316
|
+
source_uri = self.source.source_uri
|
|
317
|
+
if source_uri is None:
|
|
318
|
+
return None
|
|
319
|
+
|
|
320
|
+
model_package_name = source_uri.split("/")[1]
|
|
321
|
+
return self.sagemaker_session.sagemaker_client.describe_model_package(
|
|
322
|
+
ModelPackageName=model_package_name
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
def endpoints(
|
|
326
|
+
self, direction: LineageQueryDirectionEnum = LineageQueryDirectionEnum.DESCENDANTS
|
|
327
|
+
) -> List:
|
|
328
|
+
"""Use a lineage query to retrieve downstream endpoint contexts that use this action.
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
direction (LineageQueryDirectionEnum, optional): The query direction.
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
list of Contexts: Contexts representing an endpoint.
|
|
335
|
+
"""
|
|
336
|
+
query_filter = LineageFilter(
|
|
337
|
+
entities=[LineageEntityEnum.CONTEXT], sources=[LineageSourceEnum.ENDPOINT]
|
|
338
|
+
)
|
|
339
|
+
query_result = LineageQuery(self.sagemaker_session).query(
|
|
340
|
+
start_arns=[self.action_arn],
|
|
341
|
+
query_filter=query_filter,
|
|
342
|
+
direction=direction,
|
|
343
|
+
include_edges=False,
|
|
344
|
+
)
|
|
345
|
+
return [vertex.to_lineage_object() for vertex in query_result.vertices]
|