Package org.apache.twill.api

Examples of org.apache.twill.api.TwillSpecification$Builder$AfterName


  }

  @Override
  public TwillPreparer prepare(TwillApplication application) {
    Preconditions.checkState(isRunning(), "Service not start. Please call start() first.");
    final TwillSpecification twillSpec = application.configure();
    final String appName = twillSpec.getName();

    return new YarnTwillPreparer(yarnConfig, twillSpec, yarnAppClient, zkClientService, locationFactory, jvmOptions,
                                 new YarnTwillControllerFactory() {
      @Override
      public YarnTwillController create(RunId runId, Iterable<LogHandler> logHandlers,
View Full Code Here


  }

  @Override
  public TwillPreparer prepare(TwillApplication application) {
    Preconditions.checkState(isRunning(), "Service not start. Please call start() first.");
    final TwillSpecification twillSpec = application.configure();
    final String appName = twillSpec.getName();

    return new YarnTwillPreparer(yarnConfig, twillSpec, yarnAppClient, zkClientService, locationFactory,
                                 Suppliers.ofInstance(jvmOptions),
                                 new YarnTwillControllerFactory() {
      @Override
View Full Code Here

    }
  }

  @Test
  public void testAnyOrder() {
    TwillSpecification spec =
      TwillSpecification.Builder.with()
        .setName("Testing")
        .withRunnable()
        .add("r1", new DummyRunnable()).noLocalFiles()
        .add("r2", new DummyRunnable()).noLocalFiles()
        .add("r3", new DummyRunnable()).noLocalFiles()
        .anyOrder()
        .build();

    Assert.assertEquals(3, spec.getRunnables().size());
    List<TwillSpecification.Order> orders = spec.getOrders();
    Assert.assertEquals(1, orders.size());
    Assert.assertEquals(ImmutableSet.of("r1", "r2", "r3"), orders.get(0).getNames());
  }
View Full Code Here

    Assert.assertEquals(ImmutableSet.of("r1", "r2", "r3"), orders.get(0).getNames());
  }

  @Test
  public void testOrder() {
    TwillSpecification spec =
      TwillSpecification.Builder.with()
        .setName("Testing")
        .withRunnable()
        .add("r1", new DummyRunnable()).noLocalFiles()
        .add("r2", new DummyRunnable()).noLocalFiles()
        .add("r3", new DummyRunnable()).noLocalFiles()
        .add("r4", new DummyRunnable()).noLocalFiles()
        .withOrder().begin("r1", "r2").nextWhenStarted("r3")
        .build();

    Assert.assertEquals(4, spec.getRunnables().size());
    List<TwillSpecification.Order> orders = spec.getOrders();
    Assert.assertEquals(3, orders.size());
    Assert.assertEquals(ImmutableSet.of("r1", "r2"), orders.get(0).getNames());
    Assert.assertEquals(ImmutableSet.of("r3"), orders.get(1).getNames());
    Assert.assertEquals(ImmutableSet.of("r4"), orders.get(2).getNames());
  }
View Full Code Here

        ZKClients.retryOnFailure(ZKClientService.Builder.of(zkConnectStr).build(),
                                 RetryStrategies.fixDelay(1, TimeUnit.SECONDS))));

    ZKDiscoveryService discoveryService = new ZKDiscoveryService(zkClientService);

    TwillSpecification twillSpec = loadTwillSpec(twillSpecFile);
    renameLocalFiles(twillSpec.getRunnables().get(runnableName));
   
    TwillRunnableSpecification runnableSpec = twillSpec.getRunnables().get(runnableName).getRunnableSpecification();
    ContainerInfo containerInfo = new EnvContainerInfo();
    Arguments arguments = decodeArgs();
    BasicTwillContext context = new BasicTwillContext(
      runId, appRunId, containerInfo.getHost(),
      arguments.getRunnableArguments().get(runnableName).toArray(new String[0]),
View Full Code Here

        ZKClients.retryOnFailure(ZKClientService.Builder.of(zkConnectStr).build(),
                                 RetryStrategies.fixDelay(1, TimeUnit.SECONDS))));

    DiscoveryService discoveryService = new ZKDiscoveryService(zkClientService);

    TwillSpecification twillSpec = loadTwillSpec(twillSpecFile);
    renameLocalFiles(twillSpec.getRunnables().get(runnableName));
   
    TwillRunnableSpecification runnableSpec = twillSpec.getRunnables().get(runnableName).getRunnableSpecification();
    ContainerInfo containerInfo = new EnvContainerInfo();
    Arguments arguments = decodeArgs();
    BasicTwillContext context = new BasicTwillContext(
      runId, appRunId, containerInfo.getHost(),
      arguments.getRunnableArguments().get(runnableName).toArray(new String[0]),
View Full Code Here

  }

  @Override
  public TwillPreparer prepare(TwillApplication application) {
    Preconditions.checkState(isRunning(), "Service not start. Please call start() first.");
    final TwillSpecification twillSpec = application.configure();
    final String appName = twillSpec.getName();

    return new YarnTwillPreparer(yarnConfig, twillSpec, yarnAppClient, zkClientService, locationFactory,
                                 Suppliers.ofInstance(jvmOptions),
                                 new YarnTwillControllerFactory() {
      @Override
View Full Code Here

  @Override
  public ServiceSpecification deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
    throws JsonParseException {
    JsonObject jsonObj = (JsonObject) json;
    String className = jsonObj.get("classname").getAsString();
    TwillSpecification spec = adapter.fromJson(jsonObj.get("spec").getAsString());
    return new DefaultServiceSpecification(className, spec);
  }
View Full Code Here

TOP

Related Classes of org.apache.twill.api.TwillSpecification$Builder$AfterName

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.