Skip to content

Commit

Permalink
Support Treedata calculation condition (#521)
Browse files Browse the repository at this point in the history
* don't report tree data engine error code 7005 (calc cond) as an error
  • Loading branch information
DnlLrssn authored Jan 23, 2025
1 parent daadac8 commit 5fab651
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions session/appselection.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func NewAppSelection(appMode AppSelectionModeEnum, app string, list []string) (*
}

// getRoundAppListEntry returns round robin entry from appList, based on local counter
func (appSelection *AppSelection) getRoundAppListEntry(sessionState *State, appList []string) string {
func (appSelection *AppSelection) getRoundAppListEntry(appList []string) string {
appNumber := appSelection.listCounter.Inc() - 1
return appList[appNumber%uint64(len(appList))]
}
Expand Down Expand Up @@ -217,14 +217,14 @@ func (appSelection *AppSelection) Select(sessionState *State) (*ArtifactEntry, e
return nil, errors.WithStack(err)
}
case AppModeRoundNameFromList:
app := appSelection.getRoundAppListEntry(sessionState, appSelection.AppList)
app := appSelection.getRoundAppListEntry(appSelection.AppList)
var err error
entry, err = sessionState.ArtifactMap.LookupAppTitle(app)
if err != nil {
return nil, errors.Wrapf(err, "failed to find app with title<%s>", app)
}
case AppModeRoundGUIDFromList:
guid := appSelection.getRoundAppListEntry(sessionState, appSelection.AppList)
guid := appSelection.getRoundAppListEntry(appSelection.AppList)
var err error
entry, err = sessionState.ArtifactMap.LookupAppGUID(guid)
if err != nil {
Expand All @@ -249,14 +249,14 @@ func (appSelection *AppSelection) Select(sessionState *State) (*ArtifactEntry, e
return nil, errors.WithStack(err)
}
case AppModeRoundNameFromFile:
app := appSelection.getRoundAppListEntry(sessionState, appSelection.Filename.Rows())
app := appSelection.getRoundAppListEntry(appSelection.Filename.Rows())
var err error
entry, err = sessionState.ArtifactMap.LookupAppTitle(app)
if err != nil {
return nil, errors.Wrapf(err, "failed to find app with title<%s>", app)
}
case AppModeRoundGUIDFromFile:
guid := appSelection.getRoundAppListEntry(sessionState, appSelection.Filename.Rows())
guid := appSelection.getRoundAppListEntry(appSelection.Filename.Rows())
var err error
entry, err = sessionState.ArtifactMap.LookupAppGUID(guid)
if err != nil {
Expand Down
13 changes: 7 additions & 6 deletions session/objecthandling.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func UpdateObjectHyperCubeDataAsync(sessionState *State, actionState *action.Sta
return errors.Errorf("object<%s> has no hypercube", gob.GenericId)
}

if err := checkHyperCubeErrors(gob.GenericId, hypercube, sessionState.LogEntry); err != nil {
if err := checkHyperCubeErrors(gob.GenericId, hypercube); err != nil {
switch err.(type) {
case CalcEvalConditionFailedError:
sessionState.LogEntry.Logf(logger.WarningLevel, "object<%s>: %v", obj.ID, err)
Expand Down Expand Up @@ -476,7 +476,7 @@ func UpdateObjectHyperCubeReducedDataAsync(sessionState *State, actionState *act
return errors.Errorf("object<%s> has no hypercube", gob.GenericId)
}

if err := checkHyperCubeErrors(gob.GenericId, hypercube, sessionState.LogEntry); err != nil {
if err := checkHyperCubeErrors(gob.GenericId, hypercube); err != nil {
switch err.(type) {
case CalcEvalConditionFailedError:
sessionState.LogEntry.Logf(logger.WarningLevel, "object<%s>: %v", obj.ID, err)
Expand Down Expand Up @@ -529,7 +529,7 @@ func UpdateObjectHyperCubeBinnedDataAsync(sessionState *State, actionState *acti
return errors.Errorf("object<%s> has no hypercube", gob.GenericId)
}

if err := checkHyperCubeErrors(gob.GenericId, hypercube, sessionState.LogEntry); err != nil {
if err := checkHyperCubeErrors(gob.GenericId, hypercube); err != nil {
switch err.(type) {
case CalcEvalConditionFailedError:
sessionState.LogEntry.Logf(logger.WarningLevel, "object<%s>: %v", obj.ID, err)
Expand Down Expand Up @@ -613,7 +613,7 @@ func UpdateObjectHyperCubeStackDataAsync(sessionState *State, actionState *actio
return errors.Errorf("object<%s> has no hypercube", gob.GenericId)
}

if err := checkHyperCubeErrors(gob.GenericId, hypercube, sessionState.LogEntry); err != nil {
if err := checkHyperCubeErrors(gob.GenericId, hypercube); err != nil {
switch err.(type) {
case CalcEvalConditionFailedError:
sessionState.LogEntry.Logf(logger.WarningLevel, "object<%s>: %v", obj.ID, err)
Expand Down Expand Up @@ -683,7 +683,7 @@ func UpdateObjectHyperCubeContinuousDataAsync(sessionState *State, actionState *
sessionState.QueueRequest(func(ctx context.Context) error {
sessionState.LogEntry.LogDebugf("Get continuous data for object<%s>", gob.GenericId)
hypercube := obj.HyperCube()
if err := checkHyperCubeErrors(gob.GenericId, hypercube, sessionState.LogEntry); err != nil {
if err := checkHyperCubeErrors(gob.GenericId, hypercube); err != nil {
switch err.(type) {
case CalcEvalConditionFailedError:
sessionState.LogEntry.Logf(logger.WarningLevel, "object<%s>: %v", obj.ID, err)
Expand Down Expand Up @@ -750,6 +750,7 @@ func UpdateObjectHyperCubeTreeDataAsync(sessionState *State, actionState *action
treeNodes, err := gob.GetHyperCubeTreeData(ctx, requestDef.Path, &enigma.NxTreeDataOption{
TreeNodes: nodes,
})
err = checkEngineErr(err, sessionState, fmt.Sprintf("object<%s>.GetHyperCubeTreeData", gob.GenericId))
if err != nil {
return errors.WithStack(err)
}
Expand All @@ -762,7 +763,7 @@ func UpdateObjectHyperCubeTreeDataAsync(sessionState *State, actionState *action
}, actionState, true, fmt.Sprintf("failed to get tree data for object<%s>", gob.GenericId))
}

func checkHyperCubeErrors(id string, hypercube *enigmahandlers.HyperCube, logEntry *logger.LogEntry) error {
func checkHyperCubeErrors(id string, hypercube *enigmahandlers.HyperCube) error {
if hypercube == nil {
return errors.Errorf("object<%s> has no hypercube", id)
}
Expand Down

0 comments on commit 5fab651

Please sign in to comment.