BookmarkSubscribeRSS Feed

Git as a SAS Model Manager Publishing Destination

Started ‎06-07-2021 by
Modified ‎01-23-2023 by
Views 6,577

When it comes to model management, SAS Model Manager is a very robust tool. With the ability to store relevant model files and metadata, view model lineage, test and validate models, define standardized ModelOps processes, publish models, and monitor models, SAS Model Manager provides a full suite of capabilities. But when meeting with organizations, a not-so-uncommon ask was "Well, does it integrate with Git?" Git is a version control system that is commonly used to track file changes and allow active collaboration through branching.

 

Since SAS Viya was written with an Open API architecture, it is possible to utilize the Decision Management APIs to create a custom solution integrating Git and SAS Model Manager. But, since the release of SAS Viya 2020.1.1, SAS Model Manager can easily publish models into a local Git repository or a repository in GitHub or GitLab. Publishing to a Git destination pushes the model files and metadata into a new pull request for that repository.

 

Configuring Git as a publishing destination in SAS Model Manager takes just a few steps. In this article, we prepare a Git repository, configure a Git publishing destination on SAS Viya, and publish a model to Git.

 

Prepare Git Repository

To get started, you will need a Git repository and an access token.

 

To retrieve an access token in GitHub, select Settings from the upper right-hand menu. From Account settings, select Developer settings. In the Developer settings pane, navigate to Personal access tokens and select Generate new token. Name the token, allow access to repo, and then copy and save the access token for use later.

GitHub Access Token.png

 

To retrieve an access token in GitLab, select Preferences from the upper right-hand menu. From User settings, select Access Tokens. Name the new token, set an expiry date, allow access to write_repository, and then copy and save the access token for use later.

GitLab Access Token.png

Configure Git Publishing Destination

 

Now that Git is ready to receive models, we must prepare SAS Viya to push models. This documentation highlights the steps to prepare SAS Viya, but in short we must:

 

1.  Perform the installation and configuration tasks outlined in the README file that is located in the $deploy/sas-bases/examples/sas-model-publish/git directory where you downloaded your files for deployment.

 

2. Download the SAS Viya CLI and install the models plug-in. Next, complete the destination-specific configuration steps 

3. Use the CLI to create the Git publishing destination.

 

Publish Model to Git

Once the Git publishing destination is configured, I can see it as an available destination.

Git Publish.png

 

 Publishing a model to my Git repository creates a new pull request.

Pull request.png

 

Before I merge the request into my main branch, I can view any potential conflicts and add additional comments.

Merge Pull request.png

Merging the pull request adds the model's files into my repository.

Completed request.png

 

Now, in just a few steps we can create a Git publishing destination. I'm excited to see what new features are added next!

Comments

Hi Sophia,

Very useful post! You have my vote!

I tried the python code and it seems user_credential_name does not exist. I think it should be username instead. With username the creation is successful and tested the publishing, it does the trick. Could you please, update your code? 

my_credential_url = host + domains_uri + domain_name + "/users/" + user_credential_name

 

Hello @Bogdan_Teleuca! Great catch and thank you for bringing it to my attention! I have corrected the code in the article. Thanks again 🙂  

Version history
Last update:
‎01-23-2023 09:33 AM
Updated by:

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags