@@ -902,101 +902,6 @@ def test_getResRequirements_invalid_tasks_per_node(self, mock_total_gpus):
902
902
)
903
903
self .assertIn ("tasks_per_node must be at least 1" , str (context .exception ))
904
904
905
- @patch .object (UnifiedInfo , "get_total_gpus_per_node" )
906
- @patch .object (UnifiedInfo , "get_cpus_per_node" )
907
- @patch .object (UnifiedInfo , "get_mem_per_node_MB" )
908
- def test_getArrayJobRequirements_single_gpu (
909
- self , mock_mem , mock_cpus , mock_total_gpus
910
- ):
911
- """Test getArrayJobRequirements with 1 GPU per task."""
912
- mock_total_gpus .return_value = 8
913
- mock_cpus .return_value = 192
914
- mock_mem .return_value = 1843200
915
-
916
- result = self .unified_info .get_array_job_requirements (
917
- partition = "test_partition" , gpus_per_task = 1
918
- )
919
-
920
- self .assertEqual (result .cpus_per_task , 24 ) # 192/8 = 24
921
- self .assertEqual (result .memory , "225G" ) # 1843200/8/1024 = 225GB
922
- self .assertEqual (result .tasks_per_node , 1 ) # Always 1 for array jobs
923
-
924
- @patch .object (UnifiedInfo , "get_total_gpus_per_node" )
925
- @patch .object (UnifiedInfo , "get_cpus_per_node" )
926
- @patch .object (UnifiedInfo , "get_mem_per_node_MB" )
927
- def test_getArrayJobRequirements_multiple_gpus (
928
- self , mock_mem , mock_cpus , mock_total_gpus
929
- ):
930
- """Test getArrayJobRequirements with multiple GPUs per task."""
931
- mock_total_gpus .return_value = 8
932
- mock_cpus .return_value = 192
933
- mock_mem .return_value = 1843200
934
-
935
- result = self .unified_info .get_array_job_requirements (
936
- partition = "test_partition" , gpus_per_task = 4
937
- )
938
-
939
- self .assertEqual (result .cpus_per_task , 96 ) # 192/8*4 = 96
940
- self .assertEqual (result .memory , "900G" ) # 1843200/8*4/1024 = 900GB
941
- self .assertEqual (result .tasks_per_node , 1 )
942
-
943
- @patch .object (UnifiedInfo , "get_total_gpus_per_node" )
944
- @patch .object (UnifiedInfo , "get_cpus_per_node" )
945
- @patch .object (UnifiedInfo , "get_mem_per_node_MB" )
946
- def test_getArrayJobRequirements_full_node (
947
- self , mock_mem , mock_cpus , mock_total_gpus
948
- ):
949
- """Test getArrayJobRequirements with all GPUs (full node per task)."""
950
- mock_total_gpus .return_value = 8
951
- mock_cpus .return_value = 192
952
- mock_mem .return_value = 1843200
953
-
954
- result = self .unified_info .get_array_job_requirements (
955
- partition = "test_partition" , gpus_per_task = 8
956
- )
957
-
958
- self .assertEqual (result .cpus_per_task , 192 ) # All CPUs
959
- self .assertEqual (result .memory , "1800G" ) # All memory: 1843200/1024 = 1800GB
960
- self .assertEqual (result .tasks_per_node , 1 )
961
-
962
- @patch .object (UnifiedInfo , "get_total_gpus_per_node" )
963
- @patch .object (UnifiedInfo , "get_cpus_per_node" )
964
- @patch .object (UnifiedInfo , "get_mem_per_node_MB" )
965
- def test_getArrayJobRequirements_4gpu_node (
966
- self , mock_mem , mock_cpus , mock_total_gpus
967
- ):
968
- """Test getArrayJobRequirements on a 4-GPU node configuration."""
969
- mock_total_gpus .return_value = 4
970
- mock_cpus .return_value = 64
971
- mock_mem .return_value = 524288
972
-
973
- result = self .unified_info .get_array_job_requirements (
974
- partition = "test_partition" , gpus_per_task = 2
975
- )
976
-
977
- self .assertEqual (result .cpus_per_task , 32 ) # 64/4*2 = 32
978
- self .assertEqual (result .memory , "256G" ) # 524288/4*2/1024 = 256GB
979
- self .assertEqual (result .tasks_per_node , 1 )
980
-
981
- @patch .object (UnifiedInfo , "get_total_gpus_per_node" )
982
- def test_getArrayJobRequirements_invalid_gpus_per_task (self , mock_total_gpus ):
983
- """Test getArrayJobRequirements raises ValueError for invalid gpus_per_task."""
984
- mock_total_gpus .return_value = 8
985
-
986
- # Test zero GPUs
987
- with self .assertRaises (ValueError ) as context :
988
- self .unified_info .get_array_job_requirements (
989
- partition = "test_partition" , gpus_per_task = 0
990
- )
991
- self .assertIn ("gpus_per_task must be between 1 and 8" , str (context .exception ))
992
-
993
- # Test more than max GPUs
994
- with self .assertRaises (ValueError ) as context :
995
- self .unified_info .get_array_job_requirements (
996
- partition = "test_partition" , gpus_per_task = 9
997
- )
998
- self .assertIn ("gpus_per_task must be between 1 and 8" , str (context .exception ))
999
-
1000
905
@patch .object (UnifiedInfo , "get_gpu_generation_and_count" )
1001
906
def test_get_total_gpus_per_node_with_gpus (self , mock_gpu_info ):
1002
907
"""Test get_total_gpus_per_node with actual GPU detection."""
0 commit comments