Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
top73
top73


Tip
titleWant to create a new Mathematical Function/Action?

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:


Table of Contents


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
titleBGColor#ddfade
titleConfigAttributes.java

package com.cognizant.devops.platformcommons.core.enums;


public enum ExecutionActions {

AVERAGE, COUNT, MINMAX, (Add your new Mathematical Function/Action Name here)

}


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
titleBGColor#ddfade
titleConfigAttributes.java

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.CustomActionNameYourCustomActionName == kpiDefinition.getAction()){

log.debug("KPI action found as Custom Your Custom Action name");

BaseActionImpl impl = new CustomActionImplementationClassName YourCustomActionImplementationClassName(kpiDefinition);

impl.execute();

}

}

...

...

...

}