Python package and CLI for user-friendly integration with SAS Viya

Overview

sasctl

A user-friendly Python interface for SAS Viya.

SAS Viya Version Python Version
Full documentation: https://sassoftware.github.io/python-sasctl

Table of Contents

  1. Overview
  2. Prerequisites
  3. Installation
  4. Getting Started
  5. Examples
  6. Contributing
  7. License
  8. Additional Resources

Overview

The sasctl package enables easy communication between the SAS Viya platform and a Python runtime. It can be used as a module or as a command line interface.

sasctl.folders.list_folders()
sasctl folders list

Prerequisites

sasctl requires the following Python packages be installed. If not already present, these packages will be downloaded and installed automatically.

  • requests
  • pyyaml

The following additional packages are recommended for full functionality:

  • swat
  • kerberos

Installation

Installing the latest version is as easy as:

pip install sasctl

Functionality that depends on additional packages can be installed using the following:

  • pip install sasctl[swat]
  • pip install sasctl[kerberos]
  • pip install sasctl[all]

If you want the latest functionality and can't wait on an official release, you can also install the latest source code:

pip install git+https://github.com/sassoftware/python-sasctl

Getting Started

Once the sasctl package has been installed and you have a SAS Viya server to connect to, the first step is to establish a session:

>>> from sasctl import Session

>>> with Session(host, username, password):
...     pass  # do something
sasctl --help 

Once a session has been created, all commands target that environment. The easiest way to use sasctl is often to use a pre-defined task, which can handle all necessary communication with the SAS Viya server:

>>> from sasctl import Session, register_model
>>> from sklearn import linear_model as lm

>>> with Session('example.com', authinfo=
   
    ):
...    model = lm.LogisticRegression()
...    register_model(model, 'Sklearn Model', 'My Project')

   

A slightly more low-level way to interact with the environment is to use the service methods directly:

>>> from sasctl import Session
>>> from sasctl.services import folders

>>> with Session(host, username, password):
...    for f in folders.list_folders():
...        print(f)

Public
Projects
ESP Projects
Risk Environments

...  # truncated for clarity

My Folder
My History
My Favorites
SAS Environment Manager

The most basic way to interact with the server is simply to call REST functions directly, though in general, this is not recommended.

>>> from pprint import pprint
>>> from sasctl import Session, get

>>> with Session(host, username, password):
...    folders = get('/folders')
...    pprint(folders)
    
{'links': [{'href': '/folders/folders',
            'method': 'GET',
            'rel': 'folders',
            'type': 'application/vnd.sas.collection',
            'uri': '/folders/folders'},
           {'href': '/folders/folders',
            'method': 'POST',
            'rel': 'createFolder',

...  # truncated for clarity

            'rel': 'createSubfolder',
            'type': 'application/vnd.sas.content.folder',
            'uri': '/folders/folders?parentFolderUri=/folders/folders/{parentId}'}],
 'version': 1}

Examples

A few simple examples of common scenarios are listed below. For more complete examples see the examples folder.

Show models currently in Model Manager:

>>> from sasctl import Session
>>> from sasctl.services import model_repository

>>> with Session(host, username, password):
...    models = model_repository.list_models()

Register a pure Python model in Model Manager:

>>> from sasctl import Session, register_model
>>> from sklearn import linear_model as lm

>>> with Session(host, authinfo=
   
    ):
...    model = lm.LogisticRegression()
...    register_model(model, 'Sklearn Model', 'My Project')

   

Register a CAS model in Model Manager:

>>> import swat
>>> from sasctl import Session
>>> from sasctl.tasks import register_model

>>> s = swat.CAS(host, authinfo=
   
    )
>>> astore = s.CASTable('some_astore')

>>> with Session(s):
...    register_model(astore, 'SAS Model', 'My Project')

   

Contributing

We welcome contributions!

Please read CONTRIBUTING.md for details on how to submit contributions to this project.

License

See the LICENSE file for details.

Additional Resources

Comments
  • Issue pushing swat CAS Python Model to SAS Model Manager using sasctl

    Issue pushing swat CAS Python Model to SAS Model Manager using sasctl

    Describe the issue I created a model in Python in JupyterHub using cas and swat. When attempting to push the model from JupyterHub to SAS Model Manager using sasctl I am receiving the following error: HTTP Error 422. I do get the following success before receiving the error: NOTE: Cloud Analytic Services saved the file _C7E01D4A82C44B3B94567BF95.sashdat in caslib ModelStore. Then I receive the HTTP Error 422.

    I am able to register the model via a workaround using sas code similar to the following: %mm_get_project_id(projectNm=%str(TS_7613611429), projectLoc=%str(Public), idvar=myProjID); %mm_import_astore_model(locationID=%str(&myprojID), modelname=%str(Model2forKirsten), modeldesc=%str(), rstore=MSTORE._C7E01D4A82C44B3B94567BF95);

    To Reproduce Please see attached file CAS Python HMEQ to SAS MM.

    Expected behavior I expect a new project to be created in Model Manager and my Python model to be loaded into the project without needing to write sas code (register the model directly from jupyterhub).

    Stack Trace ---> 10 model = register_model(astore_gb, 'HMEQ_Test_KC', 'Python_HMEQ_KC', force=True)

    /opt/anaconda3/lib/python3.8/site-packages/sasctl/tasks.py in register_model(model, name, project, repository, input, version, files, force, record_packages) 314 project = _create_project(project, model_props, repo_obj, invar, outvar) 315

    --> 316 model = mr.import_model_from_zip(name, project, zipfile, version=version) 317 return model 318

    /opt/anaconda3/lib/python3.8/site-packages/sasctl/_services/model_repository.py in import_model_from_zip(cls, name, project, file, description, version) 525 params = "&".join("{}={}".format(k, v) for k, v in params.items()) 526 --> 527 r = cls.post( 528 "/models#octetStream", 529 data=file.read(),

    /opt/anaconda3/lib/python3.8/site-packages/sasctl/_services/service.py in post(cls, *args, **kwargs) 111 def post(cls, *args, **kwargs): 112 """Send a POST request.""" --> 113 return cls.request("post", *args, **kwargs) ... -> 1630 raise HTTPError( 1631 response.url, response.status_code, response.text, response.headers, None 1632 )

    HTTPError: HTTP Error 422: {"links":[{"method":"GET","rel":"self","href":"/modelRepository/models?start=0&limit=1","uri":"/modelRepository/models?start=0&limit=1","type":"application/vnd.sas.collection","itemType":"application/vnd.sas.models.model.summary"},{"method":"POST","rel":"createModel","href":"/modelRepository/models","uri":"/modelRepository/models","type":"application/vnd.sas.models.model","responseType":"application/vnd.sas.models.model"}],"name":"models","start":0,"count":1,"items":[{"errorCode":0,"message":"","links":[],"version":2,"httpStatusCode":422}],"limit":1,"version":2}

    Version I am trying to push to a Viya 4 environment running 2022.1.2. I am using the following version of sasctl: 1.7.2

    CAS Python HMEQ to SAS MM.zip

    bug 
    opened by kichil 11
  • Pickle file path issue in Viya 3.5

    Pickle file path issue in Viya 3.5

    Describe the issue The python model is not able to locate the pickle file post registration in SAS Model Manager in SAS Viya 3.5. As a result of that, the model is not able to score data.

    To Reproduce Just use the example listed pzmmModelImportExample and register the final models in a Viya 3.5 image.

    Expected behavior I checked the *score.py file in model manager to check the path of the pickle file on the server and post that logged into the server to check the path there as well. On the server I was able to see a path(symlink) for astore files but nothing for pickle files. I am assuming a similar path should exist for pickle files as well. Refer screenshots for details.

    Stack Trace If you're experiencing an exception, include the full stack trace and error message.

    Version What version of sasctl are you using? 1.7.1

    pzmm_error.docx

    bug 
    opened by andysas 10
  • Add methods to CAS Management

    Add methods to CAS Management

    Hello, I noticed that some methods are missing from the CAS Management service. I am thinking of adding the following for starters

    • [x] list/create/delete sessions
    • [x] load or unload a table
    • [x] save a table
    • [x] change scope of table

    with related tests as well:

    • [x] list/create/delete sessions
    • [x] load or unload a table
    • [x] save a table
    • [x] change scope of table

    Any suggestion/feedback is highly appreciated.

    Question/curiosity: is there a reason why f-strings are not used?

    Signed-off-by: Stefano Silvestri [email protected]

    opened by SilvestriStefano 8
  • Registering model with sasctl on sas model manager --> AttributeError: 'str' object has no attribute 'read'

    Registering model with sasctl on sas model manager --> AttributeError: 'str' object has no attribute 'read'

    Describe the issue I am not able to register a decision tree model on SAS model manager using sasctl library for python

    To Reproduce Libreries import pandas as pd import numpy as np from sasctl import Session, register_model, publish_model from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier import getpass from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, log_loss import os

    Dataset importing dataset = pd.read_csv('*********',sep = '|',low_memory=False)

    Some preprocessing dataset.fillna({'HUMIDITY':0, 'TEMPERATURE':0, 'PIROMETER':0, 'WINDDIR':0, 'WINDVEL':0, 'position':'other'},inplace=True)

    Model predictorColumns = ['HUMIDITY', 'TEMPERATURE', 'PIROMETER', 'WINDDIR', 'WINDVEL']

    targetColumn = 'position' x = dataset[predictorColumns] y = dataset[targetColumn]

    xTrain, xTest, yTrain, yTest = train_test_split(x, y, test_size=0.5, random_state=42)

    treeModel = DecisionTreeClassifier(random_state=42) treeModel = treeModel.fit(xTrain, yTrain)

    y_pred_proba_test = treeModel.predict_proba(xTest) y_pred_test = treeModel.predict(xTest)

    Model registration with Session(hostname="*****", username="**", password="*******",verify_ssl=False):

    register_model(model = treeModel,
                   name = "treeModel",
                   input = x,         
                   project = "progetto_prova",
                   force=True)
    

    Expected behavior I expect a model to be created on sas model manager, into the project "progetto_prova"

    Stack Trace AttributeError Traceback (most recent call last) in 2 3 # Register the model in Model Manager ----> 4 register_model(model = treeModel, 5 name = "treeModel", 6 input = x,

    ~\Anaconda3\lib\site-packages\sasctl-1.6.3-py3.8.egg\sasctl\tasks.py in register_model(model, name, project, repository, input, version, files, force, record_packages) 427 for file in files: 428 if isinstance(file, dict): --> 429 mr.add_model_content(model, **file) 430 else: 431 mr.add_model_content(model, file)

    ~\Anaconda3\lib\site-packages\sasctl-1.6.3-py3.8.egg\sasctl_services\model_repository.py in add_model_content(cls, model, file, name, role, content_type) 404 files = {name: (name, file, content_type)} 405 else: --> 406 files = {name: file.read()} 407 408 metadata = {'role': role, 'name': name}

    AttributeError: 'str' object has no attribute 'read'

    Version sasctl 1.6.3

    bug 
    opened by kotio92 7
  • Failed to install sasctl correctly

    Failed to install sasctl correctly

    Describe the issue I have Python 3.6.8 on redhat 7.x. After I run pip3 to install sasctl, I got error when issue sasctl --help. The error message is: Traceback (most recent call last): File "/usr/local/bin/sasctl", line 6, in from sasctl.utils.cli import main ModuleNotFoundError: No module named 'sasctl.utils'

    When I looked into a possible issue. I found sasctl is installed under /usr/local/lib/python3.6/site-packages/ with job package, and others like scipy and sklearn were installed under /usr/local/lib64/python3.6/site-packages. BUT I don't know whether that is the root issue.

    To Reproduce sudo pip3 install sasctl sasctl

    bug 
    opened by zhaojohn 7
  • register_model raised SWATCASActionError

    register_model raised SWATCASActionError

    I was following the astore_example.py example in the example folder and ran into an error when trying to register a gradient boosting model. The error message was SWATCASActionError: The action was not successful. I also called swat.astore.describe(model) to make sure that the model itself exists. Do you have any suggestions for troubleshooting? Thank you.

    opened by RobinLiuGP 7
  • Problem with

    Problem with "import_model_from_zip"

    HmeqDecTreev3.zip

    Hi I'm trying to import Python model into ModelManager using sasctl package. Attached is my notebook which is based on the example published here. In the last step when import_model_from_zip is executed I'm getting a syntax like error saying that project parameter is not defined? I thing my code in this block is 1:1 comparing to the published example. I'd be grateful for advice how to correct my error, please Regards Ziggy

    bug question 
    opened by zwyszomi 6
  • Is it possible to specify the location as we create a project in a given model repository?

    Is it possible to specify the location as we create a project in a given model repository?

    Is your feature request related to a problem? Please describe. As to our understanding, the user can specify a location as creating a project on SAS Model Manager via either REST API or browser GUI as shown in the following two figures. With checking out the usage and source code of create_project method, it seems the method is unable to support this feature. In our customer’s scenario, it is pretty critical to achieve that via sasctl package.

    figure1

    figure2

    Describe the solution you'd like To create a model manager project and meanwhile specify its location to save.

    enhancement 
    opened by ownway22 4
  • PZMM option to inject pickle file as binary string reducing file management

    PZMM option to inject pickle file as binary string reducing file management

    PZMM registering a python model references a pickle file. This requires sharing management of the python code and pickle file. IT would be nice to have an option when registering to binary inject the pickle content into the python code so SAS MM does not need to management multiple files (technically SAS MM will just handle the code completely so extra work is not needed). Can we add option for this?

    enhancement 
    opened by jameskochubasas 4
  • Manual updates required when working with SAS Model Manager

    Manual updates required when working with SAS Model Manager

    I'm using sasctl-pzmm with SAS Model Manager (15.3). I have some comments regarding the scoring code generation by ScoreCode(). Even though I'm mentioning MM, the errors are reported within the pure Python environment (during the Scoring Test I have extracted the scoring code from MM environment and have run in Python to separate any MM impact). Attached is the summary of my findings, together with my source code and required manual modifications of the Python score code generated by ScoreCode() to execute successfully the Scoring Test by SAS MM

    sasctl-pzmm.zip

    Regards Ziggy

    bug 
    opened by zwyszomi 4
  • sasctl connect issue with Viya

    sasctl connect issue with Viya

    with Session('XXXXXX', 'sas', 'XXXXXX'): ... pass # do something

    Getting below ERROR when I try to assign a session:


    SSLCertVerificationError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 599 body=body, headers=headers, --> 600 chunked=chunked) 601

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 342 try: --> 343 self._validate_conn(conn) 344 except (SocketTimeout, BaseSSLError) as e:

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn) 838 if not getattr(conn, 'sock', None): # AppEngine might not have .sock --> 839 conn.connect() 840

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py in connect(self) 343 server_hostname=server_hostname, --> 344 ssl_context=context) 345

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir) 359 --> 360 return context.wrap_socket(sock) 361

    C:\ProgramData\Anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 422 context=self, --> 423 session=session 424 )

    C:\ProgramData\Anaconda3\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 869 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") --> 870 self.do_handshake() 871 except (OSError, ValueError):

    C:\ProgramData\Anaconda3\lib\ssl.py in do_handshake(self, block) 1138 self.settimeout(None) -> 1139 self._sslobj.do_handshake() 1140 finally:

    SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)

    During handling of the above exception, another exception occurred:

    MaxRetryError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 448 retries=self.max_retries, --> 449 timeout=timeout 450 )

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 637 retries = retries.increment(method, url, error=e, _pool=self, --> 638 _stacktrace=sys.exc_info()[2]) 639 retries.sleep()

    C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 398 if new_retry.is_exhausted(): --> 399 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 400

    MaxRetryError: HTTPSConnectionPool(host='10.225.193.28', port=443): Max retries exceeded with url: /SASLogon/oauth/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')))

    During handling of the above exception, another exception occurred:

    SSLError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 439 proxies, hooks, stream, verify, --> 440 cert, json) 441 except requests.exceptions.SSLError as e:

    C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 532 send_kwargs.update(settings) --> 533 resp = self.send(prep, **send_kwargs) 534

    C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in send(self, request, **kwargs) 406 --> 407 response = super(Session, self).send(request, **kwargs) 408

    C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs) 645 # Send the request --> 646 r = adapter.send(request, **kwargs) 647

    C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 513 # This branch is for urllib3 v1.22 and later. --> 514 raise SSLError(e, request=request) 515

    SSLError: HTTPSConnectionPool(host='10.225.193.28', port=443): Max retries exceeded with url: /SASLogon/oauth/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')))

    During handling of the above exception, another exception occurred:

    RuntimeError Traceback (most recent call last) in ----> 1 with Session('10.225.193.28', 'sas', 'Growth17'): 2 pass # do something

    C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in init(self, hostname, username, password, authinfo, protocol, port, verify_ssl) 329 330 self.verify = verify_ssl --> 331 self.auth = HTTPBearerAuth(self.get_token()) 332 333 if current_session() is None:

    C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in get_token(self) 585 return self._get_token_with_kerberos() 586 else: --> 587 return self._get_token_with_password() 588 589 def _build_url(self, url):

    C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in _get_token_with_password(self) 555 data=data, 556 headers=headers, --> 557 auth=('sas.ec', '')) 558 559 if r.status_code == 401:

    C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in post(self, url, data, json, **kwargs) 579 """ 580 --> 581 return self.request('POST', url, data=data, json=json, **kwargs) 582 583 def put(self, url, data=None, **kwargs):

    C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 442 if 'REQUESTS_CA_BUNDLE' not in os.environ: 443 raise RuntimeError( --> 444 "SSL handshake failed. The 'REQUESTS_CA_BUNDLE' " 445 "environment variable should contain the path to the CA " 446 "certificate. Alternatively, set verify_ssl=False to "

    RuntimeError: SSL handshake failed. The 'REQUESTS_CA_BUNDLE' environment variable should contain the path to the CA certificate. Alternatively, set verify_ssl=False to disable certificate verification.

    bug 
    opened by venkattoluchuri 4
  • parameters 'input' is not working in function execute_model_workflow_definition

    parameters 'input' is not working in function execute_model_workflow_definition

    When our team using the function 'execute_model_workflow_definition' according to this https://sassoftware.github.io/python-sasctl/_modules/sasctl/_services/model_management.html#ModelManagement.execute_model_workflow_definition

    We found that the 'input' variable is not working, which means whatever we put input this parameter, it will not show in workflow.

    To Reproduce the running python code as below r = mm.execute_model_workflow_definition(project_name=MODELNAME,workflow_name="Deploy_workflow",input=dict({'PE':'test'}))

    The running variable as below image

    bug 
    opened by staceychan 1
  • tasks.register_model function incorrectly allows users to import Python models to SAS Viya 4

    tasks.register_model function incorrectly allows users to import Python models to SAS Viya 4

    Describe the issue As seen in issue #136, when attempting to import a Python model with register_model() to SAS Viya 4, the normal process for SAS Viya 3.5 is used which produces a DS2 wrapped version of the Python model. This approach is not valid in SAS Viya 4, as SAS Model Manager creates the DS2 wrapper when publishing or scoring the model.

    To Reproduce Follow any of the example scripts that use register_model() to import a Python model.

    Expected behavior python-sasctl should be checking against the version of SAS Viya that register_model is attempting to import to. If a Python model is detected and SAS Viya 4 is detected, an error should be produced stating that this function cannot import models into SAS Viya 4 successfully.

    Version 1.7.3

    bug 
    opened by smlindauer 0
  • Error using SASCTL to register a Python model to MM in Viya 4

    Error using SASCTL to register a Python model to MM in Viya 4

    Describe the issue SASCTL 1.7.3 can register a simple Python model to MM in Viya 4, but when trying to execute a Scoring Task it produces an error.

    To Reproduce import pandas as pd from sasctl import Session, register_model, publish_model from sklearn.linear_model import LogisticRegression

    Load the Iris data set and split into features and target.

    df = pd.read_csv('Data/iris.csv') X = df.drop('species', axis=1) y = df.species.astype('category')

    Fit a sci-kit learn model

    model = LogisticRegression() model.fit(X, y)

    with Session('budsprod.viyamtes.com', 'gegrab', 'XXXXX', verify_ssl=False): model_name = 'Iris Regression2'

    # Register the model in Model Manager

    register_model(model, model_name, input=X, # Use X to determine model inputs project='Iris2', # Register in "Iris" project force=True) # Create project if it doesn't exist

    Expected behavior The Scoring Task in MM should execute and score on a sample set of records. The error received in MM:

    NOTE: Created package _076796cfb3ca459eb8a285e3cd30c38 in data set "casuser(gegrab)"._076796cfb3ca459eb8a285e3cd30c38. NOTE: Execution succeeded. No rows affected. NOTE: Running 'modelPublishing' action set with 0 workers. NOTE: Execution of model 'TempModel_781437f5-15be-3842-99a0-eea05a45c6ba ' succeeded. ERROR: There is no session-scope table Test_3_Iris_Regression2_v1_0_2022_11_04_14_42_49_output in caslib gegrab_s of Cloud Analytic Services. NOTE: Cloud Analytic Services dropped table TempModel_781437f5-15be-3842-99a0-eea05a45c6ba**

    Stack Trace If you're experiencing an exception, include the full stack trace and error message.

    Version What version of sasctl are you using? 1.7.3

    bug 
    opened by ggrabow1 1
  • add instructions to register pytorch with sasctl

    add instructions to register pytorch with sasctl

    register, deploy and score a published pytorch model using sasctl. The following fork includes:

    • .ipynb notebook with sasctl instructions
    • .jpg to test scoring
    • pytorch_model.pt saved pytorch model
    • class_names.txt saved class labels to interpret model output
    opened by paataugrekhelidzesas 0
  • Register python predicton model to SAS MM using pzmm

    Register python predicton model to SAS MM using pzmm

    My customer wants to register a python prediction model (interval target) to SAS MM 15.3, so I am testing registering a python prediction model using SAS pzmm. I used the writeModelPropertiesJSON() function to make modelProperties.json, but I couldn't find an argument to create the intervel target model properties. It seems that “writeModelPropertiesJSON()” has no function for interval target.

    pzmmtest

    enhancement 
    opened by satang333 0
Releases(v1.8.0)
  • v1.8.0(Dec 19, 2022)

    Improvements

    • Added Session.version_info() to check which version of Viya the session is connected to.
    • Updated the properties= parameter of model_repository.create_model() to accept a dictionary containing custom property names and values, and to correctly indicate their type (numeric, string, date, datetime) when passing the values to Viya.
    • Added services.saslogon for creating and removing OAuth clients.

    Changes

    • Deprecated core.platform_version() in favor of Session.version_info().
    • A RuntimeError is now raised if an obsolete service is called on a Viya 4 session (sentiment_analysis, text_categorization, and text_parsing)
    • Replaced the JSON cassettes used for testing with compressed binary cassettes to save space.
    • Updated the testing framework to allow regression testing of multiple Viya versions.
    • Refactored the authentication functionality in Session to be more clear and less error prone. Relevant functions were also made private to reduce clutter in the class's public interface.

    Bugfixes

    • Fixed an issue with register_model() that caused invalid SAS score code to be generated when registering an ASTORE model in Viya 3.5.
    • Fixed a bug where calling a "get_item()" function and passing None would throw an error on most services instead of returning None.
    • Fixed a bug that caused the authentication flow to be interrupted if Kerberos was missing.
    Source code(tar.gz)
    Source code(zip)
    documentation.zip(1.20 MB)
  • v1.7.3(Sep 21, 2022)

    Improvements

    • Refactor astore model upload to fix 422 response from SAS Viya 4
      • ASTORE model import now uses SAS Viya to generate ASTORE model assets
    • Expanded usage for cas_management service (credit to @SilvestriStefano)

    Bugfixes

    • ASTORE model import no longer returns a 422 error
    • Fix improper filter usage for model_repository service
    • Fix error with loss of stream in add_model_content call for duplicate content
    • Update integration test cassettes for SAS Viya 4
    Source code(tar.gz)
    Source code(zip)
    documentation.zip(1.12 MB)
  • v1.7.2(Jun 16, 2022)

    Improvements

    • Added a new example notebook for git integration
    • Added a model migration tool for migrating Python models from Viya 3.5 to Viya 4
    • Improved handling of CAS authentication with tokens

    Bugfixes

    • Fixed git integration failure caused by detached head
    • Fixed minor bugs in score code generation feature
    • Fixed 500 error when importing models to Viya 4 with prewritten score code
    • Fixed incorrect handling of optional packages in pzmm
    Source code(tar.gz)
    Source code(zip)
    documentation.zip(1.09 MB)
  • v1.7.1(Apr 20, 2022)

  • v1.7.0(Apr 7, 2022)

  • v1.6.4(Apr 7, 2022)

  • v1.6.3(Sep 23, 2021)

  • v1.6.2(Sep 9, 2021)

  • v1.6.1(Sep 9, 2021)

    Improvements

    • model_repository.add_model_content() will now overwrite existing files instead of failing.

    Bugfixes

    • PagedList.__repr__() no longer appears to be an empty list.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Aug 17, 2021)

    Improvements

    • Session now supports authorization using OAuth2 tokens. Use the token= parameter in the constructor when an existing access token token is known. Alternatively, omitting the username= and password= parameters will now prompt the user for an auth code.

    Changes

    • current_session now stores & returns the most recently created session, not the first created session. This was done to alleviate quirks where an old, expired session is implicitly used instead of a newly-created session.
    • Removed deprecated raw= parameter from sasctl.core.request().
    • Dropped support for Python 2.
    Source code(tar.gz)
    Source code(zip)
    v1.6.0-doc.zip(1.10 MB)
  • v1.5.9(Jun 9, 2021)

  • v1.5.8(May 18, 2021)

    Bugfixes

    • SSL warnings no longer repeatedly raised when verify_ssl=False but CAS_CLIENT_SSL_CA_LIST is specified.
    • model_repository.delete_model_contents() no longer fails when only one file is found.

    Improvements

    • All delete_*() service methods return None instead of empty string.
    • All get_*() service methods issue a warning if multiple items are found when retrieving by name.
    Source code(tar.gz)
    Source code(zip)
    v1.5.8-doc.zip(1.08 MB)
  • v1.5.7(May 4, 2021)

  • v1.5.6(May 1, 2021)

    Improvements

    • PagedList handles situations where the server over-estimates the number of items available for paging.
    • The version of SAS Viya on the server can now be determined using sasctl.platform_version().

    Bugfixes

    • Reworked the model_repository.get_repository() to prevent HTTP 403 errors that could occur with some Viya environments.
    Source code(tar.gz)
    Source code(zip)
    v1.5.6-doc.zip(1.07 MB)
  • v1.5.5(Mar 26, 2021)

  • v1.5.4(Oct 29, 2020)

    Improvements

    • Added the as_swat method to the Session object, allowing connection to CAS through SWAT without an additional authentication step.

    Changes

    • Integrated PZMM into Session calls and removed redundant function calls in PZMM.
    • ROC and Lift statistic JSON files created by PZMM are now generated through CAS actionset calls.
    • Updated the PZMM example notebook, FleetMaintenance.ipynb, to include integration of PZMM with sasctl functions.

    Bugfixes

    • Reworked the model_repository.get_repository() to prevent HTTP 403 errors that could occur with some Viya environments.
    Source code(tar.gz)
    Source code(zip)
    v1.5.4-doc.zip(1.04 MB)
  • v1.5.3(Jun 25, 2020)

  • v1.5.2(Jun 22, 2020)

  • v1.5.1(Apr 9, 2020)

  • v1.5(Apr 9, 2020)

    Improvements

    • Registered Python models will now include both predict and predict_proba methods.
    • Added a new Relationships service for managing links between objects.
    • Added a new Reports service for retrieving SAS Visual Analytics reports.
    • Added a new Report_Images service for rendering content from reports.
    • Additional metadata fields are set when registering an ASTORE model.
    • Collections of items should now return an instance of PagedList for lazy loading of results.
    • Module steps can now be called using module.step(df) where df is the row of a DataFrame or Numpy array.
    • register_model sets additional project properties when registering an ASTORE model.

    Changes

    • Replaced the raw parameter of the request methods with a format parameter, allowing more control over the returned value.
    • The get_file_content method of the Files service now returns the actual content instead of the file metadata.
    • JSON output when using sasctl from the command line is now formatted correctly.

    Bugfixes

    • model_publish.delete_destination now works correctly.
    Source code(tar.gz)
    Source code(zip)
    v1.5-doc.zip(1.01 MB)
  • v1.4.6(Jan 24, 2020)

  • v1.4.5(Dec 5, 2019)

    Changes

    • Saving of package information can now be disabled using the record_packages parameter of register_model.

    Bugfixes

    • Added support for uint data types to the register_model task.
    • Fixed an issue where long package names caused register_model to fail.
    • Session creation now works with older versions of urllib3.
    Source code(tar.gz)
    Source code(zip)
    v1.4.5-doc.zip(964.46 KB)
  • v1.4.4(Nov 5, 2019)

  • v1.4.3(Oct 29, 2019)

  • v1.4.2(Oct 23, 2019)

  • v1.4.1(Oct 17, 2019)

  • v1.4(Oct 15, 2019)

    Changes

    • PyMAS.score_code now supports a dest='Python' option to retrieve the generated Python wrapper code.
    • register_model task includes a python_wrapper.py file when registering a Python model.
    • Improved error message when user lacks required permissions to register a model.

    Bugfixes

    • Fixed an issue with CAS/EP score code that caused problems with model performance metrics.
    Source code(tar.gz)
    Source code(zip)
    v1.4-doc.zip(942.85 KB)
  • v1.3(Oct 10, 2019)

    Improvements

    • Added update_performance task for easily uploading performance information for a model.
    • New (experimental) pyml2sas sub-package provides utilities for generating SAS code from Python gradient boosting models.
    • New (experimental) methods for managing workflows added to model_management service.

    Changes

    • register_model task automatically captures installed Python packages.
    • All list_xxx methods return all matching items unless a limit parameter is specified.
    • Improved API documentation.
    • Updated full_lifecycle example with performance monitoring.
    Source code(tar.gz)
    Source code(zip)
    v1.3-doc.zip(935.42 KB)
  • v1.2.5(Oct 10, 2019)

    Changes

    • Registering an ASTORE model now creates an empty ASTORE file in Model Manager to be consistent with Model Studio behavior.

    Bugfixes

    • microanalytic_score.define_steps now works with steps having no input parameters.
    • Fixed an issue where score code generated from an ASTORE model lacked output variables.
    Source code(tar.gz)
    Source code(zip)
    v1.2.5-doc.zip(891.75 KB)
  • v1.2.4(Sep 20, 2019)

Owner
SAS Software
Open Source from SAS Software
SAS Software
A hyper-user friendly bot framework built on hikari

Framework A hyper-user friendly bot framework built on hikari. Framework is based off the blocking discord library disco, In both modularity and struc

Vincent 1 Jan 10, 2022
One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.

AwesomeVersion One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind

Joakim Sørensen 39 Dec 31, 2022
A python package to easy the integration with Direct Online Pay (Mpesa, TigoPesa, AirtelMoney, Card Payments)

A python package to easy the integration with Direct Online Pay (DPO) which easily allow you easily integrate with payment options once without having to deal with each of them individually;

Jordan Kalebu 2 Nov 25, 2021
A wrapper for slurm especially on Taiwania2 (HPC CLI)A wrapper for slurm especially on Taiwania2 (HPC CLI)

TWCC-slurm-wrapper A wrapper for slurm especially on Taiwania2 (HPC CLI). For Taiwania2 (HPC CLI) usage, please refer to here. (中文) How to Install? gi

Chi-Liang, Liu 5 Oct 7, 2022
This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

max_tweeted_word This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user The program uses twe

Yasho Bapat 1 Nov 29, 2021
A python package that fetches tweets and user information in a very pythonic manner.

Tweetsy Tweetsy uses Twitter's underlying API to fetch user information and tweets and present it in a human-friendly way. What makes Tweetsy special

Sakirul Alam 5 Nov 12, 2022
Modern, privacy-friendly, and detailed web analytics that works without cookies or JS.

Modern, privacy-friendly, and cookie-free web analytics. Getting started » Screenshots • Features • Office Hours Motivation There are a lot of web ana

R. Miles McCain 2.1k Jan 3, 2023
This package accesses nitrotype's official api along with its unofficial user api

NitrotypePy This package accesses nitrotype's official api along with its unofficial user api. Currently still in development. Install To install, run

The Moon That Rises 2 Sep 4, 2022
Python Package For MTN Zambia Momo API. This package can also be used by MTN momo in other countries.

MTN MoMo API Lite Python Client Power your apps with Lite-Python MTN MoMo API Usage Installation Add the latest version of the library to your project

Mathews Musukuma 7 Jan 1, 2023
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 76 Dec 29, 2022
Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially maintained by the Tuya Developer Team.

Tuya Home Assistant Integration Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially mainta

Tuya 704 Jan 3, 2023
A Git Alert Bot - Github Integration for Pyrogram & Telethon

Yet Another GitAlertBot Inspired From @Pokurt's GitGram Run Bot: Local Host Git Clone Repo : For Telethon Version : git clone https://github.com/DevsE

DevsExpo 23 Oct 21, 2022
Discord Blogger Integration Using Blogger API

It's a very simple discord bot created in python using blogger api in order to search and send your website articles in your discord chat in form of an embedded message. It's pretty useful for people who are on the blogger platform as there are not much you can do with blogger because of the restrictions.

Owen Singh 8 Oct 28, 2022
Replacement for the default Dark Sky Home Assistant integration using Pirate Weather

Pirate Weather Integrations This integration is designed to replace the default Dark Sky integration in Home Assistant with a slightly modified, but f

Alexander Rey 129 Jan 6, 2023
Web app for spotify playlist management with last.fm integration

Music Tools Set of utility tools for Spotify and Last.fm. Built on my other libraries for Spotify (spotframework), Last.fm (fmframework) and interfaci

andy 3 Dec 14, 2022
Github integration with Telegram

The Telegram bot myGit is your GiHub assistant. In your conversations with your team, you can simply insert the information about the projects you are working at.

Alexandru Buzescu 2 Jan 6, 2022
Home Assistant Hilo Integration via HACS

BETA This is a beta release. There will be some bugs, issues, etc. Please bear with us and open issues in the repo. Hilo Hilo integration for Home Ass

null 66 Dec 23, 2022