4
4
5
5
from pathlib import Path
6
6
import json
7
- from typing import Union
7
+ from typing import Union , Optional
8
8
9
9
from ..core import current_session , delete , get , sasctl_command , RestObj
10
10
from .cas_management import CASManagement
@@ -41,6 +41,7 @@ def create_score_definition(
41
41
score_def_name : str ,
42
42
model : Union [str , dict ],
43
43
table_name : str ,
44
+ use_cas_gateway : Optional [bool ] = False ,
44
45
table_file : Union [str , Path ] = None ,
45
46
description : str = "" ,
46
47
server_name : str = "cas-shared-default" ,
@@ -57,6 +58,8 @@ def create_score_definition(
57
58
The name or id of the model, or a dictionary representation of the model.
58
59
table_name: str
59
60
A user-inputted table name in CAS Management.
61
+ use_cas_gateway: bool, optional
62
+ Determines whether object uses CAS Gateway or not.
60
63
table_file: str or Path, optional
61
64
A user-provided path to an uploadable file. Defaults to None.
62
65
description: str, optional
@@ -73,6 +76,12 @@ def create_score_definition(
73
76
RestObj
74
77
75
78
"""
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"
76
85
77
86
model = cls ._model_repository .get_model (model )
78
87
@@ -120,12 +129,12 @@ def create_score_definition(
120
129
# Checks if the inputted table exists, and if not, uploads a file to create a new table
121
130
122
131
save_score_def = {
123
- "name" : score_def_name ,
132
+ "name" : model_name , # used to be score_def_name
124
133
"description" : description ,
125
134
"objectDescriptor" : {
126
135
"uri" : f"/modelManagement/models/{ model_id } " ,
127
136
"name" : f"{ model_name } ({ model_version } )" ,
128
- "type" : "sas.models.model.python " ,
137
+ "type" : f" { object_descriptor_type } " ,
129
138
},
130
139
"inputData" : {
131
140
"type" : "CASTable" ,
0 commit comments