Package co.cask.tigon.api.flow.flowlet

Examples of co.cask.tigon.api.flow.flowlet.FlowletSpecification


                                                int liveCount) throws Exception {

      FlowletProgramController flowletProgramController =
        (FlowletProgramController) Iterables.getFirst(liveFlowlets.values(), null);

      FlowletSpecification flowletSpecification = flowletProgramController.getFlowletContext().getSpecification();

      int flowletMaxInstances = flowletSpecification.getMaxInstances();
      Preconditions.checkArgument(newInstanceCount <= flowletMaxInstances,
                                  "Flowlet %s can have a maximum of %s instances",
                                  flowletSpecification.getName(), flowletMaxInstances);

      // First pause all flowlets
      Futures.successfulAsList(Iterables.transform(
        liveFlowlets.values(),
        new Function<ProgramController, ListenableFuture<?>>() {
View Full Code Here


    String programName = programLocation.getName();
    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();

      String flowletName = entry.getKey();
      flowletNames.add(flowletName);
View Full Code Here

  private final transient Map<String, Set<Type>> outputTypes;
  private Map<String, Set<Schema>> inputs;
  private Map<String, Set<Schema>> outputs;

  FlowletDefinition(String flowletName, Flowlet flowlet, int instances) {
    FlowletSpecification flowletSpec = flowlet.configure();

    this.instances = instances;

    Map<String, Set<Type>> inputTypes = Maps.newHashMap();
    Map<String, Set<Type>> outputTypes = Maps.newHashMap();
    Map<String, String> properties = Maps.newHashMap(flowletSpec.getProperties());
    Reflections.visit(flowlet, TypeToken.of(flowlet.getClass()),
                      new PropertyFieldExtractor(properties),
                      new OutputEmitterFieldExtractor(outputTypes),
                      new ProcessMethodExtractor(inputTypes));

    this.inputTypes = immutableCopyOf(inputTypes);
    this.outputTypes = immutableCopyOf(outputTypes);
    this.flowletSpec = new DefaultFlowletSpecification(flowlet.getClass().getName(),
                                                       flowletName == null ? flowletSpec.getName() : flowletName,
                                                       flowletSpec.getDescription(), flowletSpec.getFailurePolicy(),
                                                       properties, flowletSpec.getResources(),
                                                       flowletSpec.getMaxInstances());
  }
View Full Code Here

TOP

Related Classes of co.cask.tigon.api.flow.flowlet.FlowletSpecification

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.