-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compute simulation metrics incrementally
This commit switches computation of simulation metrics from "at the end of simulation" (time-consuming, late, failing on suspend/resume) to "at the end of each bucket". To support this, a new concept of "simulation result transaction" was introduced. Other improvements: 1. LensElementContext is now available for custom metrics computation. 2. Metric values summation and (partial/total) dimension collapsing are now implemented correctly. Work in progress. E.g. simulation result transactions still have to be implemented in the repository.
- Loading branch information
Showing
60 changed files
with
1,621 additions
and
971 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...n/java/com/evolveum/midpoint/schema/util/SimulationMetricPartitionTypeCollectionUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (C) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.schema.util; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationMetricPartitionType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
public class SimulationMetricPartitionTypeCollectionUtil { | ||
|
||
public static List<SimulationMetricPartitionType> selectPartitions( | ||
@NotNull List<SimulationMetricPartitionType> allPartitions, @NotNull Set<QName> dimensions) { | ||
return allPartitions.stream() | ||
.filter(p -> SimulationMetricPartitionTypeUtil.matches(p, dimensions)) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...main/java/com/evolveum/midpoint/schema/util/SimulationMetricValuesTypeCollectionUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.schema.util; | ||
|
||
import com.evolveum.midpoint.util.MiscUtil; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationMetricReferenceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationMetricValuesType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
public class SimulationMetricValuesTypeCollectionUtil { | ||
|
||
public @Nullable static SimulationMetricValuesType findByRef( | ||
@NotNull Collection<SimulationMetricValuesType> metrics, | ||
@NotNull SimulationMetricReferenceType ref) { | ||
var matching = metrics.stream() | ||
.filter(mv -> ref.equals(mv.getRef())) | ||
.collect(Collectors.toList()); | ||
return MiscUtil.extractSingleton( | ||
matching, | ||
() -> new IllegalStateException( | ||
String.format("Multiple occurrences of '%s': %s", ref, matching))); | ||
} | ||
} |
Oops, something went wrong.