Package org.apache.twill.api.logging

Examples of org.apache.twill.api.logging.PrinterLogHandler


  @Test
  public void testAppSessionExpire() throws InterruptedException, ExecutionException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new SleepRunnable(600))
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                       .start();

    final CountDownLatch runLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
View Full Code Here


  @Test
  public void testContainerSize() throws InterruptedException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new SleepApp())
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();

    try {
      ServiceDiscovered discovered = controller.discoverService("sleep");
      Assert.assertTrue(YarnTestUtils.waitForSize(discovered, 2, 60));
View Full Code Here

    YarnTwillRunnerService runner = (YarnTwillRunnerService) YarnTestUtils.getTwillRunner();
    runner.startAndWait();

    TwillController controller = runner.prepare(new DummyApplication())
                                       .enableDebugging("r1")
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                       .start();
    final CountDownLatch running = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
View Full Code Here

    YarnTwillRunnerService runner = (YarnTwillRunnerService) YarnTestUtils.getTwillRunner();
    runner.startAndWait();

    TwillController controller = runner.prepare(new DummyApplication())
                                       .enableDebugging()
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                       .start();
    final CountDownLatch running = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
      @Override
      public void running() {
View Full Code Here

  @Test
  public void testServiceDiscovery() throws InterruptedException, ExecutionException, TimeoutException {
    TwillRunner twillRunner = YarnTestUtils.getTwillRunner();
    TwillController controller = twillRunner
      .prepare(new ServiceApplication())
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withArguments("r1", "12345")
      .withArguments("r2", "45678")
      .start();

    ListenableFuture<Service.State> completion = Services.getCompletionFuture(controller);
View Full Code Here

    TwillController controller = runner.prepare(new LocalFileApplication())
      .addJVMOptions(" -verbose:gc -Xloggc:gc.log -XX:+PrintGCDetails")
      .withApplicationArguments("local")
      .withArguments("LocalFileSocketServer", "local2")
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();

    Iterable<Discoverable> discoverables = controller.discoverService("local");
    Assert.assertTrue(YarnTestUtils.waitForSize(discoverables, 1, 60));
View Full Code Here

                                                ResourceSpecification.Builder.with()
                                                         .setVirtualCores(1)
                                                         .setMemory(1, ResourceSpecification.SizeUnit.GIGA)
                                                         .setInstances(2)
                                                         .build())
                                        .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                        .withApplicationArguments("echo")
                                        .withArguments("EchoServer", "echo2")
                                        .start();

    final CountDownLatch running = new CountDownLatch(1);
View Full Code Here

      }
    };

    TwillRunner runner = YarnTestUtils.getTwillRunner();
    TwillController controller = runner.prepare(new LogRunnable())
                                       .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                       .addLogHandler(logHandler)
                                       .start();

    Services.getCompletionFuture(controller).get();
    latch.await(1, TimeUnit.SECONDS);
View Full Code Here

  public void addLogHandler(String flowName, PrintStream out) {
    try {
      Iterable<TwillController> iterable = lookupFlow(flowName);
      if (iterable.iterator().hasNext()) {
        TwillController controller = iterable.iterator().next();
        controller.addLogHandler(new PrinterLogHandler(new PrintWriter(out, true)));
      }
    } catch (Exception e) {
      LOG.warn(e.getMessage(), e);
    }
  }
View Full Code Here

    return cConfFile;
  }

  private TwillPreparer getPreparer() {
    return prepare(twillRunnerService.prepare(twillApplication)
                     .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
    );
  }
View Full Code Here

TOP

Related Classes of org.apache.twill.api.logging.PrinterLogHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.