Package org.apache.twill.api

Examples of org.apache.twill.api.ResourceSpecification$Builder$AfterDownlink


   */
  public static final class SleepApp implements TwillApplication {

    @Override
    public TwillSpecification configure() {
      ResourceSpecification largeRes = ResourceSpecification.Builder.with()
        .setVirtualCores(1)
        .setMemory(1024, ResourceSpecification.SizeUnit.MEGA)
        .build();

      ResourceSpecification smallRes = ResourceSpecification.Builder.with()
        .setVirtualCores(1)
        .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
        .build();

      return TwillSpecification.Builder.with()
View Full Code Here


                    "\"uplink\":100," +
                    "\"downlink\":100," +
                    "\"hosts\":[\"one1\",\"two2\"]," +
                    "\"racks\":[\"three3\"]" +
            "}";
    final ResourceSpecification expected =
            new DefaultResourceSpecification(2, 1024, 2, 100, 100,
                    Arrays.asList("one1", "two2"), Arrays.asList("three3"));
    final String actualString = gson.toJson(expected);
    Assert.assertEquals(expectedString, actualString);

    final JsonElement expectedJson = gson.toJsonTree(expected);
    final ResourceSpecification actual = gson.fromJson(expectedJson, DefaultResourceSpecification.class);
    final JsonElement actualJson = gson.toJsonTree(actual);

    Assert.assertEquals(expectedJson, actualJson);
    ReflectionAssert.assertLenientEquals(expected, actual);
  }
View Full Code Here

    ReflectionAssert.assertLenientEquals(expected, actual);
  }

  @Test
  public void testBuilder() throws Exception {
    final ResourceSpecification actual = ResourceSpecification.Builder.with()
            .setVirtualCores(5)
            .setMemory(4, ResourceSpecification.SizeUnit.GIGA)
            .setInstances(3)
            .setUplink(10, ResourceSpecification.SizeUnit.GIGA)
            .setDownlink(5, ResourceSpecification.SizeUnit.GIGA)
View Full Code Here

    ReflectionAssert.assertLenientEquals(expected, actual);
  }

  @Test
  public void testBuilderWithLists() throws Exception {
    final ResourceSpecification actual = ResourceSpecification.Builder.with()
            .setVirtualCores(5)
            .setMemory(4, ResourceSpecification.SizeUnit.GIGA)
            .setInstances(3)
            .setUplink(10, ResourceSpecification.SizeUnit.GIGA)
            .setDownlink(5, ResourceSpecification.SizeUnit.GIGA)
View Full Code Here

    List<String> flowletNames = Lists.newArrayList();
    TwillSpecification.Builder.RunnableSetter runnableSetter = null;
    for (Map.Entry<String, FlowletDefinition> entry  : spec.getFlowlets().entrySet()) {
      FlowletDefinition flowletDefinition = entry.getValue();
      FlowletSpecification flowletSpec = flowletDefinition.getFlowletSpec();
      ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
        .setVirtualCores(flowletSpec.getResources().getVirtualCores())
        .setMemory(flowletSpec.getResources().getMemoryMB(), ResourceSpecification.SizeUnit.MEGA)
        .setInstances(flowletDefinition.getInstances())
        .build();
View Full Code Here

    this.eventHandler = eventHandler;
  }

  @Override
  public TwillSpecification configure() {
    ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
      .setVirtualCores(spec.getResources().getVirtualCores())
      .setMemory(spec.getResources().getMemoryMB(), ResourceSpecification.SizeUnit.MEGA)
      .setInstances(spec.getInstances())
      .build();
View Full Code Here

    Location programLocation = program.getJarLocation();
    String programName = programLocation.getName();
    TwillSpecification.Builder.RunnableSetter runnableSetter = null;
    for (Map.Entry<String, RuntimeSpecification> entry : spec.getRunnables().entrySet()) {
      RuntimeSpecification runtimeSpec = entry.getValue();
      ResourceSpecification resourceSpec = runtimeSpec.getResourceSpecification();

      String runnableName = entry.getKey();
      runnableSetter = moreRunnable
        .add(runnableName, new ServiceTwillRunnable(runnableName, "hConf.xml", "cConf.xml"), resourceSpec)
        .withLocalFiles().add(programName, programLocation.toURI())
View Full Code Here

    this.eventHandler = eventHandler;
  }

  @Override
  public TwillSpecification configure() {
    ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(WORKFLOW_MEMORY_MB, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(1)
      .build();
View Full Code Here

  @Override
  public TwillSpecification configure() {
    // These resources are for the container that runs the mapred client that will launch the actual mapred job.
    // It does not need much memory.  Memory for mappers and reduces are specified in the MapReduceSpecification,
    // which is configurable by the author of the job.
    ResourceSpecification resourceSpec = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(1)
      .build();
View Full Code Here

  @Test
  public void testFailureRestart() throws Exception {
    TwillRunner runner = YarnTestUtils.getTwillRunner();

    ResourceSpecification resource = ResourceSpecification.Builder.with()
      .setVirtualCores(1)
      .setMemory(512, ResourceSpecification.SizeUnit.MEGA)
      .setInstances(2)
      .build();
    TwillController controller = runner.prepare(new FailureRunnable(), resource)
View Full Code Here

TOP

Related Classes of org.apache.twill.api.ResourceSpecification$Builder$AfterDownlink

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.