Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.tez.dag.api;
 
 import java.util.List;
 import java.util.Map;
 
 
 
 public class Vertex {
 
   private final String vertexName;
 
   private final int parallelism;
   private final Resource taskResource;
   private Map<StringStringtaskEnvironment = new HashMap<StringString>();
                       = new ArrayList<RootInputLeafOutput<InputDescriptor>>();
                       = new ArrayList<RootInputLeafOutput<OutputDescriptor>>();
 
   private final List<VertexinputVertices = new ArrayList<Vertex>();
   private final List<VertexoutputVertices = new ArrayList<Vertex>();
   private final List<StringinputEdgeIds = new ArrayList<String>();
   private final List<StringoutputEdgeIds = new ArrayList<String>();
   private final Map<StringGroupInfogroupInputs = Maps.newHashMap();
   
   private String javaOpts = "";
 
   public Vertex(String vertexName,
       ProcessorDescriptor processorDescriptor,
       int parallelism,
       Resource taskResource) {
     this. = vertexName;
     this. = processorDescriptor;
     this. = parallelism;
     this. = taskResource;
     if (parallelism < -1) {
       throw new IllegalArgumentException(
           "Parallelism should be -1 if determined by the AM"
           + ", otherwise should be >= 0");
     }
     if (taskResource == null) {
       throw new IllegalArgumentException("Resource cannot be null");
     }
   }
 
   public String getVertexName() { // FIXME rename to getName()
     return ;
   }
 
     return this.;
   }
 
   public int getParallelism() {
     return ;
   }
 
   public Resource getTaskResource() {
     return ;
   }
 
   public Vertex setTaskLocationsHint(List<TaskLocationHintlocations) {
     if (locations == null) {
       return this;
     }
    assert locations.size() == ;
     = new VertexLocationHint(locations);
    return this;
  }
  // used internally to create parallelism location resource file
    return ;
  }
  public Vertex setTaskLocalResources(Map<StringLocalResourcelocalResources) {
    if (localResources == null) {
      this. = new HashMap<StringLocalResource>();
    } else {
      this. = localResources;
    }
    return this;
  }
    return ;
  }
  public Vertex setTaskEnvironment(Map<StringStringenvironment) {
    if (environment == null) {
      this. = new HashMap<StringString>();
    }
    else {
      this. = environment;
    }
    return this;
  }
  public Map<StringStringgetTaskEnvironment() {
    return ;
  }
  public Vertex setJavaOpts(String javaOpts){
     this = javaOpts;
     return this;
  }
  
  
Specifies an Input for a Vertex. This is meant to be used when a Vertex reads Input directly from an external source For vertices which read data generated by another vertex - use the addEdge method. If a vertex needs to use data generated by another vertex in the DAG and also from an external source, a combination of this API and the DAG.addEdge API can be used.

Parameters:
inputName the name of the input. This will be used when accessing the input in the org.apache.tez.runtime.api.LogicalIOProcessor
inputDescriptor the inputDescriptor for this input
inputInitializer An initializer for this Input which may run within the AM. This can be used to set the parallelism for this vertex and generate org.apache.tez.runtime.api.events.RootInputDataInformationEvents for the actual Input. If this is not specified, the parallelism must be set for the vertex. In addition, the Input should know how to access data for each of it's tasks. If a org.apache.tez.runtime.api.TezRootInputInitializer is meant to determine the parallelism of the vertex, the initial vertex parallelism should be set to -1.
Returns:
this Vertex
  public Vertex addInput(String inputNameInputDescriptor inputDescriptor,
      Class<? extends TezRootInputInitializerinputInitializer) {
    if (.size() == 1) {
      throw new IllegalStateException(
          "For now, only a single Root Input can be added to a Vertex");
    }
        inputDescriptorinputInitializer));
    return this;
  }

  
Specifies an Output for a Vertex. This is meant to be used when a Vertex writes Output directly to an external destination. If an output of the vertex is meant to be consumed by another Vertex in the DAG - use the addEdge method. If a vertex needs generate data to an external source as well as for another Vertex in the DAG, a combination of this API and the DAG.addEdge API can be used.

Parameters:
outputName the name of the output. This will be used when accessing the output in the org.apache.tez.runtime.api.LogicalIOProcessor
outputDescriptor
outputCommitterClazz Class to be used for the OutputCommitter. Can be null.
Returns:
this Vertex
  public Vertex addOutput(String outputNameOutputDescriptor outputDescriptor,
      Class<? extends OutputCommitteroutputCommitterClazz) {
        outputDescriptoroutputCommitterClazz));
    return this;
  }
  
    .add(output);
    return this;
  }
  public Vertex addOutput(String outputNameOutputDescriptor outputDescriptor) {
    return addOutput(outputNameoutputDescriptornull);
  }
  
  
Specifies a VertexManagerPlugin for the vertex. This plugin can be used to modify the parallelism or reconfigure the vertex at runtime using user defined code embedded in the plugin

Parameters:
vertexManagerPluginDescriptor
Returns:
this Vertex
      VertexManagerPluginDescriptor vertexManagerPluginDescriptor) {
    this. = vertexManagerPluginDescriptor;
    return this;
  }
  public String getJavaOpts(){
	  return ;
  }
  public String toString() {
    return "[" +  + " : " + .getClassName() + "]";
  }
  
    return ;
  }
    return ;
  }
  
  void addGroupInput(String groupNameGroupInfo groupInputInfo) {
    if (.put(groupNamegroupInputInfo) != null) {
      throw new IllegalStateException(
          "Vertex: " + getVertexName() + 
          " already has group input with name:" + groupName);
    }
  }
  void addInputVertex(Vertex inputVertexEdge edge) {
    .add(inputVertex);
    .add(edge.getId());
  }
  void addOutputVertex(Vertex outputVertexEdge edge) {
    .add(outputVertex);
    .add(edge.getId());
  }
  
  public List<VertexgetInputVertices() {
    return Collections.unmodifiableList();
  }
  public List<VertexgetOutputVertices() {
    return Collections.unmodifiableList();
  }
    return ;
  }
    return ;
  }
  
    return ;
  }
    return ;
  }
  // FIXME how do we support profiling? Can't profile all tasks.
New to GrepCode? Check out our FAQ X