@@ -453,14 +453,14 @@ def decorated_function(a, b, c=1, *, d, e, f=3):
453
453
454
454
def test_executor_invalid_arguments ():
455
455
with pytest .raises (ValueError ):
456
- with RemoteExecutor (max_parallel_job = 0 , s3_root_uri = "s3://bucket/" ) as e :
456
+ with RemoteExecutor (max_parallel_jobs = 0 , s3_root_uri = "s3://bucket/" ) as e :
457
457
e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
458
458
459
459
460
460
@patch ("sagemaker.remote_function.client._JobSettings" )
461
461
def test_executor_submit_after_shutdown (* args ):
462
462
with pytest .raises (RuntimeError ):
463
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as e :
463
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as e :
464
464
pass
465
465
e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
466
466
@@ -476,7 +476,7 @@ def test_executor_submit_happy_case(mock_start, mock_job_settings, parallelism):
476
476
mock_job_4 = create_mock_job ("job_4" , COMPLETED_TRAINING_JOB )
477
477
mock_start .side_effect = [mock_job_1 , mock_job_2 , mock_job_3 , mock_job_4 ]
478
478
479
- with RemoteExecutor (max_parallel_job = parallelism , s3_root_uri = "s3://bucket/" ) as e :
479
+ with RemoteExecutor (max_parallel_jobs = parallelism , s3_root_uri = "s3://bucket/" ) as e :
480
480
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
481
481
future_2 = e .submit (job_function , 5 , 6 , c = 7 , d = 8 )
482
482
future_3 = e .submit (job_function , 9 , 10 , c = 11 , d = 12 )
@@ -514,7 +514,7 @@ def test_executor_submit_with_run(mock_start, mock_job_settings, run_obj):
514
514
run_info = _RunInfo (run_obj .experiment_name , run_obj .run_name )
515
515
516
516
with run_obj :
517
- with RemoteExecutor (max_parallel_job = 2 , s3_root_uri = "s3://bucket/" ) as e :
517
+ with RemoteExecutor (max_parallel_jobs = 2 , s3_root_uri = "s3://bucket/" ) as e :
518
518
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
519
519
future_2 = e .submit (job_function , 5 , 6 , c = 7 , d = 8 )
520
520
@@ -530,7 +530,7 @@ def test_executor_submit_with_run(mock_start, mock_job_settings, run_obj):
530
530
assert future_1 .done ()
531
531
assert future_2 .done ()
532
532
533
- with RemoteExecutor (max_parallel_job = 2 , s3_root_uri = "s3://bucket/" ) as e :
533
+ with RemoteExecutor (max_parallel_jobs = 2 , s3_root_uri = "s3://bucket/" ) as e :
534
534
with run_obj :
535
535
future_3 = e .submit (job_function , 9 , 10 , c = 11 , d = 12 )
536
536
future_4 = e .submit (job_function , 13 , 14 , c = 15 , d = 16 )
@@ -556,7 +556,7 @@ def test_executor_submit_enforcing_max_parallel_jobs(mock_start, *args):
556
556
mock_job_2 = create_mock_job ("job_2" , INPROGRESS_TRAINING_JOB )
557
557
mock_start .side_effect = [mock_job_1 , mock_job_2 ]
558
558
559
- e = RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" )
559
+ e = RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" )
560
560
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
561
561
future_2 = e .submit (job_function , 5 , 6 , c = 7 , d = 8 )
562
562
@@ -588,7 +588,7 @@ def test_executor_fails_to_start_job(mock_start, *args):
588
588
589
589
mock_start .side_effect = [TypeError (), mock_job ]
590
590
591
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as e :
591
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as e :
592
592
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
593
593
future_2 = e .submit (job_function , 5 , 6 , c = 7 , d = 8 )
594
594
@@ -606,7 +606,7 @@ def test_executor_submit_and_cancel(mock_start, *args):
606
606
mock_job_2 = create_mock_job ("job_2" , INPROGRESS_TRAINING_JOB )
607
607
mock_start .side_effect = [mock_job_1 , mock_job_2 ]
608
608
609
- e = RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" )
609
+ e = RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" )
610
610
611
611
# submit first job and stay in progress
612
612
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
@@ -645,7 +645,7 @@ def test_executor_describe_job_throttled_temporarily(mock_start, *args):
645
645
]
646
646
mock_start .return_value = mock_job
647
647
648
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as e :
648
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as e :
649
649
# submit first job
650
650
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
651
651
# submit second job
@@ -663,7 +663,7 @@ def test_executor_describe_job_failed_permanently(mock_start, *args):
663
663
mock_job .describe .side_effect = RuntimeError ()
664
664
mock_start .return_value = mock_job
665
665
666
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as e :
666
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as e :
667
667
# submit first job
668
668
future_1 = e .submit (job_function , 1 , 2 , c = 3 , d = 4 )
669
669
# submit second job
@@ -695,7 +695,7 @@ def test_executor_describe_job_failed_permanently(mock_start, *args):
695
695
@patch ("sagemaker.remote_function.client._JobSettings" )
696
696
def test_executor_submit_invalid_function_args (mock_job_settings , args , kwargs , error_message ):
697
697
with pytest .raises (TypeError ) as e :
698
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as executor :
698
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as executor :
699
699
executor .submit (job_function , * args , ** kwargs )
700
700
assert error_message in str (e .value )
701
701
@@ -1063,7 +1063,7 @@ def test_executor_map_happy_case(mock_deserialized, mock_start, mock_job_setting
1063
1063
1064
1064
mock_deserialized .side_effect = [1 , 16 ]
1065
1065
1066
- with RemoteExecutor (max_parallel_job = 1 , s3_root_uri = "s3://bucket/" ) as executor :
1066
+ with RemoteExecutor (max_parallel_jobs = 1 , s3_root_uri = "s3://bucket/" ) as executor :
1067
1067
results = executor .map (job_function2 , [1 , 2 ], [3 , 4 ])
1068
1068
1069
1069
mock_start .assert_has_calls (
@@ -1095,7 +1095,7 @@ def test_executor_map_with_run(mock_deserialized, mock_start, mock_job_settings,
1095
1095
run_info = _RunInfo (run_obj .experiment_name , run_obj .run_name )
1096
1096
1097
1097
with run_obj :
1098
- with RemoteExecutor (max_parallel_job = 2 , s3_root_uri = "s3://bucket/" ) as executor :
1098
+ with RemoteExecutor (max_parallel_jobs = 2 , s3_root_uri = "s3://bucket/" ) as executor :
1099
1099
results_12 = executor .map (job_function2 , [1 , 2 ], [3 , 4 ])
1100
1100
1101
1101
mock_start .assert_has_calls (
@@ -1112,7 +1112,7 @@ def test_executor_map_with_run(mock_deserialized, mock_start, mock_job_settings,
1112
1112
1113
1113
mock_deserialized .side_effect = [1 , 16 ]
1114
1114
1115
- with RemoteExecutor (max_parallel_job = 2 , s3_root_uri = "s3://bucket/" ) as executor :
1115
+ with RemoteExecutor (max_parallel_jobs = 2 , s3_root_uri = "s3://bucket/" ) as executor :
1116
1116
with run_obj :
1117
1117
results_34 = executor .map (job_function2 , [1 , 2 ], [3 , 4 ])
1118
1118
0 commit comments