sagemaker.core.deprecations#
Module for deprecation abstractions.
Functions
|
Decorator for raising deprecated warning for a feature in sagemaker>=2 |
|
Returns a class based on super class with a deprecation warning. |
|
Modifies a deserializer instance deserialize method. |
|
Wrap a function with a deprecation warning. |
|
Modifies a serializer instance serialize method. |
|
Raise a warning for soon to be deprecated feature in sagemaker>=2 |
Raise a warning for soon to be deprecated feature in sagemaker>=2 |
|
|
Decorator for raising deprecation warning for a feature in sagemaker>=2 |
|
Warn and then raise an actionable error for a v2 module removed in v3. |
Install the fallback finder for removed v2 modules (idempotent). |
|
|
Checks if the deprecated argument is populated. |
|
A no-op deprecated function factory. |
|
Checks if the deprecated argument is in kwargs |
|
Raise a warning for a no-op in sagemaker>=2 |
|
Checks if the deprecated argument is in kwargs |
|
Raise a warning for a rename in sagemaker>=2 |
- sagemaker.core.deprecations.deprecated(sdk_version=None)[source]#
Decorator for raising deprecated warning for a feature in sagemaker>=2
- Parameters:
sdk_version (str) – the sdk version of removal of support.
- Usage:
@deprecated() def sample_function():
print(“xxxx….”)
@deprecated(sdk_version=”2.66”) class SampleClass():
- def __init__(self):
print(“xxxx….”)
- sagemaker.core.deprecations.deprecated_class(cls, name)[source]#
Returns a class based on super class with a deprecation warning.
- Parameters:
cls – The class to derive with a deprecation warning on __init__
name – The name of the class.
- Returns:
The modified class.
- sagemaker.core.deprecations.deprecated_deserialize(instance, name)[source]#
Modifies a deserializer instance deserialize method.
- Parameters:
instance – Instance to modify deserialize method.
name – The name that has been deprecated.
- Returns:
The modified instance
- sagemaker.core.deprecations.deprecated_function(func, name)[source]#
Wrap a function with a deprecation warning.
- Parameters:
func – Function to wrap in a deprecation warning.
name – The name that has been deprecated.
- Returns:
The modified function
- sagemaker.core.deprecations.deprecated_serialize(instance, name)[source]#
Modifies a serializer instance serialize method.
- Parameters:
instance – Instance to modify serialize method.
name – The name that has been deprecated.
- Returns:
The modified instance
- sagemaker.core.deprecations.deprecation_warn(name, date, msg=None)[source]#
Raise a warning for soon to be deprecated feature in sagemaker>=2
- Parameters:
name (str) – Name of the feature
date (str) – the date when the feature will be deprecated
msg (str) – the prefix phrase of the warning message.
- sagemaker.core.deprecations.deprecation_warn_base(msg)[source]#
Raise a warning for soon to be deprecated feature in sagemaker>=2
- Parameters:
msg (str) – the warning message.
- sagemaker.core.deprecations.deprecation_warning(date, msg=None)[source]#
Decorator for raising deprecation warning for a feature in sagemaker>=2
- Parameters:
date (str) – the date when the feature will be deprecated
msg (str) – the prefix phrase of the warning message.
- Usage:
@deprecation_warning(msg=”message”, date=”date”) def sample_function():
print(“xxxx….”)
@deprecation_warning(msg=”message”, date=”date”) class SampleClass():
- def __init__(self):
print(“xxxx….”)
- sagemaker.core.deprecations.raise_removed_in_v3(module, replacement=None, v3_import=None, v3_docs=None)[source]#
Warn and then raise an actionable error for a v2 module removed in v3.
The v2 SDK exposed top-level modules (e.g.
sagemaker.estimator) that no longer exist in v3. Importing one would otherwise fail with a bareModuleNotFoundError: No module named 'sagemaker.estimator'that gives the caller no path forward. This helper is called from_RemovedV2ModuleFinderfor removed names: it emits aDeprecationWarningand then raises aModuleNotFoundErrorwhose message names the exact v3 replacement, the import to copy-paste, and a direct link to that replacement’s API docs (plus the migration guide).- Parameters:
module (str) – The removed v2 module path, e.g.
"sagemaker.estimator".replacement (str) – Human readable v3 replacement, e.g.
"ModelTrainer". Optional.v3_import (str) – The exact v3 import statement, e.g.
"from sagemaker.train import ModelTrainer". Quoted verbatim so the caller can copy-paste it. Optional.v3_docs (str) – Direct URL to the v3 replacement’s API documentation, e.g. the generated
sagemaker.train.model_trainerpage. Optional.
- Raises:
ModuleNotFoundError – always, after emitting the deprecation warning.
- sagemaker.core.deprecations.register_removed_module_finder()[source]#
Install the fallback finder for removed v2 modules (idempotent).
Appends a single
_RemovedV2ModuleFindertosys.meta_pathso it acts as a last resort. Safe to call multiple times – it installs at most one instance per process.
- sagemaker.core.deprecations.removed_arg(name, arg)[source]#
Checks if the deprecated argument is populated.
Raises warning, if not None.
- Parameters:
name – name of deprecated argument
arg – the argument to check
- sagemaker.core.deprecations.removed_kwargs(name, kwargs)[source]#
Checks if the deprecated argument is in kwargs
Raises warning, if present.
- Parameters:
name – name of deprecated argument
kwargs – keyword arguments dict
- sagemaker.core.deprecations.removed_warning(phrase, sdk_version=None)[source]#
Raise a warning for a no-op in sagemaker>=2
- Parameters:
phrase – the prefix phrase of the warning message.
sdk_version – the sdk version of removal of support.
- sagemaker.core.deprecations.renamed_kwargs(old_name, new_name, value, kwargs)[source]#
Checks if the deprecated argument is in kwargs
Raises warning, if present.
- Parameters:
old_name – name of deprecated argument
new_name – name of the new argument
value – value associated with new name, if supplied
kwargs – keyword arguments dict
- Returns:
value of the keyword argument, if present