Package org.apache.drill.exec.physical

Examples of org.apache.drill.exec.physical.EndpointAffinity


    }
  }
 
  public void addEndpointAffinity(DrillbitEndpoint endpoint, float affinity) {
    Preconditions.checkState(!endpointsAssigned);
    EndpointAffinity ea = endpointAffinity.get(endpoint);
    if (ea == null) {
      ea = new EndpointAffinity(endpoint);
      endpointAffinity.put(endpoint, ea);
    }

    ea.addAffinity(affinity);
  }
View Full Code Here


        }
      }
      List<EndpointAffinity> affinityList = new LinkedList<>();
      for (DrillbitEndpoint d : affinities.keySet()) {
        logger.debug("Endpoint {} has affinity {}", d.getAddress(), affinities.get(d).floatValue());
        affinityList.add(new EndpointAffinity(d,affinities.get(d).floatValue()));
      }
      this.endpointAffinities = affinityList;
    }
    watch.stop();
    logger.debug("Took {} ms to get operator affinity", watch.elapsed(TimeUnit.MILLISECONDS));
View Full Code Here

    this.endpoint = endpoint;
  }

  @Override
  public List<EndpointAffinity> getOperatorAffinity() {
    return Collections.singletonList(new EndpointAffinity(endpoint, 1000000000000l));
  }
View Full Code Here

    }
   
    List<EndpointAffinity> affinityList = Lists.newLinkedList();
    for (ObjectFloatCursor<DrillbitEndpoint> d : affinities) {
      logger.debug("Endpoint {} has affinity {}", d.key.getAddress(), d.value);
      affinityList.add(new EndpointAffinity(d.key, d.value));
    }

    logger.debug("Took {} ms to get operator affinity", watch.elapsed(TimeUnit.MILLISECONDS));
    return affinityList;
  }
View Full Code Here

  }

  public void addEndpointAffinity(DrillbitEndpoint endpoint, float affinity) {
    Preconditions.checkState(!endpointsAssigned);
    Preconditions.checkNotNull(endpoint);
    EndpointAffinity ea = endpointAffinityMap.get(endpoint);
    if (ea == null) {
      ea = new EndpointAffinity(endpoint);
      endpointAffinityMap.put(endpoint, ea);
    }

    ea.addAffinity(affinity);
  }
View Full Code Here

      Collections.sort(affinedEPs);
      Iterator<EndpointAffinity> affinedEPItr = Iterators.cycle(Lists.reverse(affinedEPs));
      /** Maximum number of slots which should go to endpoints with affinity */
      int affinedSlots = Math.min((Math.max(1, (int) (affinityFactor*width/allEndpoints.size())) * affinedEPs.size()), width);
      while(endpoints.size() < affinedSlots) {
        EndpointAffinity ea = affinedEPItr.next();
        DrillbitEndpoint endpoint = ea.getEndpoint();
        endpoints.add(endpoint);
      }
    }
    // add other endpoints if required
    if (endpoints.size() < width) {
View Full Code Here

    this.endpoint = endpoint;
  }

  @Override
  public List<EndpointAffinity> getOperatorAffinity() {
    return Collections.singletonList(new EndpointAffinity(endpoint, 1000000000000l));
  }
View Full Code Here

          DrillbitEndpoint endpoint = endpointMap.get(loc);
          if (endpoint != null) {
            if (affinityMap.containsKey(endpoint)) {
              affinityMap.get(endpoint).addAffinity(affinity);
            } else {
              affinityMap.put(endpoint, new EndpointAffinity(endpoint, affinity));
            }
          }
        }
      }
    } catch (IOException e) {
View Full Code Here

    Map<DrillbitEndpoint, EndpointAffinity> affinityMap = new HashMap<DrillbitEndpoint, EndpointAffinity>();
    for (ServerName sn : regionsToScan.values()) {
      DrillbitEndpoint ep = endpointMap.get(sn.getHostname());
      if (ep != null) {
        EndpointAffinity affinity = affinityMap.get(ep);
        if (affinity == null) {
          affinityMap.put(ep, new EndpointAffinity(ep, 1));
        } else {
          affinity.addAffinity(1);
        }
      }
    }
    logger.debug("Took {} µs to get operator affinity", watch.elapsed(TimeUnit.NANOSECONDS)/1000);
    return Lists.newArrayList(affinityMap.values());
View Full Code Here

    this.endpoint = endpoint;
  }

  @Override
  public List<EndpointAffinity> getOperatorAffinity() {
    return Collections.singletonList(new EndpointAffinity(endpoint, 1000000000000l));
  }
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.physical.EndpointAffinity

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.