BookmarkSubscribeRSS Feed
TzufRaifMia
Fluorite | Level 6

Hey All,

I want to create a SID pipeline containing a python model.

For that, I want to deploy (publish) my python model from my IDE, without the need of manually upload these files to my model manager.

 

How can I do that? does anyone has any example code?

Thanks!

5 REPLIES 5
JuanS_OCS
Azurite | Level 17

Hi,

 

I am not sure if I understand what is your purpose for this question... or if the idea of how Model Manager works.

 

The idea is that you will register and publish your models in the shape of a SAS Container (SCR), as it is a closed docker container that affects nothing and you can run it alongside other models (even similar models), without issues and you can score those models to pick and choose the best one and to improve them.

 

You need to bring your "files" to Model Manager so your model will be able to be included in the SAS Container and be able to be published and run and be scored.

 

In this sense, then, and if you don't load the model itself, what do you want to load exactly? How will it be scored?

 

Leaving all of those thoughts aside, you know you can query other sources, right? In that sense, you could query the contents of a blob, as example, and bring that data into files to the model. Again, a bit twisted, but the best attempt to answer to your question.

 

https://documentation.sas.com/doc/en/mascrtcdc/v_029/mascrtag/n15q5afwsfkjl5n1cfvcn7xz4x22.htm

TzufRaifMia
Fluorite | Level 6

Hey,

First of all, thanks for your response!

 

I will try to clear my needs:

I want to use a python model inside a SID pipeline. For that, I need this python model to be published, in order to use it.

 

One option is to upload\publish this python model right from the model manager.

My question is:

Is there any option publish and pack such a model right from my IDE? 

Assume I wrote a python code and trained a model, now I want to write a script which its outcome is that model being published and ready to use by SID pipeline.

 

Thanks Again!

Tzuf

JuanS_OCS
Azurite | Level 17

Hey there Tzuf,

 

always a pleasure!

 

I see, thanks for the explanations. 

If I understand correctly, you want a functionality like SAS Model Manager, but without using SAS or SAS Model Manager, just a python-based methology?

 

Should that be the case, I am not sure if there would be anyone here able to help you. You would need to look into Python-based communities and companies.

 

Else, I would need to know a bit more of what you have in mind. E.g. How is SAS or SAS Model Manager involved in your alternative?

 

TzufRaifMia
Fluorite | Level 6

Hey,

 

I do want to use SAS model manager, but I want to execute steps from outside the tool itself, i.e. from my IDE.

 

Example:

Assume you want to execute a data query, for a data table found in your SAS env.

you can either login into EG or SAS Studio and execute this query or you can also use Pycharm\VSCode and communiciate with your SAS via rest api or SAS-PYTHON library.

 

Back to our case:

Right as in example above, All I want is to push(publish) my trained model in python from my IDE (with python script) to my SAS Model manager. In that way, there is not any dependency between python and SAS developers.

 

Did you get my question now?

Thanks!

JuanS_OCS
Azurite | Level 17

Thanks! I fully get it now.

 

I have never done this. For all I know, it should be possible with the Rest APIs, making calls from any environment (aka Python - your IDE) to SAS Model Manager restAPIs. Please see the links at the bottom!

 

There is also the sas-viya CLI, that you could install, and has some functions to interact with SAS Model Manager from anything that can shell commands (os.system package). sas-viya CLI has a models plugin to interact with SAS Model Manager.

 

Moreover, reading the documentation, I just learnt: SAS Model Manager uses Kaniko in the background for publishing models, so you could alternatively use GIT & Docker instead, as documented:

https://documentation.sas.com/doc/en/mdlmgrcdc/v_050/mdlmgrug/n1nrmfpk1ysdt6n1a3ysrcljhuuy.htm

https://github.com/sassoftware/model-management-resources/blob/main/examples/OpenShiftContainerImage...

 

I am sure you could build something nice around that piece of knowledge.

 

Those should be the basics IMHO.


Some additional findings:

- This github project is a compilation of rest API sample usage of SAS Model Manager in SAS VIya 3.5. THere might be some differences with Viya 4, but assume most of it will be very similar

https://github.com/sassoftware/devsascom-rest-api-samples/blob/master/DecisionManagement/modelManage...

 

- I would keep this other project as your bible for SAS Model Manager:

https://github.com/sassoftware/model-management-resources

https://developer.sas.com/rest-apis?categories=models_and_decisions

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Discussion stats
  • 5 replies
  • 1247 views
  • 3 likes
  • 2 in conversation