You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by GitBox <gi...@apache.org> on 2018/11/13 13:39:38 UTC

[GitHub] asfgit closed pull request #68: IGNITE-9939 ObserverTask logs added

asfgit closed pull request #68: IGNITE-9939 ObserverTask logs added
URL: https://github.com/apache/ignite-teamcity-bot/pull/68
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
index 7716ba14..feb37047 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
@@ -18,12 +18,14 @@
 package org.apache.ignite.ci.observer;
 
 import java.util.ArrayList;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.TimerTask;
 import javax.cache.Cache;
+import java.util.stream.Collectors;
 import javax.inject.Inject;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
@@ -37,6 +39,7 @@
 import org.apache.ignite.ci.user.ICredentialsProv;
 import org.apache.ignite.ci.web.model.Visa;
 import org.apache.ignite.ci.web.model.hist.VisasHistoryStorage;
+import org.apache.ignite.internal.util.typedef.X;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -112,9 +115,22 @@ protected String runObserverTask() {
         int notFinishedBuilds = 0;
         Set<String> ticketsNotified = new HashSet<>();
 
+        ObjectMapper objectMapper = new ObjectMapper();
+
+        List<String> rmvdVisas = new ArrayList<>();
+
+        List<String> queuedVisas = new ArrayList<>();
+
         for (Cache.Entry<CompactBuildsInfo, Object> entry : compactInfos()) {
             CompactBuildsInfo compactInfo = entry.getKey();
 
+            try {
+                queuedVisas.add(objectMapper.writeValueAsString(compactInfo));
+            }
+            catch (Exception e) {
+                return "Exception while JSON parsing";
+            }
+
             BuildsInfo info = compactInfo.toBuildInfo(strCompactor);
 
             checkedBuilds += info.buildsCount();
@@ -147,10 +163,24 @@ protected String runObserverTask() {
             if (visa.isSuccess()) {
                 ticketsNotified.add(info.ticket);
 
-                compactInfos().remove(compactInfo);
+                try {
+                   rmvdVisas.add(objectMapper.writeValueAsString(compactInfo));
+                }
+                catch (Exception e) {
+                    return "Exception while JSON parsing";
+                }
+
+                try {
+                    compactInfos().remove(compactInfo);
+                }
+                catch (Exception e) {
+                   return X.getFullStackTrace(e);
+                }
             }
         }
 
-        return "Checked " + checkedBuilds + " not finished " + notFinishedBuilds + " notified: " + ticketsNotified;
+        return "Checked " + checkedBuilds + " not finished " + notFinishedBuilds + " notified: " + ticketsNotified +
+            " Visas in queue: [" + queuedVisas.stream().collect(Collectors.joining(", ")) +
+            "] Visas to rmv: [" + rmvdVisas.stream().collect(Collectors.joining(", ")) + ']';
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services