Search in sources :

Example 1 with RunnerConfiguration

use of com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration in project concord by walmartlabs.

the class RunnerJobExecutor method getLogLevel.

private static String getLogLevel(RunnerJob job) {
    RunnerConfiguration cfg = job.getRunnerCfg();
    if (cfg == null) {
        return null;
    }
    String logLevel = cfg.logLevel();
    if (logLevel == null) {
        return null;
    }
    return logLevel.toUpperCase();
}
Also used : RunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration)

Example 2 with RunnerConfiguration

use of com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration in project concord by walmartlabs.

the class Main method main.

public static void main(String[] args) throws Exception {
    RunnerConfiguration runnerCfg = readRunnerConfiguration(args);
    // create the inject with all dependencies and services available before
    // the actual process' working directory is ready. It allows us to load
    // all dependencies and have them available in "pre-fork" situations
    Injector injector = InjectorFactory.createDefault(runnerCfg);
    try {
        ProcessConfiguration processCfg = injector.getInstance(ProcessConfiguration.class);
        ApiClient apiClient = injector.getInstance(ApiClient.class);
        ProcessHeartbeat heartbeat = new ProcessHeartbeat(apiClient, processCfg.instanceId(), runnerCfg.api().maxNoHeartbeatInterval());
        heartbeat.start();
        Main main = injector.getInstance(Main.class);
        main.execute();
        System.exit(0);
    } catch (MultiException e) {
        log.error(e.getMessage());
        System.exit(1);
    } catch (Throwable t) {
        log.error("", t);
        System.exit(1);
    }
}
Also used : ProcessHeartbeat(com.walmartlabs.concord.runtime.common.ProcessHeartbeat) ProcessConfiguration(com.walmartlabs.concord.runtime.v2.sdk.ProcessConfiguration) Injector(com.google.inject.Injector) RunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration) ApiClient(com.walmartlabs.concord.ApiClient) MultiException(com.walmartlabs.concord.svm.MultiException)

Example 3 with RunnerConfiguration

use of com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration in project concord by walmartlabs.

the class MainTest method testSegmentedLogging.

@Test
public void testSegmentedLogging() throws Exception {
    deploy("logging");
    save(ProcessConfiguration.builder().build());
    RunnerConfiguration runnerCfg = RunnerConfiguration.builder().logging(LoggingConfiguration.builder().sendSystemOutAndErrToSLF4J(false).build()).build();
    byte[] log = run(runnerCfg);
    assertLog(log, "^This goes directly into the stdout$");
    assertLog(log, ".*This is a processLog entry.*");
}
Also used : RunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration) ImmutableRunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.ImmutableRunnerConfiguration) Test(org.junit.jupiter.api.Test)

Example 4 with RunnerConfiguration

use of com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration in project concord by walmartlabs.

the class MainTest method testSystemOutRedirectInScripts.

@Test
public void testSystemOutRedirectInScripts() throws Exception {
    deploy("systemOutRedirect");
    save(ProcessConfiguration.builder().build());
    RunnerConfiguration runnerCfg = RunnerConfiguration.builder().logging(LoggingConfiguration.builder().build()).build();
    byte[] log = run(runnerCfg);
    assertLog(log, "^.*\\|1\\|.*System.out in a script.*");
}
Also used : RunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration) ImmutableRunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.ImmutableRunnerConfiguration) Test(org.junit.jupiter.api.Test)

Example 5 with RunnerConfiguration

use of com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration in project concord by walmartlabs.

the class MainTest method testContextInjectorWithSegmentedLogger.

@Test
public void testContextInjectorWithSegmentedLogger() throws Exception {
    deploy("injectorTest");
    RunnerConfiguration runnerCfg = RunnerConfiguration.builder().logging(LoggingConfiguration.builder().build()).build();
    save(ProcessConfiguration.builder().build());
    byte[] log = run(runnerCfg);
    assertLog(log, Pattern.quote("|0|1|1|0|0||70|2|0|0|0|") + ".*done!.*");
    assertLog(log, Pattern.quote("|0|2|1|0|0|"));
}
Also used : RunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration) ImmutableRunnerConfiguration(com.walmartlabs.concord.runtime.common.cfg.ImmutableRunnerConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

RunnerConfiguration (com.walmartlabs.concord.runtime.common.cfg.RunnerConfiguration)9 Injector (com.google.inject.Injector)3 ImmutableRunnerConfiguration (com.walmartlabs.concord.runtime.common.cfg.ImmutableRunnerConfiguration)3 Test (org.junit.jupiter.api.Test)3 ProcessConfiguration (com.walmartlabs.concord.runtime.v2.sdk.ProcessConfiguration)2 URLClassLoader (java.net.URLClassLoader)2 Path (java.nio.file.Path)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 AbstractModule (com.google.inject.AbstractModule)1 Module (com.google.inject.Module)1 ApiClient (com.walmartlabs.concord.ApiClient)1 DependencyManager (com.walmartlabs.concord.dependencymanager.DependencyManager)1 ImportManager (com.walmartlabs.concord.imports.ImportManager)1 ImportManagerFactory (com.walmartlabs.concord.imports.ImportManagerFactory)1 ImportProcessingException (com.walmartlabs.concord.imports.ImportProcessingException)1 ProcessHeartbeat (com.walmartlabs.concord.runtime.common.ProcessHeartbeat)1 ProjectLoaderV2 (com.walmartlabs.concord.runtime.v2.ProjectLoaderV2)1 ProjectSerializerV2 (com.walmartlabs.concord.runtime.v2.ProjectSerializerV2)1