Versions Compared

Key

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

...

Desplicing Individual Cube (method desplice_cube_rule)

The method implements reversal of splicing of a cube rule, the algorithm is similar to cube splicing - but differs in metadata used for element names substitution. These come from fpm.json and are based on RollbackQuery MDX query definitions for each applicable directive. The desplicing consists of following steps.

First the internal store cubes_status for cube splicing status will be set to False. The status store is used to store success or error flag per each cube during splicing and file name of associated backup file that is created before the rule is modified by the Splicer. The False value is indicating failure - the status will need to be set to True when the method finishes successfully.

The method will then back up the rule file to a backup folder as configured from command line (default location is a subfolder rule).

Then the method will establish a new TM1ReverseDirectiveResolver instance (Containers (package) ) and will parse the rule. It will get a parse tree of the rule as a result of a call to TM1RuleParser.get_parse_tree method. The parse tree is in-memory representation of the parsed rule composed by list of objects from Objects package (Objects (package)) representing individual rule lines (line is represented by a token finished by ;). These objects are allocated by the parser implemented by TM1RuleGrammar (Parser/Grammar (package) ) through methods make_ or add_ defined in TM1RuleParser (Parser (package) ) according to the PEG grammar (Parser/Grammar (package) ).

After that the method will determine if the rule contains region FPM-KPI. If the region is available in the rule, its parse subtree will be excluded from the parse tree. This will result in in-memory removal of all lines contained within the #Region and #EndRegion tags for FPM-KPI.

The method then calls TM1Parser.splice_rule to splice the rule by calling convert method of each object in the parse tree and get the text representation of the modified parse tree. The method then will use the string to patch the cube rule in TM1. After that the method will run check of the rule on the TM1 server. An exception will be generated if the check fails, the cube status will not be updated in cubes_status store (initial value was already set to False to indicate failure) and rollback of changes will be run. In such a case the method will save the patch string into a proposed file in the proposed rule folder (configured from command line, default location is rule).

If the patch action and rule check were successful the method will set the cube status in cubes_status store to True and will return without errors signalling to the caller to continue with a following cube rule.