From f4ca10b7afaad92ca8282af79b0093f40f416328 Mon Sep 17 00:00:00 2001 From: Nick Molcanov <32801560+nck-mlcnv@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:45:47 +0200 Subject: [PATCH] fix usage of wrong list in Stressttest --- .../aksw/iguana/cc/tasks/impl/Stresstest.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java b/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java index 18a1b7bba..fcbe89c0e 100644 --- a/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java +++ b/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java @@ -1,8 +1,6 @@ package org.aksw.iguana.cc.tasks.impl; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import org.aksw.iguana.cc.tasks.Task; import org.aksw.iguana.cc.worker.HttpWorker; import org.aksw.iguana.cc.worker.ResponseBodyProcessorInstances; @@ -23,25 +21,23 @@ public class Stresstest implements Task { public record Config( List warmupWorkers, @JsonProperty(required = true) List workers - ) implements Task.Config { - } - - - private final long stresstestId; - private final Config config; + ) implements Task.Config {} public record PhaseExecutionConfig( String name, List workers - ) { - } + ) {} public record Result( long stresstestId, List warmup, List main - ) implements Task.Config { - } + ) implements Task.Config {} + + + private final long stresstestId; + private final Config config; + private static final Logger LOGGER = LoggerFactory.getLogger(Stresstest.class); @@ -53,13 +49,14 @@ public Stresstest(long stresstestId, Config config, ResponseBodyProcessorInstanc this.stresstestId = stresstestId; this.config = config; long workerId = 0; - if (config.warmupWorkers() != null) + if (config.warmupWorkers() != null) { for (HttpWorker.Config workerConfig : config.warmupWorkers()) { for (int i = 0; i < workerConfig.number(); i++) { var responseBodyProcessor = (workerConfig.parseResults()) ? responseBodyProcessorInstances.getProcessor(workerConfig.acceptHeader()) : null; warmupWorkers.add(new SPARQLProtocolWorker(workerId++, responseBodyProcessor, (SPARQLProtocolWorker.Config) workerConfig)); } } + } for (HttpWorker.Config workerConfig : config.workers()) { for (int i = 0; i < workerConfig.number(); i++) { @@ -71,7 +68,6 @@ public Stresstest(long stresstestId, Config config, ResponseBodyProcessorInstanc public Result run() { try { - var warmupResults = executeWorkers(warmupWorkers); var results = executeWorkers(workers); @@ -86,7 +82,7 @@ public Result run() { private List executeWorkers(List workers) throws InterruptedException, ExecutionException { List results = new ArrayList<>(workers.size()); - var futures = warmupWorkers.stream().map(HttpWorker::start).toList(); + var futures = workers.stream().map(HttpWorker::start).toList(); CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).join(); for (CompletableFuture future : futures) results.add(future.get());