Java Code Examples for org.apache.hadoop.yarn.api.records.LocalResourceType#PATTERN

The following examples show how to use org.apache.hadoop.yarn.api.records.LocalResourceType#PATTERN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DagTypeConverters.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
public static PlanLocalResource convertLocalResourceToPlanLocalResource(
  String name, LocalResource lr) {
  PlanLocalResource.Builder localResourcesBuilder = PlanLocalResource.newBuilder();
  localResourcesBuilder.setName(name);
  localResourcesBuilder.setUri(
    DagTypeConverters.convertToDAGPlan(lr.getResource()));
  localResourcesBuilder.setSize(lr.getSize());
  localResourcesBuilder.setTimeStamp(lr.getTimestamp());
  localResourcesBuilder.setType(
    DagTypeConverters.convertToDAGPlan(lr.getType()));
  localResourcesBuilder.setVisibility(
    DagTypeConverters.convertToDAGPlan(lr.getVisibility()));
  if (lr.getType() == LocalResourceType.PATTERN) {
    if (lr.getPattern() == null || lr.getPattern().isEmpty()) {
      throw new TezUncheckedException("LocalResource type set to pattern"
        + " but pattern is null or empty");
    }
    localResourcesBuilder.setPattern(lr.getPattern());
  }
  return localResourcesBuilder.build();
}
 
Example 2
Source File: DagTypeConverters.java    From tez with Apache License 2.0 6 votes vote down vote up
public static List<PlanLocalResource> convertToDAGPlan(Map<String, LocalResource> lrs) {
  List<PlanLocalResource> planLrs = Lists.newArrayListWithCapacity(lrs.size());
  for (Entry<String, LocalResource> entry : lrs.entrySet()) {
    PlanLocalResource.Builder localResourcesBuilder = PlanLocalResource.newBuilder();
    String key = entry.getKey();
    LocalResource lr = entry.getValue();
    localResourcesBuilder.setName(key);
    localResourcesBuilder.setUri(
      DagTypeConverters.convertToDAGPlan(lr.getResource()));
    localResourcesBuilder.setSize(lr.getSize());
    localResourcesBuilder.setTimeStamp(lr.getTimestamp());
    localResourcesBuilder.setType(
      DagTypeConverters.convertToDAGPlan(lr.getType()));
    localResourcesBuilder.setVisibility(
      DagTypeConverters.convertToDAGPlan(lr.getVisibility()));
    if (lr.getType() == LocalResourceType.PATTERN) {
      if (lr.getPattern() == null || lr.getPattern().isEmpty()) {
        throw new TezUncheckedException("LocalResource type set to pattern"
          + " but pattern is null or empty");
      }
      localResourcesBuilder.setPattern(lr.getPattern());
    }
    planLrs.add(localResourcesBuilder.build());
  }
  return planLrs;
}
 
Example 3
Source File: DagTypeConverters.java    From tez with Apache License 2.0 6 votes vote down vote up
public static PlanLocalResource convertLocalResourceToPlanLocalResource(
  String name, LocalResource lr) {
  PlanLocalResource.Builder localResourcesBuilder = PlanLocalResource.newBuilder();
  localResourcesBuilder.setName(name);
  localResourcesBuilder.setUri(
    DagTypeConverters.convertToDAGPlan(lr.getResource()));
  localResourcesBuilder.setSize(lr.getSize());
  localResourcesBuilder.setTimeStamp(lr.getTimestamp());
  localResourcesBuilder.setType(
    DagTypeConverters.convertToDAGPlan(lr.getType()));
  localResourcesBuilder.setVisibility(
    DagTypeConverters.convertToDAGPlan(lr.getVisibility()));
  if (lr.getType() == LocalResourceType.PATTERN) {
    if (lr.getPattern() == null || lr.getPattern().isEmpty()) {
      throw new TezUncheckedException("LocalResource type set to pattern"
        + " but pattern is null or empty");
    }
    localResourcesBuilder.setPattern(lr.getPattern());
  }
  return localResourcesBuilder.build();
}
 
Example 4
Source File: DagTypeConverters.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
public static LocalResourceType convertFromDAGPlan(PlanLocalResourceType type) {
  switch(type){
  case ARCHIVE : return LocalResourceType.ARCHIVE;
  case FILE : return LocalResourceType.FILE;
  case PATTERN : return LocalResourceType.PATTERN;
  default : throw new IllegalArgumentException("unknown 'type': " + type);
  }
}
 
Example 5
Source File: DagTypeConverters.java    From tez with Apache License 2.0 5 votes vote down vote up
public static LocalResourceType convertFromDAGPlan(PlanLocalResourceType type) {
  switch(type){
  case ARCHIVE : return LocalResourceType.ARCHIVE;
  case FILE : return LocalResourceType.FILE;
  case PATTERN : return LocalResourceType.PATTERN;
  default : throw new IllegalArgumentException("unknown 'type': " + type);
  }
}
 
Example 6
Source File: MRApps.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private static String getResourceDescription(LocalResourceType type) {
  if(type == LocalResourceType.ARCHIVE || type == LocalResourceType.PATTERN) {
    return "cache archive (" + MRJobConfig.CACHE_ARCHIVES + ") ";
  }
  return "cache file (" + MRJobConfig.CACHE_FILES + ") ";
}
 
Example 7
Source File: MRApps.java    From big-c with Apache License 2.0 4 votes vote down vote up
private static String getResourceDescription(LocalResourceType type) {
  if(type == LocalResourceType.ARCHIVE || type == LocalResourceType.PATTERN) {
    return "cache archive (" + MRJobConfig.CACHE_ARCHIVES + ") ";
  }
  return "cache file (" + MRJobConfig.CACHE_FILES + ") ";
}