Skip to content

Commit 7c64af7

Browse files
rsareddy0329Roja Reddy Sareddy
andauthored
fix: Update telemetry constants to include MLOPS as well (aws#5438)
* fix: Update telmetry constants to include MLOPS as well * fix: Update telmetry constants to include MLOPS as well * fix: Update telmetry constants to include MLOPS as well --------- Co-authored-by: Roja Reddy Sareddy <rsareddy@amazon.com>
1 parent 4686abf commit 7c64af7

8 files changed

Lines changed: 23 additions & 14 deletions

File tree

sagemaker-core/src/sagemaker/core/experiments/experiment.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from sagemaker.core.experiments.trial import _Trial
2222
from sagemaker.core.experiments.trial_component import _TrialComponent
2323
from sagemaker.core.common_utils import format_tags
24+
from sagemaker.core.telemetry.telemetry_logging import _telemetry_emitter
25+
from sagemaker.core.telemetry.constants import Feature
2426

2527

2628
class Experiment(_base_types.Record):
@@ -93,6 +95,7 @@ def load(cls, experiment_name, sagemaker_session=None):
9395
)
9496

9597
@classmethod
98+
@_telemetry_emitter(feature=Feature.MLOPS, func_name="experiment.create")
9699
def create(
97100
cls,
98101
experiment_name,

sagemaker-core/src/sagemaker/core/jumpstart/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ class CapabilityEnum(StrEnum):
398398
TRAINING = "TRAINING"
399399
FINE_TUNING = "FINE_TUNING"
400400
VALIDATION = "VALIDATION"
401+
INCREMENTAL_TRAINING = "INCREMENTAL_TRAINING"
401402

402403

403404
class DemoNotebookModel(BaseConfig):

sagemaker-core/src/sagemaker/core/telemetry/constants.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
class Feature(Enum):
2323
"""Enumeration of feature names used in telemetry."""
2424

25-
SDK_DEFAULTS = 1
26-
LOCAL_MODE = 2
27-
REMOTE_FUNCTION = 3
28-
MODEL_TRAINER = 4
29-
ESTIMATOR = 5
30-
HYPERPOD = 6 # Added to support telemetry in sagemaker-hyperpod-cli
31-
HYPERPOD_CLI = 7 # Added to support telemetry in sagemaker-hyperpod-cli
32-
MODEL_CUSTOMIZATION = 8
25+
SDK_DEFAULTS = 11
26+
LOCAL_MODE = 12
27+
REMOTE_FUNCTION = 13
28+
MODEL_TRAINER = 14
29+
MODEL_CUSTOMIZATION = 15
30+
MLOPS = 16
3331

3432
def __str__(self): # pylint: disable=E0307
3533
"""Return the feature name."""

sagemaker-core/src/sagemaker/core/telemetry/telemetry_logging.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
)
5151

5252
FEATURE_TO_CODE = {
53-
str(Feature.SDK_DEFAULTS): 1,
54-
str(Feature.LOCAL_MODE): 2,
55-
str(Feature.REMOTE_FUNCTION): 3,
56-
str(Feature.MODEL_TRAINER): 4,
57-
str(Feature.MODEL_CUSTOMIZATION): 8,
53+
str(Feature.SDK_DEFAULTS): 11,
54+
str(Feature.LOCAL_MODE): 12,
55+
str(Feature.REMOTE_FUNCTION): 13,
56+
str(Feature.MODEL_TRAINER): 14,
57+
str(Feature.MODEL_CUSTOMIZATION): 15,
58+
str(Feature.MLOPS): 16,
5859
}
5960

6061
STATUS_TO_CODE = {

sagemaker-core/tests/unit/telemetry/test_telemetry_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_telemetry_emitter_decorator_success(
155155
)
156156

157157
mock_send_telemetry_request.assert_called_once_with(
158-
1, [1, 2], MOCK_SESSION, None, None, expected_extra_str
158+
1, [11, 12], MOCK_SESSION, None, None, expected_extra_str
159159
)
160160

161161
@pytest.mark.skipif(

sagemaker-mlops/src/sagemaker/mlops/workflow/pipeline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
)
7070
from sagemaker.core.workflow.utilities import list_to_request
7171
from sagemaker.mlops.workflow._steps_compiler import StepsCompiler
72+
from sagemaker.core.telemetry.telemetry_logging import _telemetry_emitter
73+
from sagemaker.core.telemetry.constants import Feature
7274

7375
logger = logging.getLogger(__name__)
7476

@@ -139,6 +141,7 @@ def latest_pipeline_version_id(self):
139141
else:
140142
return summaries[0].get("PipelineVersionId")
141143

144+
@_telemetry_emitter(feature=Feature.MLOPS, func_name="pipeline.create")
142145
def create(
143146
self,
144147
role_arn: str = None,
@@ -348,6 +351,7 @@ def delete(self) -> Dict[str, Any]:
348351
)
349352
return self.sagemaker_session.sagemaker_client.delete_pipeline(PipelineName=self.name)
350353

354+
@_telemetry_emitter(feature=Feature.MLOPS, func_name="pipeline.start")
351355
def start(
352356
self,
353357
parameters: Dict[str, Union[str, bool, int, float]] = None,

sagemaker-mlops/tests/unit/workflow/test_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def mock_session():
2626
session.boto_session.client.return_value = Mock()
2727
session.sagemaker_client = Mock()
2828
session.local_mode = False
29+
session.sagemaker_config = {}
2930
return session
3031

3132

sagemaker-mlops/tests/unit/workflow/test_pipeline_class.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def mock_session():
3434
session.boto_session = Mock()
3535
session.boto_session.client = Mock(return_value=Mock())
3636
session.local_mode = False
37+
session.sagemaker_config = {}
3738
session._append_sagemaker_config_tags = Mock(return_value=[])
3839
return session
3940

0 commit comments

Comments
 (0)