44
55from pathlib import Path
66import json
7- from typing import Union
7+ from typing import Union , Optional
88
99from ..core import current_session , delete , get , sasctl_command , RestObj
1010from .cas_management import CASManagement
@@ -41,6 +41,7 @@ def create_score_definition(
4141 score_def_name : str ,
4242 model : Union [str , dict ],
4343 table_name : str ,
44+ use_cas_gateway : Optional [bool ] = False ,
4445 table_file : Union [str , Path ] = None ,
4546 description : str = "" ,
4647 server_name : str = "cas-shared-default" ,
@@ -57,6 +58,8 @@ def create_score_definition(
5758 The name or id of the model, or a dictionary representation of the model.
5859 table_name: str
5960 A user-inputted table name in CAS Management.
61+ use_cas_gateway: bool, optional
62+ Determines whether object uses CAS Gateway or not.
6063 table_file: str or Path, optional
6164 A user-provided path to an uploadable file. Defaults to None.
6265 description: str, optional
@@ -73,6 +76,12 @@ def create_score_definition(
7376 RestObj
7477
7578 """
79+ # Changes object descriptor type to either use or not use CAS Gateway
80+ object_descriptor_type : str
81+ if use_cas_gateway :
82+ object_descriptor_type = "sas.models.model.python"
83+ else :
84+ object_descriptor_type = "sas.models.model.ds2"
7685
7786 model = cls ._model_repository .get_model (model )
7887
@@ -120,12 +129,12 @@ def create_score_definition(
120129 # Checks if the inputted table exists, and if not, uploads a file to create a new table
121130
122131 save_score_def = {
123- "name" : score_def_name ,
132+ "name" : model_name , # used to be score_def_name
124133 "description" : description ,
125134 "objectDescriptor" : {
126135 "uri" : f"/modelManagement/models/{ model_id } " ,
127136 "name" : f"{ model_name } ({ model_version } )" ,
128- "type" : "sas.models.model.python " ,
137+ "type" : f" { object_descriptor_type } " ,
129138 },
130139 "inputData" : {
131140 "type" : "CASTable" ,
0 commit comments