Package co.cask.tigon.api.flow

Examples of co.cask.tigon.api.flow.FlowSpecification$Builder$Connector


  }

  @Override
  public ProgramController run(Program program, ProgramOptions options) {
    // Extract and verify parameters
    FlowSpecification flowSpec = program.getSpecification();
    ProgramType processorType = program.getType();
    Preconditions.checkNotNull(processorType, "Missing processor type.");
    Preconditions.checkArgument(processorType == ProgramType.FLOW, "Only FLOW process type is supported.");
    Preconditions.checkNotNull(flowSpec, "Missing FlowSpecification for %s", program.getName());

    for (FlowletDefinition flowletDefinition : flowSpec.getFlowlets().values()) {
      int maxInstances = flowletDefinition.getFlowletSpec().getMaxInstances();
      Preconditions.checkArgument(flowletDefinition.getInstances() <= maxInstances,
                                  "Flowlet %s can have a maximum of %s instances",
                                  flowletDefinition.getFlowletSpec().getName(), maxInstances);
    }
View Full Code Here


  @Override
  protected ProgramController launch(Program program, ProgramOptions options,
                                     File hConfFile, File cConfFile, ApplicationLauncher launcher) {
    // Extract and verify parameters
    FlowSpecification flowSpec = program.getSpecification();
    ProgramType processorType = program.getType();
    Preconditions.checkNotNull(processorType, "Missing processor type.");
    Preconditions.checkArgument(processorType == ProgramType.FLOW, "Only FLOW process type is supported.");

    try {
      Preconditions.checkNotNull(flowSpec, "Missing FlowSpecification for %s", program.getName());

      for (FlowletDefinition flowletDefinition : flowSpec.getFlowlets().values()) {
        int maxInstances = flowletDefinition.getFlowletSpec().getMaxInstances();
        Preconditions.checkArgument(flowletDefinition.getInstances() <= maxInstances,
                                    "Flowlet %s can have a maximum of %s instances",
                                    flowletDefinition.getFlowletSpec().getName(), maxInstances);
      }

      LOG.info("Configuring flowlets queues");
      Multimap<String, QueueName> flowletQueues = FlowUtils.configureQueue(program, flowSpec, queueAdmin);

      // Launch flowlet program runners
      LOG.info("Launching distributed flow: " + program.getName() + ":" + flowSpec.getName());
      TwillController controller = launcher.launch(new FlowTwillApplication(program, flowSpec,
                                                                            hConfFile, cConfFile, eventHandler));
      DistributedFlowletInstanceUpdater instanceUpdater = new DistributedFlowletInstanceUpdater(program, controller,
                                                                                                queueAdmin,
                                                                                                flowletQueues);
View Full Code Here

      String runIdOption = options.getArguments().getOption(ProgramOptionConstants.RUN_ID);
      Preconditions.checkNotNull(runIdOption, "Missing runId");
      RunId runId = RunIds.fromString(runIdOption);

      FlowSpecification flowSpec = program.getSpecification();
      ProgramType processorType = program.getType();
      Preconditions.checkNotNull(processorType, "Missing processor type.");
      Preconditions.checkArgument(processorType == ProgramType.FLOW, "Only FLOW process type is supported.");

      String processorName = program.getName();
      Preconditions.checkNotNull(processorName, "Missing processor name.");

      FlowletDefinition flowletDef = flowSpec.getFlowlets().get(flowletName);
      Preconditions.checkNotNull(flowletDef, "Definition missing for flowlet \"%s\"", flowletName);

      Class<?> clz = Class.forName(flowletDef.getFlowletSpec().getClassName(), true,
                                   program.getClassLoader());
      Preconditions.checkArgument(Flowlet.class.isAssignableFrom(clz), "%s is not a Flowlet.", clz);
View Full Code Here

    bundler.createBundle(jarLocation, clz);

    Location deployJar = locationFactory.create(clz.getName()).getTempFile(".jar");

    Flow flow = (Flow) clz.newInstance();
    FlowSpecification flowSpec = new DefaultFlowSpecification(clz.getClass().getName(), flow.configure());

    // Creates Manifest
    Manifest manifest = new Manifest();
    manifest.getMainAttributes().put(ManifestFields.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(ManifestFields.MAIN_CLASS, clz.getName());
View Full Code Here

TOP

Related Classes of co.cask.tigon.api.flow.FlowSpecification$Builder$Connector

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.