@@ -926,6 +926,50 @@ def test_status_distributed(self, mock_get):
926926 headers = executor ._default_headers (token = "test_token" ),
927927 )
928928
929+ @patch ("requests.get" )
930+ def test_status_falls_back_to_phase_field (self , mock_get ):
931+ mock_response = MagicMock ()
932+ mock_response .status_code = 200
933+ mock_response .json .return_value = {"phase" : "Running" }
934+ mock_get .return_value = mock_response
935+
936+ with patch .object (DGXCloudExecutor , "get_auth_token" , return_value = "test_token" ):
937+ executor = DGXCloudExecutor (
938+ base_url = "https://dgxapi.example.com" ,
939+ kube_apiserver_url = "https://127.0.0.1:443" ,
940+ app_id = "test_app_id" ,
941+ app_secret = "test_app_secret" ,
942+ project_name = "test_project" ,
943+ container_image = "nvcr.io/nvidia/test:latest" ,
944+ pvc_nemo_run_dir = "/workspace/nemo_run" ,
945+ )
946+
947+ status = executor .status ("job123" )
948+
949+ assert status == DGXCloudState .RUNNING
950+
951+ @patch ("requests.get" )
952+ def test_status_returns_none_when_no_phase (self , mock_get ):
953+ mock_response = MagicMock ()
954+ mock_response .status_code = 200
955+ mock_response .json .return_value = {"someOtherField" : "value" }
956+ mock_get .return_value = mock_response
957+
958+ with patch .object (DGXCloudExecutor , "get_auth_token" , return_value = "test_token" ):
959+ executor = DGXCloudExecutor (
960+ base_url = "https://dgxapi.example.com" ,
961+ kube_apiserver_url = "https://127.0.0.1:443" ,
962+ app_id = "test_app_id" ,
963+ app_secret = "test_app_secret" ,
964+ project_name = "test_project" ,
965+ container_image = "nvcr.io/nvidia/test:latest" ,
966+ pvc_nemo_run_dir = "/workspace/nemo_run" ,
967+ )
968+
969+ status = executor .status ("job123" )
970+
971+ assert status is None
972+
929973 @patch ("requests.get" )
930974 def test_status_no_token (self , mock_get ):
931975 with patch .object (DGXCloudExecutor , "get_auth_token" , return_value = None ):
0 commit comments