Package org.apache.twill.api.logging

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


      .setInstances(2)
      .build();
    TwillController controller = runner.prepare(new FailureRunnable(), resource)
      .withApplicationArguments("failure")
      .withArguments(FailureRunnable.class.getSimpleName(), "failure2")
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .start();

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


      .setVirtualCores(1)
      .setMemory(2048, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(1)
      .build();
    TwillController controller = runner.prepare(new EnvironmentEchoServer(), resourceSpec)
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withApplicationArguments("envecho")
      .withArguments("EnvironmentEchoServer", "echo2")
      .start();

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

      .setVirtualCores(1)
      .setMemory(128, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(2)
      .build();
    TwillController controller = runner.prepare(new BuggyServer(), resourceSpec)
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
      .withApplicationArguments("echo")
      .withArguments("BuggyServer", "echo2")
      .start();

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

  public void testResourceReport() throws InterruptedException, ExecutionException, IOException,
    URISyntaxException, TimeoutException {
    TwillRunner runner = YarnTestUtils.getTwillRunner();

    TwillController controller = runner.prepare(new ResourceApplication())
                                        .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                        .withApplicationArguments("echo")
                                        .withArguments("echo1", "echo1")
                                        .withArguments("echo2", "echo2")
                                        .start();
View Full Code Here

  @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

                                                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

    TwillController controller = twillRunner.prepare(new SleepTask(),
                                                ResourceSpecification.Builder.with()
                                                  .setVirtualCores(1)
                                                  .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
                                                  .setInstances(3).build())
                                            .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out, true)))
                                            .start();

    final CountDownLatch runLatch = new CountDownLatch(1);
    final CountDownLatch stopLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
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

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

    Services.getCompletionFuture(controller).get(2, TimeUnit.MINUTES);
  }
View Full Code Here

  @Test
  public void testDistributedShell() throws InterruptedException {
    TwillRunner twillRunner = YarnTestUtils.getTwillRunner();

    TwillController controller = twillRunner.prepare(new DistributedShell("pwd", "ls -al"))
                                            .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out)))
                                            .start();

    final CountDownLatch stopLatch = new CountDownLatch(1);
    controller.addListener(new ServiceListenerAdapter() {
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.