Skip to content

Commit d8a4f0a

Browse files
zaoliu-awsLiu
authored andcommitted
feature: Add test for profiler enablement with debugger_hook false (aws#3256)
Co-authored-by: Liu <[email protected]>
1 parent 244447c commit d8a4f0a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/integ/test_profiler.py

+41
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,44 @@ def test_mxnet_with_disable_profiler_then_enable_default_profiling(
433433

434434
job_description = mx.latest_training_job.describe()
435435
assert job_description["ProfilerConfig"]["S3OutputPath"] == mx.output_path
436+
437+
438+
def test_mxnet_profiling_with_disable_debugger_hook(
439+
sagemaker_session,
440+
mxnet_training_latest_version,
441+
mxnet_training_latest_py_version,
442+
cpu_instance_type,
443+
):
444+
with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
445+
script_path = os.path.join(DATA_DIR, "mxnet_mnist", "mnist_gluon.py")
446+
data_path = os.path.join(DATA_DIR, "mxnet_mnist")
447+
448+
mx = MXNet(
449+
entry_point=script_path,
450+
role="SageMakerRole",
451+
framework_version=mxnet_training_latest_version,
452+
py_version=mxnet_training_latest_py_version,
453+
instance_count=1,
454+
instance_type=cpu_instance_type,
455+
sagemaker_session=sagemaker_session,
456+
debugger_hook_config=False,
457+
)
458+
459+
train_input = mx.sagemaker_session.upload_data(
460+
path=os.path.join(data_path, "train"), key_prefix="integ-test-data/mxnet_mnist/train"
461+
)
462+
test_input = mx.sagemaker_session.upload_data(
463+
path=os.path.join(data_path, "test"), key_prefix="integ-test-data/mxnet_mnist/test"
464+
)
465+
466+
training_job_name = unique_name_from_base("test-profiler-mxnet-training")
467+
mx.fit(
468+
inputs={"train": train_input, "test": test_input},
469+
job_name=training_job_name,
470+
wait=False,
471+
)
472+
473+
job_description = mx.latest_training_job.describe()
474+
# setting debugger_hook_config to false would not disable profiling
475+
# https://docs.aws.amazon.com/sagemaker/latest/dg/debugger-turn-off.html
476+
assert job_description.get("ProfilingStatus") == "Enabled"

0 commit comments

Comments
 (0)