diff options
Diffstat (limited to 'opendc-web/opendc-web-runner-quarkus')
2 files changed, 6 insertions, 23 deletions
diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java index eccc8dcf..f5c056ef 100644 --- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java +++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java @@ -26,12 +26,11 @@ import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; import org.jboss.logging.Logger; -import org.opendc.web.client.runner.OpenDCRunnerClient; import org.opendc.web.runner.JobManager; import org.opendc.web.runner.OpenDCRunner; +import javax.enterprise.inject.spi.CDI; import java.io.File; -import java.net.URI; /** * Helper class for starting the OpenDC web runner. @@ -44,8 +43,6 @@ public class OpenDCRunnerRecorder { * Helper method to create an {@link OpenDCRunner} instance. */ public RuntimeValue<OpenDCRunner> createRunner(OpenDCRunnerRuntimeConfig config) { - URI apiUrl = URI.create(config.apiUrl); - int parallelism = config.parallelism; if (parallelism < 0) { throw new IllegalArgumentException("Parallelism must be non-negative"); @@ -53,9 +50,9 @@ public class OpenDCRunnerRecorder { parallelism = Math.min(1, Runtime.getRuntime().availableProcessors() - 1); } - OpenDCRunnerClient client = new OpenDCRunnerClient(apiUrl, null); + JobManager manager = CDI.current().select(JobManager.class).get(); OpenDCRunner runner = new OpenDCRunner( - JobManager.create(client), + manager, new File(config.tracePath), parallelism, config.jobTimeout, @@ -73,18 +70,10 @@ public class OpenDCRunnerRecorder { OpenDCRunnerRuntimeConfig config, ShutdownContext shutdownContext) { if (config.enable) { - LOGGER.info("Starting OpenDC Runner in background (polling " + config.apiUrl + ")"); - - Thread thread = new Thread(() -> { - try { - // Wait for some time to allow Vert.x to bind to the local port - Thread.sleep(4000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + LOGGER.info("Starting OpenDC Runner in background (polling every " + config.pollInterval + ")"); - runner.getValue().run(); - }); + Thread thread = new Thread(runner.getValue()); + thread.setName("opendc-runner"); thread.start(); shutdownContext.addShutdownTask(thread::interrupt); diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java index e1dbf0a8..e9258f06 100644 --- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java +++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java @@ -40,12 +40,6 @@ public class OpenDCRunnerRuntimeConfig { public boolean enable; /** - * The URI to the (local) API to communicate with. - */ - @ConfigItem(defaultValue = "http://${quarkus.http.host}:${quarkus.http.port}${quarkus.resteasy.path:}") - public String apiUrl; - - /** * The path where the workload traces are located. */ @ConfigItem(defaultValue = "traces") |
