Skip to main content

%DeepSee.CubeManager.Utils

Class %DeepSee.CubeManager.Utils Extends %RegisteredObject [ System = 4 ]

Utility container for the cube manager

Parameters

DOMAIN

Parameter DOMAIN = "%DeepSee";

Methods

BuildCube

ClassMethod BuildCube(pCubeName As %String = "", pAsync As %Boolean = 1, pVerbose As %Boolean = 1, pIndexOnly As %Boolean = 0, pMaxFacts As %Integer = 0, pTracking As %Boolean = 0, pRepair As %Boolean = 0, pMapCube As %DeepSee.CubeManager.RegistryMapCube = "", ByRef pBuildStats, pFactList As %String = "") As %Status

A wrapper for %DeepSee.Utils.%BuildCube which records cube event information when building the cube. All arguments listed after pCubeName perfrom the identical function as they do in %BuildCube, with the exception of pRepair. This argument changes the event type in the logs to note that this cube was rebuilt as part of a repair build.

RepairBuild

ClassMethod RepairBuild(pCubeName As %String, pMap As %DeepSee.CubeManager.RegistryMap = "", pAsync As %Boolean = 1, pVerbose As %Boolean = 1, pIndexOnly As %Boolean = 0, pMaxFacts As %Integer = 0, pTracking As %Boolean = 0, ByRef pBuildStats, pFactList As %String = "") As %Status

This method provides a means of doing an unscheduled repair build of a registered cube. This method will build the target cube, and then trigger a build of the entire list of cubes that depend on it through cube relationships.
Build statistics for each cube in the registry can be returned by reference in pBuildStats(CUBENAME).

BuildAllRegisteredGroups

ClassMethod BuildAllRegisteredGroups(pMap As %DeepSee.CubeManager.RegistryMap = "", ByRef pBuildStats, pVerbose As %Boolean = 1) As %Status

This is a utility method which executes a complete build of all currently registered cubes in the current cube registry. The build initiated by this utility will walk through every cube and build it in the order it is listed in the DeepSee Cube Registry page. This can be used to initialize the system, for example after importing a new registry definition or restoring a backup of the source data.
Build statistics for each cube in the registry can be returned by reference in pBuildStats(CUBENAME).

BuildOneRegisteredGroup

ClassMethod BuildOneRegisteredGroup(pGroupName = "", pMap As %DeepSee.CubeManager.RegistryMap = "", ByRef pBuildStats, pVerbose As %Boolean = 1) As %Status

This is a utility method which executes a complete build of one registered cube group in the current cube registry. The build initiated by this utility will walk through every cube and build it in the order it is listed in the DeepSee Cube Registry page.

The value of pGroupName must exactly match the case of the registered group name to inititate the group build.
Build statistics for each cube in the group can be returned by reference in pBuildStats(CUBENAME).

ExecuteCustomCode

ClassMethod ExecuteCustomCode(pCustomCode As %String = "", pCubeKey As %String = "", pEventType As %String = "", ByRef pAbortSynch) As %Status [ Internal ]

Method to execute and log custom user code stored with a cube.

SynchronizeCube

ClassMethod SynchronizeCube(pCubeName As %String = "", pVerbose As %Boolean = 1, Output pFactsUpdated As %Integer, pReadCommitted As %Boolean = 1, pCheckReferences As %Boolean = 1, pAsync As %Boolean = 0, pMapCube As %DeepSee.CubeManager.RegistryMapCube = "", ByRef pSynchronizeStats) As %Status

A wrapper for %DeepSee.Utils.%SynchronizeCube which records cube event information when building the cube. This method will quit with an error if
- pCubeName refers to an unregistered cube
- pCubeName is marked as disabled in the registry

RegisterCube

ClassMethod RegisterCube(pCube As %DeepSee.CubeManager.RegistryMapCube = "", pGroup As %DeepSee.CubeManager.RegistryMapGroup = "") As %Status [ Internal ]

Used to enter cube information into the Cube Registry Table. This will return an error if pCubeName refers to a subject area or is undefined. The method automatically determines whether to update or create a new entry in the registry based on the existence of pCubeName.

This can be called from the command line or from UI server processes.

GetLastUpdate

ClassMethod GetLastUpdate(pCubeKey, pUpdateType = "synch") As %String

Retrieves the timestamp of the the last registered data update for the cube. Updates performed outside of the Cube Manager will not be recognized in this check.

IsUpdate

ClassMethod IsUpdate(pCube As %DeepSee.CubeManager.RegistryMapCube, pGroupName As %String) As %Boolean

Utility method used to determine whether this cube needs to be processed when we write to the registry. Cubes that have not been updated don't get processed because we don't want to generate a cube history event unnecessarily.

RegisterGroup

ClassMethod RegisterGroup(pGroup As %DeepSee.CubeManager.RegistryMapGroup) As %Status [ Internal ]

DEPRECATED - We do not need the group table within the XML storage scheme. Records a group's default build information to the group table.

UnregisterCube

ClassMethod UnregisterCube(pCubeName As %String = "", pMapCube As %DeepSee.CubeManager.RegistryMapCube = "") As %Status [ Internal ]

This does the actual work of removing a cube from the SQL registry table, and records the event.

UnregisterGroup

ClassMethod UnregisterGroup(pGroupName As %String = "", pMapGroup As %DeepSee.CubeManager.RegistryMapGroup = "") As %Status [ Internal ]

Deletes a whole group from the SQL registry table.

GetActiveRegistry

ClassMethod GetActiveRegistry() As %String

Retrieve the name of the Cube Registry currently marked Active

SetActiveRegistry

ClassMethod SetActiveRegistry(pClassName = "DeepSee.CubeManager.CubeRegistryDefinition", pMustExist = 1) As %Status

Change which Cube Registry is currently active. The Active Registry is the only one that is visible to the updater tasks.

BuildRegistryMap

ClassMethod BuildRegistryMap(ByRef pStatus, pClassName = "", pRegisteredOnly = 0, ByRef pLookup) As %DeepSee.CubeManager.RegistryMap

Retrieve the map that describes the current state of the Cube Registry and all other unregistered cubes on the system. By default, the currently active registry is loaded first and then this is augmented with the remaining unregistered natural cube groups. The registry object can be loaded from a non-active registry class by supplying the name of the alternate storage class in the pClassName parameter. The unregistered groups may be ignored when loading the class by setting
pRegisteredOnly = 1

Optionally pLookup may be constructed to provide an index of the ordered locations of every cube loaded into the map object. This takes the form
pLookup(CubeKey) = $LB(GroupPosition,CubePosition)
Set CubeName = "HOLEFOODS" Set Map = ##class(%DeepSee.CubeManager.Utils).BuildRegistryMap(,,,.Lookup) Set GroupIdx = $LG(Lookup("cubes",CubeName),1) Set CubeIdx = $LG(Lookup("cubes",CubeName),2) Set Cube = Map.Groups.GetAt(GroupIdx).Cubes.GetAt(CubeIdx)

WriteToRegistry

ClassMethod WriteToRegistry(ByRef pCubeMap As %DeepSee.CubeManager.RegistryMap, ByRef pValidation) As %Status

Walk through a CubeManager.RegistryMap object and register the cubes. This saves the complete registry to an XData block in a container class, and saves limited information to the registry table for SQL reference.

ScheduleUpdaterTasks

ClassMethod ScheduleUpdaterTasks(pCubeMap As %DeepSee.CubeManager.RegistryMap = "", Output pTaskInfo As %DynamicObject = "") As %Status [ Internal ]

Schedule the build and synch tasks according to the settings in a CubeManager.RegistryMap object. A return status of $$$OK indicates that every attempt to create or modify a build/synch task was successful. If the scheduling encounters an error, the error will be logged to the DeepSee logs and returned in the pTaskInfo object in the properties
- pTaskInfo.ScheduleBuildSC
- pTaskInfo.ScheduleSynchSC

GetSynchScheduleParameters

ClassMethod GetSynchScheduleParameters(pScheduleSynchInterval As %String = 0, Output pDailyFrequency, Output pDailyFrequencyTime, Output pDailyIncrement, Output pDailyStartTime) [ Internal ]

Convenience method -- takes the number of seconds between synchs and sets the parameters for the call to ##class(%DeepSee.CubeManager.Task.Synch).Schedule

GetCubeSize

ClassMethod GetCubeSize(pCubeKey) As %Integer [ Internal ]

- DEPRECATED -
%DeepSee.Utils.%GetCubeFactCount should be used instead.

UnregisterAll

ClassMethod UnregisterAll() As %Status [ Internal ]

- DEPRECATED -
Resets the entire cube registry table.

GetCubeGroup

ClassMethod GetCubeGroup(pGroupName As %String, pMap As %DeepSee.CubeManager.RegistryMap = "", Output pStatus) As %DeepSee.CubeManager.RegistryMapGroup [ Internal ]

Retrieves a group by name from the Cube Registry.

MergeCubeGroups

ClassMethod MergeCubeGroups(ByRef pGroup1, ByRef pGroup2, ByRef pMergeGroup, pMergedGroupName = "") As %Status [ Internal ]

Merge two array-based cube groups together into a single group. This will automatically determine an acceptable build order for the resulting group and return this in the pMergeGroup array.

If pMergedGroupName is supplied, this will be the new group name. If this argument is "", the group will inherit the name stored in the array pGroup1.

IsValidGroup

ClassMethod IsValidGroup(ByRef pGroup As %DeepSee.CubeManager.RegistryMapGroup, ByRef pStatus As %Status, ByRef pGroups, ByRef pCubes, ByRef pBuildOrders) As %Boolean

Boolean test which returns 1 if the group supplied as the argument is no less than the union of the natural groups of each of its members. If this test returns 0, the specific reason for the failure will be recorded in pStatus.

IsValidCubeSchedule

ClassMethod IsValidCubeSchedule(pCube As %DeepSee.CubeManager.RegistryMapCube, Output pStatus) As %Boolean

Validation for the current cube settings.

GetCubeGroups

ClassMethod GetCubeGroups(ByRef pGroups, ByRef pCubes, ByRef pBuildOrders, pReg = 0) As %Status

Calculates the natural groups for all cubes on the system. Group information is returned in array form. These arrays are organized as follows:

pGroups(groupName,cubeKey) = buildOrder
pCubes(cubeKey) = groupName
pBuildOrders(groupName,buildPosition) = cubeKey

If the cube has dependencies, there will be an additional array

pCubes(cubeKey,"dependents")

which will list the cubes that must be updated if this one has been updated.

FindCubeGroups

ClassMethod FindCubeGroups(ByRef pGroups, ByRef pCubes) As %Status [ Internal ]

Automatically assign groups based on cube relationships. All cubes which are independent of each other will be assigned to their own group.

FindGroupBuildOrders

ClassMethod FindGroupBuildOrders(ByRef pGroups, ByRef pBuildOrders) As %Status [ Internal ]

Pass in an array of group members, as found by GetCubeGroups, and determine an acceptable build order. The order is returned as an integer stored in each node of the group:
pGroups(group #,Cube) = Build order

GetDependentCubes

ClassMethod GetDependentCubes(pCubeName = "", pMap As %DeepSee.CubeManager.RegistryMap = "", Output pDependentCubes, ByRef pGroups, ByRef pCubes, ByRef pBuildOrders) As %Status

This method accumulates the complete list of cubes dependent on this target cube, based on defined relationships. Every cube in pDependentCubes must be built following a build of pCubeName. This is an alphabetical list, it is not a build order.
The registry map can optionally be passed in as pMap to take advantage of the relationship information already stored in the cube registry, avoiding the recalcualtion of natural groups on the system.

DisableCube

ClassMethod DisableCube(pCubeName) As %Status [ Internal ]

This is an internal method to keep the SQL references current with the RegistryMap object representation. This does the actual work of marking the cube referenced by pCubeName as disabled in the Registry table.

EnableCube

ClassMethod EnableCube(pCubeName As %String) As %Status [ Internal ]

This is an internal method to keep the SQL references current with the RegistryMap object representation. This does the actual work of marking the cube referenced by pCubeName as enabled in the Registry table.

GetDSItemItinerary

ClassMethod GetDSItemItinerary(ByRef byCube, ByRef bySource) As %Status [ Internal ]

Compile a reference index to look up DeepSee folder items that depend on cubes and data sources. Each branch of the return array
pCubeIdx(cube)
holds all folder items that might be dependent upon this cube. Before cube removal, all items in this branch of the tree should be checked for dependency beginning at the leaf nodes.

A similar strategy should be used when removiung a data source, ie a pivot or a KPI. In this case, the pSourceIdx should be used, as it sorts information according to the data source.

it is not trivial to tell if you are actually USING the relationships when they are defined so the assumption is made that all folderitems pointing to one are using dimensions from the others in a relationship network.

SetIndependentGroupSync

ClassMethod SetIndependentGroupSync(pIndependent = 0) As %Status [ Internal ]

Set the flag which unlocks the ability to choose independent synchronization in the Cube Registry page. Independent synchronization allows for the group synchronization to skip the triggered update due to relationship dependency and trigger the update only due to scheduling.

GetIndependentGroupSync

ClassMethod GetIndependentGroupSync() As %Boolean [ Internal ]

Get the flag which unlocks the ability to choose independent synchronization in the Cube Registry page.