Anchor | ||||
---|---|---|---|---|
|
Tip | ||
---|---|---|
| ||
It's simple! Learn to create customized Mathematical Function/Action in InSights Inference on this page. |
In order to run create a new Mathematical Function/Action in InSights Inference, there are changes that should be made in list of files shown on this page. Please adhere the following instructions, and make respective changes -
Panel | |
---|---|
On this page:
|
Info |
---|
%WORKSPACE% is the directory which contains InSights - Development Platform. |
Changes in ConfigAttributes.java
Browse the directory - "%WORKSPACE%\Insights\PlatformInsights\src\main\java\com\cognizant\devops\platforminsights\core\enums\ConfigAttributes.java"
Add the changes in ConfigAttributes.java as highlighted in Red in the below panel.
Panel | ||||
---|---|---|---|---|
| ||||
package com.cognizant.devops.platformcommons.core.enums; public enum ExecutionActions { AVERAGE, COUNT, MINMAX, (Add your new Mathematical Function/Action Name here) } |
Creating JAVA with Custom Mathematical Function/Action code
Create a new package under "%WORKSPACE%\Insights\PlatformInsights\src\main\java".
Changes in SparkJobExecutor.java
Browse the directory - "%WORKSPACE%\Insights\PlatformInsights\src\main\java\com\cognizant\devops\platforminsights\core\SparkJobExecutor.java"
Add the changes in ConfigAttributes.java as highlighted in Red in the below panel.
Panel | ||||
---|---|---|---|---|
| ||||
package com.cognizant.devops.platforminsights.core; public enum SparkJobExecutor implements Job,Serializable{ ... ... ... private void executeJob(SparkJobConfiguration job) throws InsightsSparkJobFailedException{ KPIDefinition kpiDefinition = job.getKpiDefinition(job.getKpiDefinition()); if(ExecutionActions.AVERAGE == kpiDefinition.getAction()){ log.debug("KPI action found as AVERAGE"); BaseActionImpl impl = new AverageActionImpl(kpiDefinition); impl.execute(); } else if(ExecutionActions.COUNT == kpiDefinition.getAction()){ log.debug("KPI action found as COUNT"); BaseActionImpl impl = new CountActionImpl(kpiDefinition); impl.execute(); } else if(ExecutionActions.MINMAX == kpiDefinition.getAction()){ log.debug("KPI action found as MINMAX"); BaseActionImpl impl = new MinMaxActionImpl(kpiDefinition); impl.execute(); } //(Instance of a Custom Mathematical Function/Action) else if(ExecutionActions.YourCustomActionName == kpiDefinition.getAction()){ log.debug("KPI action found as Your Custom Action name"); BaseActionImpl impl = new YourCustomActionImplementationClassName(kpiDefinition); impl.execute(); } } ... ... ... } |