Exemple #1
0
 public virtual void PutBackKnownMapOutput(MapHost host, TaskAttemptID mapId)
 {
     lock (this)
     {
         host.AddKnownMap(mapId);
     }
 }
Exemple #2
0
 public virtual IList <TaskAttemptID> GetMapsForHost(MapHost host)
 {
     lock (this)
     {
         IList <TaskAttemptID>       list   = host.GetAndClearKnownMaps();
         IEnumerator <TaskAttemptID> itr    = list.GetEnumerator();
         IList <TaskAttemptID>       result = new AList <TaskAttemptID>();
         int includedMaps = 0;
         int totalSize    = list.Count;
         // find the maps that we still need, up to the limit
         while (itr.HasNext())
         {
             TaskAttemptID id = itr.Next();
             if (!obsoleteMaps.Contains(id) && !finishedMaps[id.GetTaskID().GetId()])
             {
                 result.AddItem(id);
                 if (++includedMaps >= MaxMapsAtOnce)
                 {
                     break;
                 }
             }
         }
         // put back the maps left after the limit
         while (itr.HasNext())
         {
             TaskAttemptID id = itr.Next();
             if (!obsoleteMaps.Contains(id) && !finishedMaps[id.GetTaskID().GetId()])
             {
                 host.AddKnownMap(id);
             }
         }
         Log.Info("assigned " + includedMaps + " of " + totalSize + " to " + host + " to "
                  + Sharpen.Thread.CurrentThread().GetName());
         return(result);
     }
 }