Skip to content

Commit

Permalink
added cas gateway optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
samyarpotlapalli committed Oct 18, 2024
1 parent 28774a8 commit 818d4c9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/sasctl/_services/score_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pathlib import Path
import json
from typing import Union
from typing import Union, Optional

from ..core import current_session, delete, get, sasctl_command, RestObj
from .cas_management import CASManagement
Expand Down Expand Up @@ -41,6 +41,7 @@ def create_score_definition(
score_def_name: str,
model: Union[str, dict],
table_name: str,
use_cas_gateway: Optional[bool] = False,
table_file: Union[str, Path] = None,
description: str = "",
server_name: str = "cas-shared-default",
Expand All @@ -57,6 +58,8 @@ def create_score_definition(
The name or id of the model, or a dictionary representation of the model.
table_name: str
A user-inputted table name in CAS Management.
use_cas_gateway: bool, optional
Determines whether object uses CAS Gateway or not.
table_file: str or Path, optional
A user-provided path to an uploadable file. Defaults to None.
description: str, optional
Expand All @@ -73,6 +76,12 @@ def create_score_definition(
RestObj
"""
# Changes object descriptor type to either use or not use CAS Gateway
object_descriptor_type: str
if use_cas_gateway:
object_descriptor_type = "sas.models.model.python"
else:
object_descriptor_type = "sas.models.model.ds2"

model = cls._model_repository.get_model(model)

Expand Down Expand Up @@ -120,12 +129,12 @@ def create_score_definition(
# Checks if the inputted table exists, and if not, uploads a file to create a new table

save_score_def = {
"name": score_def_name,
"name": model_name, # used to be score_def_name
"description": description,
"objectDescriptor": {
"uri": f"/modelManagement/models/{model_id}",
"name": f"{model_name}({model_version})",
"type": "sas.models.model.python",
"type": f"{object_descriptor_type}",
},
"inputData": {
"type": "CASTable",
Expand Down

0 comments on commit 818d4c9

Please sign in to comment.