Integrating the Limits Module with the Atoti+ Python API

This section walks you through integrating the Limits Module with the Atoti+ Python API. In order to connect an Atoti+ instance to Limits, you need to register the LookUpPostProcessor to the Atoti+ Session.

note

The process differs slightly between Limits 1.0.0 and later releases, so Prerequisites and Session Creation are detailed separately for release 1.0.0 and 1.0.1+.

Prerequisites

Limits 1.0.1 and later

Tool Minimum Version
Atoti+ 0.6.4
Limits LookUpPostProcessor.jar
limits-shared-properties.jar
limits-common-lookup.jar.

Limits 1.0.0

Tool Minimum Version
Atoti+ 0.6.4
Limits LookUpPostProcessor.jar
limits-shared-properties.jar

Session Creation

Limits 1.0.1 and later

Start the Atoti+ Session with the extra_jars property pointing to the location of the jar files specified in the Prerequisites. This way, the Atoti+ instance has access to the necessary files:

  • LookUpPostProcessor: needed for evaluating Limit KPI’s in the Atoti+ instance.
  • limits-shared-properties.jar: contains shared properties between Limits and the LookUpPostProcessor and is required for the Post Processor to work.
  • limits-common-lookup.jar: contains helper methods for the various versions of the LookUpPostProcessor to process the Limit evaluation.

We will start our Atoti+ server on port 6060 - this is so we know where the Atoti+ instance is running so we can configure the Limits module to connect to it properly.

# Imports
from pathlib import Path
import atoti as tt
from atoti import Session


# Path object of the Limits Jar file
limits_lookup_pp_jar = Path("base/path") / "lookup-post-processor-ap511-1.0.1.jar"
limits_shared_jar = Path("base/path") / "limits-shared-properties-1.0.1.jar"
common_lookup_jar = Path("base/path") / "limits-common-lookup-1.0.1.jar"



session = tt.create_session(
    config={
        "port": 6060,
        "extra_jars": [             
            limits_lookup_pp_jar,
            limits_shared_jar,
            common_lookup_jar
        ],
    },
)

Limits 1.0.0

Start the Atoti+ Session with the extra_jars property pointing to the location of the jar files specified in the Prerequisites. This way, the Atoti+ instance has access to the necessary files:

  • LookUpPostProcessor: needed for evaluating Limit KPI’s in the Atoti+ instance.
  • limits-shared-properties.jar: contains shared properties between Limits and the LookUpPostProcessor and is required for the Post Processor to work.

We will start our Atoti+ server on port 6060 - this is so we know where the Atoti+ instance is running so we can configure the Limits module to connect to it properly.

# Imports
from pathlib import Path
import atoti as tt
from atoti import Session


# Path object of the Limits Jar file
limits_lookup_pp_jar = Path("base/path") / "lookup-post-processor-ap511-1.0.0.jar"
limits_shared_jar = Path("base/path") / "limits-shared-properties-1.0.0.jar"

session = tt.create_session(
    config={
        "port": 6060,
        "extra_jars": [             
            limits_lookup_pp_jar,
            limits_shared_jar
        ],
    },
)

Cube Creation

Next, configure your Cube, Hierarchies, and Tables.

The only required structure needed for Limits is a Slicing Date Hierarchy. To configure a hierarchy as Slicing, follow the example below:


# Create our Base Store
session.create_table(
    name="Trades",
    types={
        "TradeId": tt.type.STRING,
        "Price": tt.type.FLOAT,
        "Date": tt.type.LOCAL_DATE,
    },
    keys=["TradeId", "Date"],
)

# Create our cube
cube = session.create_cube(
    base_table=session.tables["Trades"],
    name="TradesCube",
)

# Ensure that our Date hierarchy is Slicing
cube.hierarchies["Date"].slicing = True

Register the LookUpPostProcessor

Now that you’ve added the LookUpPostProcessor Jar to the Atoti+ instance, you now need to register the LookUpPostProcessor. This can be done by simply calling the static registering method of the LookUpPostProcessor as seen below:

# Register the LookUpPostProcessor with the Atoti instance.
session._java_api.gateway.jvm.com.activeviam.limits.core.shared.LookUpPostProcessor.addMeasureToRegistry()

Limits is registered!

Now your Atoti+ instance is ready to wire into the Limits module.

You can now create Limit definitions in the Limits Module and configure the Limits Module to use your Atoti+ instance as an AP instance.

The Limits module must be started after the Atoti+ instance as the Limits module will create the Limit KPIs on the Atoti+ cube. Once the Limits module has started, you can query the Limits KPIs on the Atoti+ server.

Configurations in the Limits Module

In limits.properties, configure the following properties:

Accelerator URL

Mapping of the Accelerators to the full REST paths of the /cube REST endpoint.

acc.url.map={'ATOTI': 'http://localhost:6060/pivot/rest/v6/cube', ...Other Accelerators...}