Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sa/using-vertx-cli' into sa/usin…
Browse files Browse the repository at this point in the history
…g-vertx-cli
  • Loading branch information
ShamsUlAzeem committed Apr 21, 2020
2 parents e00a83b + 512bb17 commit 32b220e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,19 @@
import ai.konduit.serving.launcher.LauncherUtils;
import ai.konduit.serving.util.ObjectMappers;
import ai.konduit.serving.verticles.inference.InferenceVerticle;
import io.micrometer.prometheus.PrometheusConfig;
import io.micrometer.prometheus.PrometheusMeterRegistry;
import io.vertx.core.*;
import io.vertx.core.impl.VertxImpl;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.logging.SLF4JLogDelegateFactory;
import io.vertx.micrometer.MicrometerMetricsOptions;
import io.vertx.micrometer.VertxPrometheusOptions;
import io.vertx.micrometer.backends.BackendRegistries;
import lombok.extern.slf4j.Slf4j;
import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;

import java.io.File;
import java.util.concurrent.TimeUnit;

import static io.vertx.core.file.FileSystemOptions.DEFAULT_FILE_CACHING_DIR;
import static io.vertx.core.file.impl.FileResolver.CACHE_DIR_BASE_PROP_NAME;
import static io.vertx.core.file.impl.FileResolver.DISABLE_CP_RESOLVING_PROP_NAME;
import static io.vertx.core.logging.LoggerFactory.LOGGER_DELEGATE_FACTORY_CLASS_NAME;
import static java.lang.System.setProperty;

@Slf4j
public class DeployKonduitServing {

Expand All @@ -49,12 +45,34 @@ public class DeployKonduitServing {
}

public static void deployInference(DeploymentOptions deploymentOptions, Handler<AsyncResult<InferenceConfiguration>> eventHandler) {
deployInference(new VertxOptions().setMaxEventLoopExecuteTime(120).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS),
MicrometerMetricsOptions micrometerMetricsOptions = new MicrometerMetricsOptions()
.setMicrometerRegistry(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT))
.setPrometheusOptions(new VertxPrometheusOptions()
.setEnabled(true));

log.info("Setup micro meter options.");
BackendRegistries.setupBackend(micrometerMetricsOptions);

deployInference(new VertxOptions()
.setMaxEventLoopExecuteTime(120)
.setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS)
.setMetricsOptions(micrometerMetricsOptions),
deploymentOptions, eventHandler);
}

public static void deployInference(InferenceConfiguration inferenceConfiguration, Handler<AsyncResult<InferenceConfiguration>> eventHandler) {
deployInference(new VertxOptions().setMaxEventLoopExecuteTime(120).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS),
MicrometerMetricsOptions micrometerMetricsOptions = new MicrometerMetricsOptions()
.setMicrometerRegistry(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT))
.setPrometheusOptions(new VertxPrometheusOptions()
.setEnabled(true));

log.info("Setup micro meter options.");
BackendRegistries.setupBackend(micrometerMetricsOptions);

deployInference(new VertxOptions()
.setMaxEventLoopExecuteTime(120)
.setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS)
.setMetricsOptions(micrometerMetricsOptions),
new DeploymentOptions().setConfig(new JsonObject(inferenceConfiguration.toJson())), eventHandler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@

import ai.konduit.serving.InferenceConfiguration;
import ai.konduit.serving.util.ObjectMappers;
import io.micrometer.prometheus.PrometheusConfig;
import io.micrometer.prometheus.PrometheusMeterRegistry;
import io.vertx.core.*;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.impl.VertxImpl;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.logging.SLF4JLogDelegateFactory;
import io.vertx.micrometer.MicrometerMetricsOptions;
import io.vertx.micrometer.VertxPrometheusOptions;
import io.vertx.micrometer.backends.BackendRegistries;
import lombok.extern.slf4j.Slf4j;
import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;

Expand Down Expand Up @@ -66,12 +71,34 @@ public class DeployKonduitOrchestration {
public static final String NODE_COMMUNICATION_TOPIC = "NodeCommunication";

public static void deployInferenceClustered(DeploymentOptions deploymentOptions, Handler<AsyncResult<InferenceConfiguration>> eventHandler) {
deployInferenceClustered(new VertxOptions().setMaxEventLoopExecuteTime(120).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS),
MicrometerMetricsOptions micrometerMetricsOptions = new MicrometerMetricsOptions()
.setMicrometerRegistry(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT))
.setPrometheusOptions(new VertxPrometheusOptions()
.setEnabled(true));

log.info("Setup micro meter options.");
BackendRegistries.setupBackend(micrometerMetricsOptions);

deployInferenceClustered(new VertxOptions()
.setMaxEventLoopExecuteTime(120)
.setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS)
.setMetricsOptions(micrometerMetricsOptions),
deploymentOptions, eventHandler);
}

public static void deployInferenceClustered(InferenceConfiguration inferenceConfiguration, Handler<AsyncResult<InferenceConfiguration>> eventHandler) {
deployInferenceClustered(new VertxOptions().setMaxEventLoopExecuteTime(120).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS),
MicrometerMetricsOptions micrometerMetricsOptions = new MicrometerMetricsOptions()
.setMicrometerRegistry(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT))
.setPrometheusOptions(new VertxPrometheusOptions()
.setEnabled(true));

log.info("Setup micro meter options.");
BackendRegistries.setupBackend(micrometerMetricsOptions);

deployInferenceClustered(new VertxOptions()
.setMaxEventLoopExecuteTime(120)
.setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS)
.setMetricsOptions(micrometerMetricsOptions),
new DeploymentOptions().setConfig(new JsonObject(inferenceConfiguration.toJson())), eventHandler);
}

Expand Down

0 comments on commit 32b220e

Please sign in to comment.