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 c5dc307 Style changes according to review in PR 14 - Fixes #14.
c5dc307 is described below
commit c5dc30707a747ff760c4f29707927a6f17930c6e
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Wed Sep 19 20:41:12 2018 +0300
Style changes according to review in PR 14 - Fixes #14.
Signed-off-by: Dmitriy Pavlov <[email protected]>
---
.../org/apache/ignite/ci/BuildChainProcessor.java | 149 +++++++++++++--------
.../main/java/org/apache/ignite/ci/TcHelper.java | 30 ++---
.../org/apache/ignite/ci/issue/IssueDetector.java | 13 +-
.../ignite/ci/runners/CheckBuildChainResults.java | 5 +-
.../org/apache/ignite/ci/util/ExceptionUtil.java | 3 +
.../java/org/apache/ignite/ci/util/FutureUtil.java | 26 ++++
.../org/apache/ignite/ci/web/TcUpdatePool.java | 2 +-
.../org/apache/ignite/ci/web/model/Version.java | 2 +-
.../ignite/ci/web/rest/GetChainResultsAsHtml.java | 4 +-
.../ci/web/rest/build/GetBuildTestFailures.java | 29 ++--
.../ignite/ci/web/rest/pr/GetPrTestFailures.java | 33 +++--
.../rest/tracked/GetTrackedBranchTestResults.java | 22 +--
.../src/main/webapp/js/common-1.6.js | 2 +-
jetty-launcher/build.gradle | 2 +-
14 files changed, 199 insertions(+), 123 deletions(-)
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/BuildChainProcessor.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/BuildChainProcessor.java
index 38f87e8..fde6b77 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/BuildChainProcessor.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/BuildChainProcessor.java
@@ -25,10 +25,12 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
+import com.google.common.util.concurrent.MoreExecutors;
import org.apache.ignite.ci.analysis.FullChainRunCtx;
import org.apache.ignite.ci.analysis.MultBuildRunCtx;
import org.apache.ignite.ci.analysis.RunStat;
@@ -38,6 +40,7 @@ import org.apache.ignite.ci.analysis.mode.LatestRebuildMode;
import org.apache.ignite.ci.analysis.mode.ProcessLogsMode;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.util.FutureUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
@@ -56,23 +59,25 @@ public class BuildChainProcessor {
* @param showContacts Show contacts.
* @param tcAnalytics Tc analytics.
* @param baseBranch Base branch, stable branch to take fail rates from.
+ * @param executor Executor service to process TC requests in it.
*/
public static Optional<FullChainRunCtx> processBuildChains(
- ITeamcity teamcity,
- LatestRebuildMode includeLatestRebuild,
- Collection<BuildRef> builds,
- ProcessLogsMode procLogs,
- boolean includeScheduled,
- boolean showContacts,
- @Nullable ITcAnalytics tcAnalytics,
- @Nullable String baseBranch) {
+ ITeamcity teamcity,
+ LatestRebuildMode includeLatestRebuild,
+ Collection<BuildRef> builds,
+ ProcessLogsMode procLogs,
+ boolean includeScheduled,
+ boolean showContacts,
+ @Nullable ITcAnalytics tcAnalytics,
+ @Nullable String baseBranch,
+ @Nullable ExecutorService executor) {
final Properties responsible = showContacts ?
getContactPersonProperties(teamcity) : null;
final FullChainRunCtx val = loadChainsContext(teamcity, builds,
includeLatestRebuild,
procLogs, responsible, includeScheduled, tcAnalytics,
- baseBranch);
+ baseBranch, executor);
return Optional.of(val);
}
@@ -82,14 +87,17 @@ public class BuildChainProcessor {
}
public static <R> FullChainRunCtx loadChainsContext(
- ITeamcity teamcity,
- Collection<BuildRef> entryPoints,
- LatestRebuildMode includeLatestRebuild,
- ProcessLogsMode procLog,
- @Nullable Properties contactPersonProps,
- boolean includeScheduledInfo,
- @Nullable ITcAnalytics tcAnalytics,
- @Nullable String failRateBranch) {
+ ITeamcity teamcity,
+ Collection<BuildRef> entryPoints,
+ LatestRebuildMode includeLatestRebuild,
+ ProcessLogsMode procLog,
+ @Nullable Properties contactPersonProps,
+ boolean includeScheduledInfo,
+ @Nullable ITcAnalytics tcAnalytics,
+ @Nullable String failRateBranch,
+ @Nullable ExecutorService executor1) {
+
+ ExecutorService executor = executor1 == null ?
MoreExecutors.newDirectExecutorService() : executor1;
if (entryPoints.isEmpty())
return new FullChainRunCtx(Build.createFakeStub());
@@ -101,47 +109,20 @@ public class BuildChainProcessor {
Map<Integer, BuildRef> unique = new ConcurrentHashMap<>();
Map<String, MultBuildRunCtx> buildsCtxMap = new ConcurrentHashMap<>();
- entryPoints.stream()
- .parallel()
- .unordered()
- .flatMap(ref -> dependencies(teamcity,
ref)).filter(Objects::nonNull)
- .flatMap(ref -> dependencies(teamcity,
ref)).filter(Objects::nonNull)
- .filter(ref -> ensureUnique(unique, ref))
- .flatMap((BuildRef buildRef) -> {
- if (includeLatestRebuild == LatestRebuildMode.NONE)
- return Stream.of(buildRef);
-
- final String branch =
getBranchOrDefault(buildRef.branchName);
-
- final List<BuildRef> builds =
teamcity.getFinishedBuilds(buildRef.buildTypeId, branch);
-
- if (includeLatestRebuild == LatestRebuildMode.LATEST) {
- BuildRef recentRef =
builds.stream().max(Comparator.comparing(BuildRef::getId)).orElse(buildRef);
-
- return Stream.of(recentRef.isFakeStub() ? buildRef :
recentRef);
- }
-
- if (includeLatestRebuild == LatestRebuildMode.ALL) {
- return builds.stream()
- .filter(ref -> !ref.isFakeStub())
- .filter(ref -> ensureUnique(unique, ref))
-
.sorted(Comparator.comparing(BuildRef::getId).reversed())
- .limit(entryPoints.size()); // applying same limit
- }
-
- throw new UnsupportedOperationException("invalid mode " +
includeLatestRebuild);
- }
- )
- .forEach((BuildRef buildRef) -> {
- Build build = teamcity.getBuild(buildRef.href);
-
- if (build == null || build.isFakeStub())
- return;
-
- MultBuildRunCtx ctx =
buildsCtxMap.computeIfAbsent(build.buildTypeId, k -> new
MultBuildRunCtx(build));
-
- ctx.addBuild(teamcity.loadTestsAndProblems(build, ctx));
- });
+ Stream<? extends BuildRef> uniqueBuldsInvolved = entryPoints.stream()
+ .parallel()
+ .unordered()
+ .flatMap(ref -> dependencies(teamcity,
ref)).filter(Objects::nonNull)
+ .flatMap(ref -> dependencies(teamcity,
ref)).filter(Objects::nonNull)
+ .filter(ref -> ensureUnique(unique, ref));
+
+ uniqueBuldsInvolved
+ .map((buildRef) -> executor.submit(
+ () -> replaceWithRecent(teamcity,
includeLatestRebuild, unique, buildRef, entryPoints.size())))
+ .map(FutureUtil::getResult)
+ .map((s) -> executor.submit(
+ () -> processBuildList(teamcity, buildsCtxMap, s)))
+ .forEach(FutureUtil::getResult);
ArrayList<MultBuildRunCtx> contexts = new
ArrayList<>(buildsCtxMap.values());
@@ -179,6 +160,56 @@ public class BuildChainProcessor {
return fullChainRunCtx;
}
+ @NotNull
+ public static Stream<? extends BuildRef> processBuildList(ITeamcity
teamcity,
+ Map<String,
MultBuildRunCtx> buildsCtxMap,
+ Stream<? extends
BuildRef> list) {
+ list.forEach((BuildRef ref) -> {
+ processBuildAndAddToCtx(teamcity, buildsCtxMap, ref);
+ });
+
+ return list;
+ }
+
+ public static void processBuildAndAddToCtx(ITeamcity teamcity, Map<String,
MultBuildRunCtx> buildsCtxMap, BuildRef buildRef) {
+ Build build = teamcity.getBuild(buildRef.href);
+
+ if (build == null || build.isFakeStub())
+ return;
+
+ MultBuildRunCtx ctx = buildsCtxMap.computeIfAbsent(build.buildTypeId,
k -> new MultBuildRunCtx(build));
+
+ ctx.addBuild(teamcity.loadTestsAndProblems(build, ctx));
+ }
+
+ @NotNull
+ public static Stream< BuildRef> replaceWithRecent(ITeamcity teamcity,
+ LatestRebuildMode
includeLatestRebuild,
+ Map<Integer, BuildRef>
unique, BuildRef buildRef, int countLimit) {
+ if (includeLatestRebuild == LatestRebuildMode.NONE)
+ return Stream.of(buildRef);
+
+ final String branch = getBranchOrDefault(buildRef.branchName);
+
+ final List<BuildRef> builds =
teamcity.getFinishedBuilds(buildRef.buildTypeId, branch);
+
+ if (includeLatestRebuild == LatestRebuildMode.LATEST) {
+ BuildRef recentRef =
builds.stream().max(Comparator.comparing(BuildRef::getId)).orElse(buildRef);
+
+ return Stream.of(recentRef.isFakeStub() ? buildRef : recentRef);
+ }
+
+ if (includeLatestRebuild == LatestRebuildMode.ALL) {
+ return builds.stream()
+ .filter(ref -> !ref.isFakeStub())
+ .filter(ref -> ensureUnique(unique, ref))
+ .sorted(Comparator.comparing(BuildRef::getId).reversed())
+ .limit(countLimit); // applying same limit
+ }
+
+ throw new UnsupportedOperationException("invalid mode " +
includeLatestRebuild);
+ }
+
@NotNull private static String getBranchOrDefault(@Nullable String
branchName) {
return branchName == null ? ITeamcity.DEFAULT : branchName;
}
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
index 641c9db..903df75 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
@@ -20,18 +20,13 @@ package org.apache.ignite.ci;
import com.google.common.base.Strings;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
import com.google.inject.Injector;
import org.apache.ignite.Ignite;
import org.apache.ignite.ci.conf.BranchesTracked;
import org.apache.ignite.ci.di.IServerProv;
-import org.apache.ignite.ci.observer.BuildObserver;
import org.apache.ignite.ci.issue.IssueDetector;
import org.apache.ignite.ci.issue.IssuesStorage;
+import org.apache.ignite.ci.observer.BuildObserver;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.user.ICredentialsProv;
import org.apache.ignite.ci.user.UserAndSessionsStorage;
@@ -44,15 +39,15 @@ import
org.apache.ignite.ci.web.model.current.TestFailuresSummary;
import org.apache.ignite.ci.web.model.hist.FailureSummary;
import org.apache.ignite.ci.web.rest.pr.GetPrTestFailures;
import org.jetbrains.annotations.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import java.util.Collection;
+import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.apache.ignite.ci.analysis.RunStat.MAX_LATEST_RUNS;
import static org.apache.ignite.ci.util.XmlUtil.xmlEscapeText;
@@ -188,7 +183,8 @@ public class TcHelper implements ITcHelper {
String comment;
try {
- comment = generateJiraComment(buildTypeId, build.branchName,
srvId, prov, build.webUrl);
+ comment = generateJiraComment(buildTypeId, build.branchName,
srvId, prov, build.webUrl,
+ getService());
}
catch (RuntimeException e) {
logger.error("Exception happened during generating comment for
JIRA " +
@@ -210,19 +206,21 @@ public class TcHelper implements ITcHelper {
* @param srvId Server id.
* @param prov Credentials.
* @param webUrl Build URL.
+ * @param executorService Executor service to process TC communication
requests there.
* @return Comment, which should be sent to the JIRA ticket.
*/
private String generateJiraComment(
- String buildTypeId,
- String branchForTc,
- String srvId,
- ICredentialsProv prov,
- String webUrl
+ String buildTypeId,
+ String branchForTc,
+ String srvId,
+ ICredentialsProv prov,
+ String webUrl,
+ @Nullable ExecutorService executorService
) {
StringBuilder res = new StringBuilder();
TestFailuresSummary summary = GetPrTestFailures.getTestFailuresSummary(
this, prov, srvId, buildTypeId, branchForTc,
- "Latest", null, null);
+ "Latest", null, null, executorService);
if (summary != null) {
for (ChainAtServerCurrentStatus server : summary.servers) {
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
index 56ca643..e6b3eb6 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
@@ -23,11 +23,11 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.Cache;
+
+import com.google.common.util.concurrent.MoreExecutors;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.ci.HelperConfig;
@@ -386,15 +386,18 @@ public class IssueDetector {
private void checkFailuresEx() {
int buildsToQry =
EventTemplates.templates.stream().mapToInt(EventTemplate::cntEvents).max().getAsInt();
+ ExecutorService executor = MoreExecutors.newDirectExecutorService();
+
GetTrackedBranchTestResults.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME,
- false, buildsToQry, backgroundOpsTcHelper, backgroundOpsCreds);
+ false, buildsToQry, backgroundOpsTcHelper, backgroundOpsCreds,
executor);
TestFailuresSummary failures =
GetTrackedBranchTestResults.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME,
false,
1,
backgroundOpsTcHelper,
- backgroundOpsCreds);
+ backgroundOpsCreds,
+ executor);
registerIssuesLater(failures, backgroundOpsTcHelper,
backgroundOpsCreds);
}
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/CheckBuildChainResults.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/CheckBuildChainResults.java
index 1005b2f..e587d79 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/CheckBuildChainResults.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/CheckBuildChainResults.java
@@ -29,6 +29,8 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
+import com.google.common.util.concurrent.MoreExecutors;
import org.apache.ignite.Ignite;
import org.apache.ignite.ci.BuildChainProcessor;
import org.apache.ignite.ci.ITeamcity;
@@ -217,7 +219,8 @@ public class CheckBuildChainResults {
FullChainRunCtx ctx =
BuildChainProcessor.loadChainsContext(teamcity,
singletonList(next),
LatestRebuildMode.NONE,
- ProcessLogsMode.DISABLED, null, false, null,
ITeamcity.DEFAULT);
+ ProcessLogsMode.DISABLED, null, false, null,
+ ITeamcity.DEFAULT,
MoreExecutors.newDirectExecutorService());
if (ctx == null)
return null;
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/ExceptionUtil.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/ExceptionUtil.java
index c1741d1..f994f20 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/ExceptionUtil.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/ExceptionUtil.java
@@ -30,6 +30,9 @@ public class ExceptionUtil {
* @param e Exception.
*/
public static RuntimeException propagateException(Exception e) {
+ if (e instanceof InterruptedException)
+ Thread.currentThread().interrupt();
+
final Optional<Throwable> any = Throwables.getCausalChain(e)
.stream()
.filter(th -> (th instanceof
ServiceUnauthorizedException)).findAny();
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/FutureUtil.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/FutureUtil.java
index f2a3ddc..4309ce1 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/FutureUtil.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/FutureUtil.java
@@ -53,4 +53,30 @@ public class FutureUtil {
return logCheckRes;
}
+
+ /**
+ * @param fut Future.
+ * @return result or null if calculation failed
+ */
+ @Nullable public static <V> V getResult(Future<V> fut) {
+ V logCheckRes = null;
+
+ try {
+ logCheckRes = fut.get();
+ }
+ catch (InterruptedException e) {
+ logger.info("Future get reported interrupt ", e);
+
+ throw ExceptionUtil.propagateException(e);
+ }
+ catch (ExecutionException e) {
+ e.printStackTrace();
+
+ logger.error("Failed to get future result", e);
+
+ throw ExceptionUtil.propagateException(e);
+ }
+
+ return logCheckRes;
+ }
}
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
index 579bd04..3622f29 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
public class TcUpdatePool {
private ThreadFactory threadFactory = Executors.defaultThreadFactory();
- private ExecutorService service = Executors.newFixedThreadPool(32, r -> {
+ private ExecutorService service = Executors.newFixedThreadPool(100, r -> {
Thread thread = threadFactory.newThread(r);
thread.setName("tc-upd-" + thread.getName());
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 024b08e..1a08ce6 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
@@ -22,7 +22,7 @@ package org.apache.ignite.ci.web.model;
public static final String DEFAULT_CONTACT = "[email protected]";
/** TC Helper Version. */
- public String version = "20180917";
+ public String version = "20180919";
/** Ignite version. */
public String ignVer;
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
index 710b7c0..8529683 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
@@ -28,6 +28,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
+
+import com.google.common.util.concurrent.MoreExecutors;
import org.apache.ignite.ci.BuildChainProcessor;
import org.apache.ignite.ci.ITeamcity;
import org.apache.ignite.ci.IgnitePersistentTeamcity;
@@ -72,7 +74,7 @@ public class GetChainResultsAsHtml {
BuildChainProcessor.processBuildChains(teamcity,
LatestRebuildMode.NONE,
Collections.singletonList(build),
ProcessLogsMode.SUITE_NOT_COMPLETE,
- false, false, teamcity, failRateBranch);
+ false, false, teamcity, failRateBranch,
MoreExecutors.newDirectExecutorService());
ctxOptional.ifPresent(ctx -> {
ChainAtServerCurrentStatus status = new
ChainAtServerCurrentStatus(teamcity.serverId(), ctx.branchName());
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
index 5c860c6..0d8b69e 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
@@ -17,19 +17,6 @@
package org.apache.ignite.ci.web.rest.build;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
import org.apache.ignite.ci.BuildChainProcessor;
import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
import org.apache.ignite.ci.ITcHelper;
@@ -50,6 +37,20 @@ import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicInteger;
+
import static com.google.common.base.Strings.isNullOrEmpty;
@Path(GetBuildTestFailures.BUILD)
@@ -130,7 +131,7 @@ public class GetBuildTestFailures {
BuildChainProcessor.processBuildChains(teamcity,
LatestRebuildMode.NONE,
Collections.singletonList(build),
(checkAllLogs != null && checkAllLogs) ?
ProcessLogsMode.ALL : ProcessLogsMode.SUITE_NOT_COMPLETE,
- false, false, teamcity, failRateBranch);
+ false, false, teamcity, failRateBranch,
CtxListener.getPool(context));
pubCtx.ifPresent(ctx -> {
final ChainAtServerCurrentStatus chainStatus = new
ChainAtServerCurrentStatus(serverId, ctx.branchName());
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
index a8a7bb7..fc21717 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ci.web.rest.pr;
import com.google.common.base.Strings;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
+
import org.apache.ignite.ci.*;
import org.apache.ignite.ci.analysis.FullChainRunCtx;
import org.apache.ignite.ci.analysis.mode.LatestRebuildMode;
@@ -48,6 +49,7 @@ import javax.ws.rs.core.MediaType;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@@ -58,7 +60,7 @@ public class GetPrTestFailures {
public static final String CURRENT_PR_FAILURES = "currentPrFailures";
@Context
- private ServletContext context;
+ private ServletContext ctx;
@Context
private HttpServletRequest req;
@@ -86,7 +88,7 @@ public class GetPrTestFailures {
@Nullable @QueryParam("count") Integer cnt,
@Nullable @QueryParam("baseBranchForTc") String baseBranchForTc) {
- final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(context);
+ final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(ctx);
final FullQueryParams key = new FullQueryParams(srvId, suiteId,
branchForTc, act, cnt, baseBranchForTc);
@@ -115,10 +117,11 @@ public class GetPrTestFailures {
@Nullable @QueryParam("count") Integer cnt,
@Nullable @QueryParam("baseBranchForTc") String baseBranchForTc) {
- final ITcHelper tcHelper = CtxListener.getTcHelper(context);
+ final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
final ICredentialsProv creds = ICredentialsProv.get(req);
- return getTestFailuresSummary(tcHelper, creds, srvId, suiteId,
branchForTc, act, cnt, baseBranchForTc);
+ return getTestFailuresSummary(tcHelper, creds, srvId, suiteId,
branchForTc, act, cnt, baseBranchForTc,
+ CtxListener.getPool(ctx));
}
/**
@@ -130,17 +133,19 @@ public class GetPrTestFailures {
* @param act Action.
* @param cnt Count.
* @param baseBranchForTc Base branch name in TC identification.
+ * @param executorService Executor service to process TC communication
requests there.
* @return Test failures summary.
*/
public static TestFailuresSummary getTestFailuresSummary(
- ITcHelper helper,
- ICredentialsProv creds,
- String srvId,
- String suiteId,
- String branchForTc,
- String act,
- Integer cnt,
- @Nullable String baseBranchForTc) {
+ ITcHelper helper,
+ ICredentialsProv creds,
+ String srvId,
+ String suiteId,
+ String branchForTc,
+ String act,
+ Integer cnt,
+ @Nullable String baseBranchForTc,
+ @Nullable ExecutorService executorService) {
final TestFailuresSummary res = new TestFailuresSummary();
final AtomicInteger runningUpdates = new AtomicInteger();
@@ -184,7 +189,7 @@ public class GetPrTestFailures {
Optional<FullChainRunCtx> pubCtx =
BuildChainProcessor.processBuildChains(teamcity, rebuild, chains,
logs,
singleBuild,
- true, teamcity, baseBranch);
+ true, teamcity, baseBranch, executorService);
final ChainAtServerCurrentStatus chainStatus = new
ChainAtServerCurrentStatus(teamcity.serverId(), branchForTc);
@@ -224,7 +229,7 @@ public class GetPrTestFailures {
if (!branchForTc.startsWith("pull/"))
return "Given branch is not a pull request. Notify works only for
pull requests.";
- ITcHelper tcHelper = CtxListener.getTcHelper(context);
+ ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
final ICredentialsProv creds = ICredentialsProv.get(req);
try (IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId,
creds)) {
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java
index b5dbc80..d589e0b 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java
@@ -47,6 +47,7 @@ import javax.ws.rs.core.MediaType;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@@ -60,7 +61,7 @@ public class GetTrackedBranchTestResults {
public static final String ALL_TEST_FAILURES_SUMMARY =
"AllTestFailuresSummary";
@Context
- private ServletContext context;
+ private ServletContext ctx;
@Context
private HttpServletRequest request;
@@ -86,7 +87,7 @@ public class GetTrackedBranchTestResults {
@Nullable @QueryParam("branch") String branchOrNull,
@Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs) {
- final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(context);
+ final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(ctx);
FullQueryParams param = new FullQueryParams();
param.setBranch(branchOrNull);
@@ -104,10 +105,11 @@ public class GetTrackedBranchTestResults {
@Nullable @QueryParam("branch") String branch,
@Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs) {
- final ITcHelper helper = CtxListener.getTcHelper(context);
+ final ITcHelper helper = CtxListener.getTcHelper(ctx);
final ICredentialsProv creds = ICredentialsProv.get(request);
- return getTrackedBranchTestFailures(branch, checkAllLogs, 1, helper,
creds);
+ return getTrackedBranchTestFailures(branch, checkAllLogs, 1, helper,
creds,
+ CtxListener.getPool(ctx));
}
@GET
@@ -124,7 +126,7 @@ public class GetTrackedBranchTestResults {
public TestFailuresSummary getAllTestFails(@Nullable @QueryParam("branch")
String branchOrNull,
@Nullable @QueryParam("count")
Integer count,
@Nullable
@QueryParam("checkAllLogs") Boolean checkAllLogs) {
- final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(context);
+ final BackgroundUpdater updater =
CtxListener.getBackgroundUpdater(ctx);
FullQueryParams fullKey = new FullQueryParams();
fullKey.setBranch(branchOrNull);
fullKey.setCount(count == null ? FullQueryParams.DEFAULT_COUNT :
count);
@@ -146,7 +148,8 @@ public class GetTrackedBranchTestResults {
@Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs,
int buildResultMergeCnt,
ITcHelper helper,
- ICredentialsProv creds) {
+ ICredentialsProv creds,
+ @Nullable ExecutorService pool) {
final TestFailuresSummary res = new TestFailuresSummary();
final AtomicInteger runningUpdates = new AtomicInteger();
@@ -193,7 +196,8 @@ public class GetTrackedBranchTestResults {
Optional<FullChainRunCtx> chainCtxOpt
= BuildChainProcessor.processBuildChains(teamcity,
rebuild, chains, logs,
- includeScheduled, true, teamcity, baseBranchTc);
+ includeScheduled, true, teamcity, baseBranchTc,
+ pool);
chainCtxOpt.ifPresent(ctx -> {
int cnt = (int)ctx.getRunningUpdates().count();
@@ -221,10 +225,10 @@ public class GetTrackedBranchTestResults {
public TestFailuresSummary getAllTestFailsNoCache(@Nullable
@QueryParam("branch") String branchOpt,
@QueryParam("count")
Integer cnt,
@Nullable
@QueryParam("checkAllLogs") Boolean checkAllLogs) {
- final ITcHelper helper = CtxListener.getTcHelper(context);
+ final ITcHelper helper = CtxListener.getTcHelper(ctx);
final ICredentialsProv creds = ICredentialsProv.get(request);
int cntLimit = cnt == null ? FullQueryParams.DEFAULT_COUNT : cnt;
- return getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit,
helper, creds );
+ return getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit,
helper, creds, CtxListener.getPool(ctx));
}
}
diff --git a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
index dfa57a9..2d5a968 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/common-1.6.js
@@ -118,7 +118,7 @@ function showMenu(menuData) {
res += "<div class=\"navbar\">";
res += "<a href=\"/\">Home</a>";
res += "<a href=\"/compare.html\">Compare builds</a>";
- res += "<a href=\"/services.html\">Services</a>";
+ res += "<a href=\"/services.html\">PR/Branch check</a>";
res += "<div class='topnav-right'>";
diff --git a/jetty-launcher/build.gradle b/jetty-launcher/build.gradle
index de553be..b9560b6 100644
--- a/jetty-launcher/build.gradle
+++ b/jetty-launcher/build.gradle
@@ -29,7 +29,7 @@ repositories {
mainClassName = 'org.apache.ignite.ci.TcHelperJettyLauncher'
applicationDefaultJvmArgs = ["-Dteamcity.helper.home=../work",
"-Dteamcity.bot.regionsize=16", // 16g Durable
Memory region
- "-Dhttp.maxConnections=30",
+ "-Dhttp.maxConnections=100",
"-server",
"-Xmx10g",
"-XX:+AlwaysPreTouch",