Integration between SAS ESP and SAS Model Manager has been available since the 4.3 release. This integration has been improved over the last two ESP versions (5.1 and 5.2). Let’s have a look at what this integration looks like in ESP 5.2 today.
First of all, you might want to check out my previous article to discover how the ESP-Model Manager integration fits in the global ESP Analytics picture.
Then, what is the ESP-Model Manager integration all about?
It’s about smoothly and seamlessly plugging analytical models managed in SAS Model Manager in a SAS ESP event flow in order to bring analytical capabilities to real-time event streams.
How does that work?
You or the analytics team worked with SAS tools (SAS code or Visual Analytics/Statistics or Model Studio or…) to build analytical models to answer a particular business question. This process ended up in having a couple of models available in Model Manager so that they can be managed in a common model repository, evaluated for champion model selection, monitored for performance and published in any supported destination for production of scores.
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
You have set a champion model. Then you are ready for bringing that analytical model to SAS ESP very easily for real-time scoring.
In ESP Studio, you can then import a SAS Model Manager champion model. You should have at least a source window that streams events from an input data source and the Model Manager import is located in the Analytics “Calculate” window.
In the “Calculate” window, you have to:
In the “Input Handler” configuration, select “Import a module from SAS Model Manager”:
You then gain access to the model selection window:
This shows the SAS Model Manager Repository. Notice that you can only select a champion model. Also, the model must be of type dataStep or ds2Package or ds2MultiType:
Here you can also check the input variables that the model expects as well as the output fields that the model will generate.
Moving forward, you can automatically add the model outputs to your ESP model by checking the “Add the output schema to the window”:
As a result, if you go back on the “Input Handler” configuration, it appears now that the Model Manager import ended up in a MAS (Micro Analytic Service) module creation:
To know what the MAS module looks like, open the MAS module configuration at the Project level:
The XML behind this configuration looks like this:
Notice the MAS module XML definition that corresponds to the previous screenshot with a MAS Store reference.
Extract from the public documentation:
A SAS Micro Analytic Service store is a named, versioned object repository that is maintained by SAS Event Stream Processing. A store enables convenient access to DS2, C, Python, and ASTORE files in a SAS Micro Analytic Service module without requiring direct access to the ESP server’s file system. You can use the RESTful API to query, create, delete, and write objects to SAS Micro Analytic Service stores.
Also notice that the XML contains some metadata information about the model type and ASTORE file location.
At this point, nothing has been created on the ESP Server side. The MAS Store with the corresponding code and possibly the ASTORE file will be materialized (physically created on disk) at the first run using this metadata information.
When you start this ESP project, a couple of operations happen under the covers to import the required files onto the ESP Server and then the project can run:
When running the ESP project that contains a Model Manager imported model for the first time, the corresponding MAS Store is initialized.
A folder named with the Model Manager project UUID concatenated with another UUID is created under $DFESP_CONFIG/mas-modules (/opt/sas/viya/config/etc/SASEventStreamProcessingEngine/default/mas-modules) with the right versioned components, mainly a program and possibly an ASTORE file:
Sample folder structure:
The _4MUYMBZ1WTY14YM8883CRZWT file actually represents the ASTORE file.
In order to proceed successfully with this initialization, the Viya environment requires to be setup appropriately as mentioned in the SAS Model Manager Administration documentation:
A good thing with the SAS Model Manager – ESP integration is that the ESP Studio user will be notified if there is a new champion model, so that the ESP model can be updated as soon as there is a change.
The ESP Studio user can decide to update the MAS module corresponding to the Model Manager imported model to reflect the newest champion model. It is done at design time and doesn’t require any further post-configuration. Just clicking "Yes" updates it automatically.
Notice that it can be done at run time, without stopping your ESP project, when you use Event Stream Manager to deploy your ESP projects to ESP servers.
Designing models in SAS Model Studio (before managing them in SAS Model Manager) requires sometimes some data preparation tasks (aka data mining preprocessing) such as imputation, binning, replacement, etc. When the model designed is ASTORE-based (gradient boosting, forest, etc.), this data preparation phase is not part of the ASTORE file, but rather is available alongside as a DS2 code.
SAS Model Manager deploys the ASTORE file + the data preparation DS2 code as a single unit in ESP Studio (hence the "multi-type" model).
In contrast, ASTORE-based models deployed with the Model Reader/Score windows might require the data preparation tasks to be implemented in the upstream windows, which could be tedious to do.
So Model Manager integration of ASTORE-based models offers a great advantage over the Model Reader/Score approach.
The current SAS Model Manager – ESP integration is limited to one single Viya instance. In other words, you cannot import a SAS Model Manager analytical model configured in one Viya instance into ESP Studio configured in another Viya instance. They have to be part of the same Viya deployment to allow this communication.
Thanks for reading.
Hi,
Thank you for explaining in detail the integration between ESP and MM. Is there any update in the architecture of ESP in the new version of using multiple SAS Viya instance with ESP Studio.
Regards,
Muhammad Haseeb
Hi Muhammad,
As far as I know, the integration between ESP Studio and Model Manager is still limited to one single Viya instance. ESP Studio is able to access Model Manager's repository on the same Viya instance.
Regards,
Nicolas.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.