Skip to content

Commit b88c928

Browse files
samyarpotlapallismlindauer
authored andcommitted
added cas gateway optional parameter
1 parent 63c2068 commit b88c928

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/sasctl/_services/score_definitions.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pathlib import Path
66
import json
7-
from typing import Union
7+
from typing import Union, Optional
88

99
from ..core import current_session, delete, get, sasctl_command, RestObj
1010
from .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

Comments
 (0)