File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
src/sagemaker/hyperpod/common/telemetry
test/unit_tests/common/telemetry Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ def wrapper(*args, **kwargs):
160
160
duration = round (perf_counter () - start , 2 )
161
161
extra += f"&x-latency={ duration } "
162
162
_send_telemetry_request (
163
- Status .SUCCESS ,
163
+ STATUS_TO_CODE [ str ( Status .SUCCESS )] ,
164
164
[FEATURE_TO_CODE [str (feature )]],
165
165
None ,
166
166
None ,
@@ -172,7 +172,7 @@ def wrapper(*args, **kwargs):
172
172
duration = round (perf_counter () - start , 2 )
173
173
extra += f"&x-latency={ duration } "
174
174
_send_telemetry_request (
175
- Status .FAILURE ,
175
+ STATUS_TO_CODE [ str ( Status .FAILURE )] ,
176
176
[FEATURE_TO_CODE [str (feature )]],
177
177
None ,
178
178
str (e ),
Original file line number Diff line number Diff line change 17
17
import requests
18
18
import logging
19
19
20
+ from src .sagemaker .hyperpod .common .telemetry .telemetry_logging import STATUS_TO_CODE
21
+
20
22
# Test data
21
23
MOCK_CONTEXTS = {
22
24
"eks_arn" : "arn:aws:eks:us-west-2:123456789012:cluster/my-cluster" ,
@@ -163,7 +165,7 @@ def sample_function():
163
165
args = mock_telemetry .call_args [0 ]
164
166
165
167
# Check status
166
- assert args [0 ] == Status .SUCCESS
168
+ assert args [0 ] == STATUS_TO_CODE [ str ( Status .SUCCESS )]
167
169
168
170
# Check feature code
169
171
assert args [1 ] == [FEATURE_TO_CODE [str (Feature .HYPERPOD )]]
@@ -198,11 +200,11 @@ def sample_function(succeed: bool):
198
200
199
201
# Check success call
200
202
success_call = mock_telemetry .call_args_list [0 ]
201
- assert success_call [0 ][0 ] == Status .SUCCESS
203
+ assert success_call [0 ][0 ] == STATUS_TO_CODE [ str ( Status .SUCCESS )]
202
204
203
205
# Check failure call
204
206
failure_call = mock_telemetry .call_args_list [1 ]
205
- assert failure_call [0 ][0 ] == Status .FAILURE
207
+ assert failure_call [0 ][0 ] == STATUS_TO_CODE [ str ( Status .FAILURE )]
206
208
207
209
208
210
# Test _requests_helper
You can’t perform that action at this time.
0 commit comments