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/26 10:51:51 UTC
[ignite-teamcity-bot] branch master updated: Fix of too-short
history
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/master by this push:
new be469c9 Fix of too-short history
be469c9 is described below
commit be469c905a8607f3a2d550f095afdf47ee1d5d9e
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Wed Jun 26 13:51:44 2019 +0300
Fix of too-short history
---
.../ignite/ci/runners/RemoteClientTmpHelper.java | 60 ++++++++++++++++++++++
.../org/apache/ignite/ci/web/model/Version.java | 2 +-
.../apache/ignite/tcignited/build/FatBuildDao.java | 7 ++-
.../ignite/tcignited/history/HistoryCollector.java | 2 +
4 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/RemoteClientTmpHelper.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/RemoteClientTmpHelper.java
index de23a26..87beec5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/RemoteClientTmpHelper.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/RemoteClientTmpHelper.java
@@ -24,6 +24,8 @@ import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.time.Duration;
+import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger;
import javax.cache.Cache;
import javax.xml.bind.JAXBException;
@@ -62,9 +64,67 @@ public class RemoteClientTmpHelper {
* @param args Args.
*/
public static void main(String[] args) {
+ // mainDumpFatBuildStartTime(args);
System.err.println("Please insert option of main");
}
+
+ public static void mainDumpFatBuildStartTime(String[] args) {
+ try (Ignite ignite = tcbotServerConnectedClient()) {
+ IgniteCache<Long, FatBuildCompacted> bst = ignite.cache(FatBuildDao.TEAMCITY_FAT_BUILD_CACHE_NAME);
+ Iterator<Cache.Entry<Long, FatBuildCompacted>> iterator = bst.iterator();
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(new File(dumpsDir(),
+ "fatBuildStartTime.txt")))) {
+ while (iterator.hasNext()) {
+ Cache.Entry<Long, FatBuildCompacted> next = iterator.next();
+
+ FatBuildCompacted val = next.getValue();
+ long ageDays = -1;
+ long startDateTs = -2;
+
+ if (val != null) {
+ startDateTs = val.getStartDateTs();
+ ageDays = Duration.ofMillis(System.currentTimeMillis() - startDateTs).toDays();
+ }
+
+ writer.write(next.getKey() + " " + startDateTs + " " +
+ ageDays + "\n");
+ }
+
+ }
+ catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+ }
+
+
+ public static void mainDumpBuildStartTime(String[] args) {
+ try (Ignite ignite = tcbotServerConnectedClient()) {
+ IgniteCache<Long, Long> bst = ignite.cache(BUILD_START_TIME_CACHE_NAME);
+ Iterator<Cache.Entry<Long, Long>> iterator = bst.iterator();
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(new File(dumpsDir(),
+ "BuildStartTime.txt")))) {
+ while (iterator.hasNext()) {
+ Cache.Entry<Long, Long> next = iterator.next();
+
+ Long val = next.getValue();
+ long ageDays = -1;
+ if(val!=null)
+ ageDays = Duration.ofMillis(System.currentTimeMillis() - val).toDays();
+
+ writer.write(next.getKey() + " " + val + " " +
+ ageDays +"\n");
+ }
+
+ }
+ catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+ }
+
+
/**
* @param args Args.
*/
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
index c1bd22d..e8b8258 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/Version.java
@@ -28,7 +28,7 @@ package org.apache.ignite.ci.web.model;
public static final String GITHUB_REF = "https://github.com/apache/ignite-teamcity-bot";
/** TC Bot Version. */
- public static final String VERSION = "20190621";
+ public static final String VERSION = "20190626";
/** Java version, where Web App is running. */
public String javaVer;
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 b40e204..82da2c8 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
@@ -239,7 +239,12 @@ public class FatBuildDao {
BinaryObject buildBinary = entry.getValue();
- return buildBinary.field("startDate");
+ Long startDate = buildBinary.field("startDate");
+
+ if (startDate == null || startDate <= 0)
+ return null;
+
+ return startDate;
}
}
}
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/HistoryCollector.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/HistoryCollector.java
index 7254774..096aa64 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/HistoryCollector.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/HistoryCollector.java
@@ -200,11 +200,13 @@ public class HistoryCollector {
return buildInScope;
}
+ @SuppressWarnings("WeakerAccess")
@AutoProfiling
protected Map<Integer, Long> getStartTimeFromSpecialCache(int srvId, Set<Integer> buildIds) {
return runHistCompactedDao.getBuildsStartTime(srvId, buildIds);
}
+ @SuppressWarnings("WeakerAccess")
@AutoProfiling
protected Map<Integer, Long> getStartTimeFromFatBuild(int srvId, Set<Integer> buildIds) {
return fatBuildDao.getBuildStartTime(srvId, buildIds);