You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/06/20 14:22:28 UTC
[ignite-teamcity-bot] 05/07: Trusted tests & suite history
performance fixes: skipping known builds
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch test-hist-performance
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
commit 487bced945579380248ceb33e6eeb30f1d426f68
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Wed Jun 19 21:50:40 2019 +0300
Trusted tests & suite history performance fixes: skipping known builds
---
.../apache/ignite/tcignited/TeamcityIgnitedImpl.java | 20 +++++++++++---------
.../apache/ignite/tcignited/build/FatBuildDao.java | 15 +++++++++------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/TeamcityIgnitedImpl.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/TeamcityIgnitedImpl.java
index 707285f..dfdf970 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/TeamcityIgnitedImpl.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/TeamcityIgnitedImpl.java
@@ -34,7 +34,7 @@ import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Supplier;
+import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -441,21 +441,23 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
if (testName < 0 || buildTypeId < 0 || normalizedBaseBranch < 0)
return null;
- Supplier<Set<Integer>> supplier = () -> {
+ Function<Set<Integer>, Set<Integer>> supplier = (knownBuilds) -> {
String btId = compactor.getStringFromId(buildTypeId);
String branchId = compactor.getStringFromId(normalizedBaseBranch);
List<BuildRefCompacted> compacted = getAllBuildsCompacted(btId, branchId);
long curTs = System.currentTimeMillis();
Set<Integer> buildIds = compacted.stream()
+ .filter(b -> !knownBuilds.contains(b.id()))
+ //todo filter queued, cancelled and so on
.filter(
- bRef -> {
- Long startTime = getBuildStartTime(bRef.id());
- if (startTime == null)
- return false;
+ bRef -> {
+ Long startTime = getBuildStartTime(bRef.id());
+ if (startTime == null)
+ return false;
- return Duration.ofMillis(curTs - startTime).toDays() < InvocationData.MAX_DAYS;
- }
- ).map(BuildRefCompacted::id).collect(Collectors.toSet());
+ return Duration.ofMillis(curTs - startTime).toDays() < InvocationData.MAX_DAYS;
+ }
+ ).map(BuildRefCompacted::id).collect(Collectors.toSet());
System.err.println("*** Build " + btId + " branch " + branchId + " builds in scope " + buildIds.size());
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
index af59fd9..e0dce95 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
@@ -28,7 +28,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
+import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
@@ -232,7 +232,7 @@ public class FatBuildDao {
*/
@AutoProfiling
public IRunHistory getTestRunHist(int srvIdMaskHigh,
- Supplier<Set<Integer>> buildIdsSupplier, int testName, int buildTypeId, int normalizedBaseBranch) {
+ Function<Set<Integer>, Set<Integer>> buildIdsSupplier, int testName, int buildTypeId, int normalizedBaseBranch) {
RunHistKey runHistKey = new RunHistKey(srvIdMaskHigh, buildTypeId, normalizedBaseBranch);
@@ -248,14 +248,16 @@ public class FatBuildDao {
return hist.testsHistory.get(testName);
}
+
+ //todo create standalone history collector class
@AutoProfiling
public SuiteHistory loadSuiteHistory(int srvId,
- Supplier<Set<Integer>> buildIdsSupplier,
+ Function<Set<Integer>, Set<Integer>> buildIdsSupplier,
int buildTypeId,
int normalizedBaseBranch) {
Map<Integer, SuiteInvocation> suiteRunHist = historyDao.getSuiteRunHist(srvId, buildTypeId, normalizedBaseBranch);
- Set<Integer> buildIds = determineLatestBuilds(buildIdsSupplier);
+ Set<Integer> buildIds = determineLatestBuildsFunction(buildIdsSupplier, suiteRunHist.keySet());
HashSet<Integer> missedBuildsIds = new HashSet<>(buildIds);
@@ -361,8 +363,9 @@ public class FatBuildDao {
}
@AutoProfiling
- protected Set<Integer> determineLatestBuilds(Supplier<Set<Integer>> buildIdsSupplier) {
- return buildIdsSupplier.get();
+ protected Set<Integer> determineLatestBuildsFunction(Function<Set<Integer>, Set<Integer>> buildIdsSupplier,
+ Set<Integer> known) {
+ return buildIdsSupplier.apply(known);
}
public void invalidateHistoryInMem(int srvId, Stream<BuildRefCompacted> stream) {