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 f292300  Removed old statistics saving
f292300 is described below

commit f292300419330a364f5d4a366e3bdade93dddb5f
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Tue Dec 18 21:51:37 2018 +0300

    Removed old statistics saving
---
 .../java/org/apache/ignite/ci/ITcAnalytics.java    |  8 ---
 .../apache/ignite/ci/IgnitePersistentTeamcity.java | 50 -----------------
 .../org/apache/ignite/ci/analysis/RunStat.java     | 45 ---------------
 .../ignite/ci/analysis/TestCompactedMult.java      |  9 ++-
 .../java/org/apache/ignite/ci/db/DbMigrations.java | 33 ++++-------
 .../ignite/ci/tcbot/chain/BuildChainProcessor.java |  5 --
 .../apache/ignite/ci/tcmodel/result/Triggered.java | 18 +++---
 .../ci/teamcity/ignited/runhist/RunHistSync.java   |  2 +-
 .../org/apache/ignite/ci/analysis/RunStatTest.java | 64 ----------------------
 9 files changed, 28 insertions(+), 206 deletions(-)

diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITcAnalytics.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITcAnalytics.java
index 195f267..71a1d83 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITcAnalytics.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITcAnalytics.java
@@ -41,12 +41,4 @@ public interface ITcAnalytics {
     Function<TestInBranch, RunStat> getTestRunStatProvider();
 
     String getThreadDumpCached(Integer buildId);
-
-    /**
-     * Calculate required statistic for build if was not already calculated.
-     *
-     * @param ctx Context as provider build data.
-     */
-    @Deprecated
-    void calculateBuildStatistic(SingleBuildRunCtx ctx);
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
index 23849a2..288f722 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
@@ -74,7 +74,6 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
     @Deprecated
     private static final String TESTS_RUN_STAT = "testsRunStat";
     @Deprecated
-    private static final String CALCULATED_STATISTIC = "calculatedStatistic";
     private static final String LOG_CHECK_RESULT = "logCheckResult";
 
     //todo need separate cache or separate key for 'execution time' because it 
is placed in statistics
@@ -388,11 +387,6 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
         return getOrCreateCacheV2(ignCacheNme(TESTS_RUN_STAT));
     }
 
-    @Deprecated
-    private IgniteCache<Integer, Boolean> calculatedStatistic() {
-        return getOrCreateCacheV2(ignCacheNme(CALCULATED_STATISTIC));
-    }
-
     /** {@inheritDoc} */
     @Override public Function<SuiteInBranch, RunStat> 
getBuildFailureRunStatProvider() {
         return key -> key == null ? null : getRunStatForSuite(key);
@@ -417,33 +411,6 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
         return getOrCreateCacheV2(ignCacheNme(LOG_CHECK_RESULT));
     }
 
-    @Deprecated
-    private void addTestOccurrenceToStat(TestOccurrence next, String 
normalizedBranch, Boolean changesExist) {
-        String name = next.getName();
-        if (Strings.isNullOrEmpty(name))
-            return;
-
-        if (next.isMutedTest() || next.isIgnoredTest())
-            return;
-
-        TestInBranch k = new TestInBranch(name, normalizedBranch);
-
-        testRunStatCache().invoke(k, (entry, arguments) -> {
-            TestInBranch key = entry.getKey();
-            TestOccurrence testOccurrence = (TestOccurrence)arguments[0];
-
-            RunStat val = entry.getValue();
-            if (val == null)
-                val = new RunStat(key.getName());
-
-            val.addTestRun(testOccurrence, changesExist);
-
-            entry.setValue(val);
-
-            return null;
-        }, next);
-    }
-
     /** {@inheritDoc} */
     @Override public CompletableFuture<File> 
unzipFirstFile(CompletableFuture<File> fut) {
         return teamcity.unzipFirstFile(fut);
@@ -475,23 +442,6 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
         return logCheckRes.getLastThreadDump();
     }
 
-    /** {@inheritDoc} */
-    @AutoProfiling
-    @Override public void calculateBuildStatistic(SingleBuildRunCtx ctx) {
-        if (ctx.buildId() == null)
-            return;
-
-        if (calculatedStatistic().containsKey(ctx.buildId()))
-            return;
-
-        for (TestOccurrence testOccurrence : ctx.getTests()) {
-            String branch = normalizeBranch(ctx.getBranch());
-
-            addTestOccurrenceToStat(testOccurrence, branch, 
!ctx.getChanges().isEmpty());
-        }
-
-        calculatedStatistic().put(ctx.buildId(), true);
-    }
 
     /**
      * @param cache
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
index 825fa88..ef7ad26 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
@@ -59,21 +59,10 @@ public class RunStat implements IRunHistory {
     public int runsWithDuration;
 
     /**
-     * timestamp of last write to entry
-     */
-    public long lastUpdatedMs;
-
-    /**
      * Name: Key in run stat cache
      */
     private String name;
 
-    /**
-     * @deprecated {@link #latestRuns} should be used.
-     */
-    @Deprecated
-    @Nullable
-    SortedMap<TestId, Integer> latestRunResults;
 
     @Nullable
     SortedMap<TestId, RunInfo> latestRuns;
@@ -85,22 +74,6 @@ public class RunStat implements IRunHistory {
         this.name = name;
     }
 
-    public void addTestRun(TestOccurrence testOccurrence, Boolean 
changesExist) {
-        addTestRunToLatest(testOccurrence, changesStatus(changesExist));
-
-        runs++;
-
-        if (testOccurrence.duration != null) {
-            totalDurationMs += testOccurrence.duration;
-            runsWithDuration++;
-        }
-
-        if (testOccurrence.isFailedTest())
-            failures++;
-
-        lastUpdatedMs = System.currentTimeMillis();
-    }
-
     private ChangesState changesStatus(Boolean changesExist) {
         if (changesExist == null)
             return ChangesState.UNKNOWN;
@@ -363,24 +336,6 @@ public class RunStat implements IRunHistory {
             "changed its status [" + statusChange + "/" + latestRuns.size() + 
"] without code modifications";
     }
 
-    /**
-     * Migrate data from latestRunResults to latestRuns.
-     *
-     * @deprecated need to be remove after migrate.
-     */
-    @Deprecated
-    public void migrateLatestRuns(){
-        if(latestRunResults == null)
-            return;
-
-        if (latestRuns == null)
-            latestRuns = new TreeMap<>();
-        else
-            latestRuns.clear();
-
-        for (Map.Entry<TestId, Integer> entry : latestRunResults.entrySet())
-            latestRuns.put(entry.getKey(), new 
RunInfo(RunStatus.byCode(entry.getValue()), ChangesState.UNKNOWN));
-    }
 
     /**
      * Status of run.
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestCompactedMult.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestCompactedMult.java
index 2b80f40..c59ad79 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestCompactedMult.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestCompactedMult.java
@@ -34,25 +34,30 @@ public class TestCompactedMult implements 
IMultTestOccurrence {
         this.compactor = compactor;
     }
 
+    /** {@inheritDoc} */
     @Override public String getName() {
         return occurrences.isEmpty() ? "" : 
occurrences.iterator().next().testName(compactor);
     }
 
+    /** {@inheritDoc} */
     @Override public boolean isInvestigated() {
         return occurrences.stream().anyMatch(TestCompacted::isInvestigated);
     }
 
+    /** */
     private int getFailedButNotMutedCount() {
         return (int)occurrences.stream()
             .filter(Objects::nonNull)
             .filter(t -> t.isFailedButNotMuted(compactor)).count();
     }
 
+    /** {@inheritDoc} */
     @Override public int failuresCount() {
         return getFailedButNotMutedCount();
     }
 
-    public long getAvgDurationMs() {
+    /** {@inheritDoc} */
+    @Override public long getAvgDurationMs() {
         if (avgDuration < 0) {
             avgDuration = (long)occurrences.stream()
                 .map(TestCompacted::getDuration)
@@ -61,9 +66,11 @@ public class TestCompactedMult implements 
IMultTestOccurrence {
                 .average()
                 .orElse(0);
         }
+
         return avgDuration;
     }
 
+    /** {@inheritDoc} */
     @Override public Iterable<TestOccurrenceFull> getOccurrences() {
         return occurrences.stream()
                 .map(testCompacted -> 
testCompacted.toTestOccurrence(compactor, 0))
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/DbMigrations.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/DbMigrations.java
index cec2753..01e3420 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/DbMigrations.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/DbMigrations.java
@@ -117,15 +117,18 @@ public class DbMigrations {
         String ISSUES_USAGES_LIST = "issuesUsagesList";
 
         /** Cache name.*/
-        public static final String TEST_HIST_CACHE_NAME = "testRunHistV0";
-        public static final String TEST_HIST_CACHE_NAME2 
="teamcityTestRunHistV0";
+        String TEST_HIST_CACHE_NAME = "testRunHistV0";
+        String TEST_HIST_CACHE_NAME2 ="teamcityTestRunHistV0";
 
         /** Build Start time Cache name. */
-        public static final String BUILD_START_TIME_CACHE_NAME = 
"buildStartTimeV0";
-        public static final String BUILD_START_TIME_CACHE_NAME2 = 
"teamcityBuildStartTimeV0";
+        String BUILD_START_TIME_CACHE_NAME = "buildStartTimeV0";
+        String BUILD_START_TIME_CACHE_NAME2 = "teamcityBuildStartTimeV0";
 
         /** Cache name.*/
-        public static final String SUITE_HIST_CACHE_NAME = 
"teamcitySuiteRunHistV0";
+        String SUITE_HIST_CACHE_NAME = "teamcitySuiteRunHistV0";
+
+
+        String CALCULATED_STATISTIC = "calculatedStatistic";
 
     }
 
@@ -360,24 +363,6 @@ public class DbMigrations {
             }
         });
 
-        applyMigration("latestRunResultsToLatestRuns", () -> {
-            System.out.println("Total entry for migrate : " + 
testHistCache.size());
-            int i = 0;
-            for (Cache.Entry<?, RunStat> next : testHistCache) {
-                TestInBranch key = (TestInBranch)next.getKey();
-                RunStat value = next.getValue();
-
-                value.migrateLatestRuns();
-
-                testHistCache.put(key, value);
-
-                if (i % 1000 == 0)
-                    System.out.println("Migrating entry: count : " + i);
-
-                i++;
-            }
-        });
-
         applyDestroyIgnCacheMigration(RUNNING_BUILDS);
 
         applyDestroyIgnCacheMigration(BUILD_QUEUE);
@@ -415,6 +400,8 @@ public class DbMigrations {
         applyDestroyCacheMigration(Old.TEST_HIST_CACHE_NAME2);
         applyDestroyCacheMigration(Old.BUILD_START_TIME_CACHE_NAME);
         applyDestroyCacheMigration(Old.BUILD_START_TIME_CACHE_NAME2);
+
+        applyDestroyIgnCacheMigration(Old.CALCULATED_STATISTIC);
     }
 
     private void applyDestroyIgnCacheMigration(String cacheName) {
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
index 272aa1f..4c91d05 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
@@ -367,11 +367,6 @@ public class BuildChainProcessor {
     protected void analyzeTests(MultBuildRunCtx outCtx, 
IAnalyticsEnabledTeamcity teamcity,
         ProcessLogsMode procLog) {
         for (SingleBuildRunCtx ctx : outCtx.getBuilds()) {
-            if (!ITeamcity.NEW_RUN_STAT)
-                tcUpdatePool.getService().submit(() -> {
-                    teamcity.calculateBuildStatistic(ctx);
-                });
-
             if ((procLog == ProcessLogsMode.SUITE_NOT_COMPLETE && 
ctx.hasSuiteIncompleteFailure())
                     || procLog == ProcessLogsMode.ALL)
                 ctx.setLogCheckResFut(teamcity.analyzeBuildLog(ctx.buildId(), 
ctx));
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/Triggered.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/Triggered.java
index 2aedee8..4006fa0 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/Triggered.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/Triggered.java
@@ -74,13 +74,13 @@ public class Triggered {
     /**
      * Sets the value of the user property.
      *
-     * @param value
+     * @param val
      *     allowed object is
      *     {@link User }
      *
      */
-    public void setUser(User value) {
-        this.user = value;
+    public void setUser(User val) {
+        this.user = val;
     }
 
     /**
@@ -98,13 +98,13 @@ public class Triggered {
     /**
      * Sets the value of the type property.
      *
-     * @param value
+     * @param val
      *     allowed object is
      *     {@link String }
      *
      */
-    public void setType(String value) {
-        this.type = value;
+    public void setType(String val) {
+        this.type = val;
     }
 
     /**
@@ -122,13 +122,13 @@ public class Triggered {
     /**
      * Sets the value of the date property.
      *
-     * @param value
+     * @param val
      *     allowed object is
      *     {@link String }
      *
      */
-    public void setDate(String value) {
-        this.date = value;
+    public void setDate(String val) {
+        this.date = val;
     }
 
     /**
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
index 0eb4e44..daeca66 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
@@ -45,7 +45,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
+ * Calculate required statistic for build if was not already calculated.
  */
 public class RunHistSync {
     /** Logger. */
diff --git 
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/analysis/RunStatTest.java
 
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/analysis/RunStatTest.java
deleted file mode 100644
index 5c4ed46..0000000
--- 
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/analysis/RunStatTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ci.analysis;
-
-import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
-import org.junit.Test;
-
-import static org.apache.ignite.ci.analysis.RunStat.ChangesState.UNKNOWN;
-
-public class RunStatTest {
-    @Test
-    public void testHistoricalIsExcluded() {
-
-        RunStat stat = new RunStat("");
-        TestOccurrence occurrence = new TestOccurrence();
-        occurrence.status = "SUCCESS";
-        occurrence.setId("id:10231,build:(id:1103529)");
-        stat.addTestRunToLatest(occurrence, UNKNOWN);
-
-        assert stat.getLatestRunResults().contains(0);
-
-        occurrence.status = "FAILED";
-        occurrence.setId("id:10231,build:(id:1133529)");
-        stat.addTestRunToLatest(occurrence, UNKNOWN);
-        assert stat.getLatestRunResults().contains(0);
-        assert stat.getLatestRunResults().contains(1);
-
-        for (int i = 0; i < RunStat.MAX_LATEST_RUNS; i++) {
-            occurrence.setId("id:10231,build:(id:" + 1133529 + i + ")");
-
-            stat.addTestRunToLatest(occurrence, UNKNOWN);
-        }
-
-        assert !stat.getLatestRunResults().contains(0) : 
stat.getLatestRunResults();
-
-        System.out.println(stat.getLatestRunResults());
-
-        //success, but too old
-        for (int i = 0; i < RunStat.MAX_LATEST_RUNS; i++) {
-            occurrence.setId("id:10231,build:(id:" + 1000 + i + ")");
-            occurrence.status = "SUCCESS";
-            stat.addTestRunToLatest(occurrence, UNKNOWN);
-        }
-
-        assert !stat.getLatestRunResults().contains(0) : 
stat.getLatestRunResults();
-
-        System.out.println(stat.getLatestRunResults());
-    }
-}

Reply via email to