@@ -22,12 +22,12 @@ def _check_service_status():
2222 )
2323
2424
25- def _get_model_by_id_or_alias (model_id , kg_client , scope , use_cache = False ):
25+ def _get_model_by_id_or_alias (model_id , kg_client , release_status , use_cache = False ):
2626 try :
2727 model_id = UUID (model_id )
28- model_project = Model .from_uuid (str (model_id ), kg_client , scope = scope , use_cache = use_cache )
28+ model_project = Model .from_uuid (str (model_id ), kg_client , release_status = release_status , use_cache = use_cache )
2929 except ValueError :
30- model_project = Model .from_alias (model_id , kg_client , scope = scope )
30+ model_project = Model .from_alias (model_id , kg_client , release_status = release_status )
3131 if not model_project :
3232 raise HTTPException (
3333 status_code = status .HTTP_404_NOT_FOUND ,
@@ -37,26 +37,25 @@ def _get_model_by_id_or_alias(model_id, kg_client, scope, use_cache=False):
3737 return model_project
3838
3939
40- def _get_model_instance_by_id (instance_id , kg_client , scope ):
41- model_instance = ModelVersion .from_uuid (str (instance_id ), kg_client , scope = scope )
40+ def _get_model_instance_by_id (instance_id , kg_client , release_status ):
41+ model_instance = ModelVersion .from_uuid (str (instance_id ), kg_client , release_status = release_status )
4242 if model_instance is None :
4343 raise HTTPException (
4444 status_code = status .HTTP_404_NOT_FOUND ,
4545 detail = f"Model instance with ID '{ instance_id } ' not found." ,
4646 )
4747
48- model_project = Model .list (kg_client , scope = scope , has_versions = model_instance , use_cache = False )
48+ model_project = Model .list (kg_client , release_status = release_status , has_versions = model_instance )
4949 if not model_project :
5050 # we could get an empty response if the model_project has just been
5151 # updated and the KG is not consistent, so we wait and try again
5252 sleep (RETRY_INTERVAL )
53- model_project = Model .list (kg_client , scope = scope , has_versions = model_instance , use_cache = False )
53+ model_project = Model .list (kg_client , release_status = release_status , has_versions = model_instance )
5454 if not model_project :
5555 # try the service client
5656 kg_service_client = get_kg_client_for_service_account ()
57- model_project = Model .list (kg_service_client , scope = "in progress" , has_versions = model_instance , use_cache = False )
57+ model_project = Model .list (kg_service_client , release_status = "in progress" , has_versions = model_instance )
5858 if not model_project :
59- raise Exception ("foo" )
6059 # in case of a dangling model instance, where the parent model_project
6160 # has been deleted but the instance wasn't
6261 raise HTTPException (
@@ -67,13 +66,13 @@ def _get_model_instance_by_id(instance_id, kg_client, scope):
6766 return model_instance , model_project .uuid
6867
6968
70- def _get_test_by_id_or_alias (test_id , kg_client , scope ):
69+ def _get_test_by_id_or_alias (test_id , kg_client , release_status ):
7170 try :
7271 test_id = UUID (test_id )
7372 get_test = ValidationTest .from_uuid
7473 except ValueError :
7574 get_test = ValidationTest .from_alias
76- test_definition = get_test (str (test_id ), kg_client , scope = scope )
75+ test_definition = get_test (str (test_id ), kg_client , release_status = release_status )
7776 if not test_definition : # None or empty list
7877 raise HTTPException (
7978 status_code = status .HTTP_404_NOT_FOUND ,
@@ -88,8 +87,8 @@ def _get_test_by_id_or_alias(test_id, kg_client, scope):
8887 return test_definition
8988
9089
91- def _get_test_instance_by_id (instance_id , kg_client , scope ):
92- test_instance = ValidationTestVersion .from_uuid (str (instance_id ), kg_client , scope = scope )
90+ def _get_test_instance_by_id (instance_id , kg_client , release_status ):
91+ test_instance = ValidationTestVersion .from_uuid (str (instance_id ), kg_client , release_status = release_status )
9392 if test_instance is None :
9493 raise HTTPException (
9594 status_code = status .HTTP_404_NOT_FOUND ,
0 commit comments