Package org.apache.tajo.master.querymaster

Examples of org.apache.tajo.master.querymaster.QueryUnitAttempt$TaskAttemptScheduleTransition


    private Map<String, HostVolumeMapping> leafTaskHostMapping = new HashMap<String, HostVolumeMapping>();
    private final Map<String, HashSet<QueryUnitAttemptId>> leafTasksRackMapping =
        new HashMap<String, HashSet<QueryUnitAttemptId>>();

    private void addLeafTask(QueryUnitAttemptScheduleEvent event) {
      QueryUnitAttempt queryUnitAttempt = event.getQueryUnitAttempt();
      List<DataLocation> locations = queryUnitAttempt.getQueryUnit().getDataLocations();

      for (DataLocation location : locations) {
        String host = location.getHost();

        HostVolumeMapping hostVolumeMapping = leafTaskHostMapping.get(host);
        if (hostVolumeMapping == null) {
          String rack = RackResolver.resolve(host).getNetworkLocation();
          hostVolumeMapping = new HostVolumeMapping(host, rack);
          leafTaskHostMapping.put(host, hostVolumeMapping);
        }
        hostVolumeMapping.addQueryUnitAttempt(location.getVolumeId(), queryUnitAttempt);

        if (LOG.isDebugEnabled()) {
          LOG.debug("Added attempt req to host " + host);
        }

        HashSet<QueryUnitAttemptId> list = leafTasksRackMapping.get(hostVolumeMapping.getRack());
        if (list == null) {
          list = new HashSet<QueryUnitAttemptId>();
          leafTasksRackMapping.put(hostVolumeMapping.getRack(), list);
        }

        list.add(queryUnitAttempt.getId());

        if (LOG.isDebugEnabled()) {
          LOG.debug("Added attempt req to rack " + hostVolumeMapping.getRack());
        }
      }

      leafTasks.add(queryUnitAttempt.getId());
    }
View Full Code Here


      QueryUnitAttemptId queryUnitAttemptId = null;
      if(!unassignedTaskForEachVolume.containsKey(volumeId)) return queryUnitAttemptId;

      LinkedHashSet<QueryUnitAttempt> list = unassignedTaskForEachVolume.get(volumeId);
      if(list != null && list.size() > 0){
        QueryUnitAttempt queryUnitAttempt;
        synchronized (unassignedTaskForEachVolume) {
          Iterator<QueryUnitAttempt> iterator = list.iterator();
          queryUnitAttempt = iterator.next();
          iterator.remove();
        }

        this.remainTasksNum.getAndDecrement();
        queryUnitAttemptId = queryUnitAttempt.getId();
        for (DataLocation location : queryUnitAttempt.getQueryUnit().getDataLocations()) {
          if (!this.getHost().equals(location.getHost())) {
            HostVolumeMapping volumeMapping = scheduledRequests.leafTaskHostMapping.get(location.getHost());
            volumeMapping.removeQueryUnitAttempt(location.getVolumeId(), queryUnitAttempt);
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.tajo.master.querymaster.QueryUnitAttempt$TaskAttemptScheduleTransition

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.