This post will demonstrate how to schedule a cube build through the windows task scheduler.
In many cases we would like to schedule our ElastiCubes builds to run one by one, using just one command, or to run in a specific hour so our users won't create or watch dashboards while the cube is building and also will have recently updated data.
Although you can schedule a cube to build in a specific hour through the scheduled build settings in the ElastiCube Manager, In this way you can define more complex and specific terms to run the build, for example building all your ElastiCubes in one process and determining a specific hour for the build.
Step 1 - Copy the script and save it as .bat file
This script contains a few steps to activate a cube build.
The first two lines are optional, they are used to stop and start the ElastiCube Server, this is mainly to clear up some space in the memory towards the build. Keep in mind that while this service is down the users will not be able to create or watch dashboards (this only takes a few minutes).
The following lines are the commands to build the cubes. Add a new line for every ElastiCube you want to build, it is crucial to add the "/wait" part so every command start in its turn only after the previous is finished.
@echo off start /wait /d "C:\Program Files\Sisense\Prism" psm ecs stop start /wait /d "C:\Program Files\Sisense\Prism" psm ecs start start /wait /d "C:\Program Files\Sisense\Prism" psm ecube build filename="C:\<My_Cube_A>.ecube" serverAddress="LocalHost" mode="restart"
start /wait /d "C:\Program Files\Sisense\Prism" psm ecube build filename="C:\<My_Cube_B>.ecube" serverAddress="LocalHost" mode="restart"
Step 2 - Creating a new task
Open the windows task scheduler and create a new task. Name the task and set security filters as followed.
*note that the user account running the task MUST BE AN ADMINISTRATOR USER
Step 3 - Setting the Triggers
In the triggers tab create a new trigger and define the time to activate the command, this can be an interval for every few hours or run on a specific hour. In case you want to run the task a few times a day in predetermined hours, for every build occurrence create a new trigger. (i.e one occurrence in the morning and one at night).
Step 4 - Specifying the build action and finishing
In the actions tab create a new one and choose "Start a Program" action, then choose the .bat file you created.
Edit the Condition and Settings tabs as required (optional) and hit OK.
Test the task to see if it's working by right clicking on the task and choosing "Run".