2626@pytest .mark .dimensions ("ap-southeast-1" , "c5.xlarge" , "alinux" , "awsbatch" )
2727@pytest .mark .dimensions ("ap-northeast-1" , "m6g.xlarge" , "alinux2" , "awsbatch" )
2828@pytest .mark .usefixtures ("region" , "os" , "instance" , "scheduler" )
29- def test_awsbatch (pcluster_config_reader , clusters_factory , test_datadir , caplog ):
29+ def test_awsbatch (pcluster_config_reader , clusters_factory , test_datadir , caplog , region ):
3030 """
3131 Test all AWS Batch related features.
3232
@@ -38,33 +38,34 @@ def test_awsbatch(pcluster_config_reader, clusters_factory, test_datadir, caplog
3838 _assert_compute_instance_type_validation_successful (caplog )
3939 remote_command_executor = RemoteCommandExecutor (cluster )
4040
41- _test_simple_job_submission (remote_command_executor , test_datadir )
41+ timeout = 120 if region .startswith ("cn-" ) else 60 # Longer timeout in china regions due to less reliable networking
42+ _test_simple_job_submission (remote_command_executor , test_datadir , timeout )
4243 _test_array_submission (remote_command_executor )
4344 _test_mnp_submission (remote_command_executor , test_datadir )
44- _test_job_kill (remote_command_executor )
45+ _test_job_kill (remote_command_executor , timeout )
4546
4647
47- def _test_simple_job_submission (remote_command_executor , test_datadir ):
48+ def _test_simple_job_submission (remote_command_executor , test_datadir , timeout ):
4849 logging .info ("Testing inline submission." )
49- _test_job_submission (remote_command_executor , "awsbsub --vcpus 2 --memory 256 --timeout 60 sleep 1" )
50+ _test_job_submission (remote_command_executor , f "awsbsub --vcpus 2 --memory 256 --timeout { timeout } sleep 1" )
5051
5152 # FIXME: uncomment once this bug is fixed
5253 # logging.info("Testing inline submission with env.")
5354 # _test_job_submission(
5455 # remote_command_executor,
55- # 'export TEST=test && awsbsub --vcpus 2 --memory 256 --timeout 60 -e TEST "env | grep TEST=test"',
56+ # f 'export TEST=test && awsbsub --vcpus 2 --memory 256 --timeout {timeout} -e TEST "env | grep TEST=test"',
5657 # )
5758
5859 logging .info ("Testing stdin submission with env" )
5960 _test_job_submission (
6061 remote_command_executor ,
61- 'export TEST=test && echo "env | grep TEST=test" | awsbsub --vcpus 2 --memory 256 --timeout 60 -e TEST' ,
62+ f 'export TEST=test && echo "env | grep TEST=test" | awsbsub --vcpus 2 --memory 256 --timeout { timeout } -e TEST' ,
6263 )
6364
6465 logging .info ("Testing command file with env" )
6566 _test_job_submission (
6667 remote_command_executor ,
67- "export TEST=test && awsbsub --vcpus 2 --memory 256 --timeout 60 -e TEST -cf test_simple_job.sh" ,
68+ f "export TEST=test && awsbsub --vcpus 2 --memory 256 --timeout { timeout } -e TEST -cf test_simple_job.sh" ,
6869 [str (test_datadir / "test_simple_job.sh" )],
6970 )
7071
@@ -84,10 +85,10 @@ def _test_mnp_submission(remote_command_executor, test_datadir):
8485 )
8586
8687
87- def _test_job_kill (remote_command_executor ):
88+ def _test_job_kill (remote_command_executor , timeout ):
8889 logging .info ("Testing job kill." )
8990 awsbatch_commands = AWSBatchCommands (remote_command_executor )
90- result = remote_command_executor .run_remote_command ("awsbsub --vcpus 2 --memory 256 --timeout 60 sleep 300" )
91+ result = remote_command_executor .run_remote_command (f "awsbsub --vcpus 2 --memory 256 --timeout { timeout } sleep 300" )
9192 job_id = awsbatch_commands .assert_job_submitted (result .stdout )
9293
9394 remote_command_executor .run_remote_command ("awsbkill {0}" .format (job_id ))
0 commit comments