コード例 #1
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void ReportNextRecordRange(TaskAttemptID taskAttemptID, SortedRanges.Range
                                           range)
 {
     // This is used when the feature of skipping records is enabled.
     // This call exists as a hadoop mapreduce legacy wherein all changes in
     // counters/progress/phase/output-size are reported through statusUpdate()
     // call but not the next record range information.
     throw new IOException("Not yet implemented.");
 }
コード例 #2
0
 /// <summary>Add the range indices.</summary>
 /// <remarks>
 /// Add the range indices. It is ensured that the added range
 /// doesn't overlap the existing ranges. If it overlaps, the
 /// existing overlapping ranges are removed and a single range
 /// having the superset of all the removed ranges and this range
 /// is added.
 /// If the range is of 0 length, doesn't do anything.
 /// </remarks>
 /// <param name="range">Range to be added.</param>
 internal virtual void Add(SortedRanges.Range range)
 {
     lock (this)
     {
         if (range.IsEmpty())
         {
             return;
         }
         long startIndex = range.GetStartIndex();
         long endIndex   = range.GetEndIndex();
         //make sure that there are no overlapping ranges
         ICollection <SortedRanges.Range> headSet = ranges.HeadSet(range);
         if (headSet.Count > 0)
         {
             SortedRanges.Range previousRange = headSet.Last();
             Log.Debug("previousRange " + previousRange);
             if (startIndex < previousRange.GetEndIndex())
             {
                 //previousRange overlaps this range
                 //remove the previousRange
                 if (ranges.Remove(previousRange))
                 {
                     indicesCount -= previousRange.GetLength();
                 }
                 //expand this range
                 startIndex = previousRange.GetStartIndex();
                 endIndex   = endIndex >= previousRange.GetEndIndex() ? endIndex : previousRange.GetEndIndex
                                  ();
             }
         }
         IEnumerator <SortedRanges.Range> tailSetIt = ranges.TailSet(range).GetEnumerator();
         while (tailSetIt.HasNext())
         {
             SortedRanges.Range nextRange = tailSetIt.Next();
             Log.Debug("nextRange " + nextRange + "   startIndex:" + startIndex + "  endIndex:"
                       + endIndex);
             if (endIndex >= nextRange.GetStartIndex())
             {
                 //nextRange overlaps this range
                 //remove the nextRange
                 tailSetIt.Remove();
                 indicesCount -= nextRange.GetLength();
                 if (endIndex < nextRange.GetEndIndex())
                 {
                     //expand this range
                     endIndex = nextRange.GetEndIndex();
                     break;
                 }
             }
             else
             {
                 break;
             }
         }
         Add(startIndex, endIndex);
     }
 }
コード例 #3
0
 private void Add(long start, long end)
 {
     if (end > start)
     {
         SortedRanges.Range recRange = new SortedRanges.Range(start, end - start);
         ranges.AddItem(recRange);
         indicesCount += recRange.GetLength();
         Log.Debug("added " + recRange);
     }
 }
コード例 #4
0
 private void DoNext()
 {
     next++;
     Log.Debug("currentIndex " + next + "   " + range);
     SkipIfInRange();
     while (next >= range.GetEndIndex() && rangeIterator.HasNext())
     {
         range = rangeIterator.Next();
         SkipIfInRange();
     }
 }
コード例 #5
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            IEnumerator <SortedRanges.Range> it = ranges.GetEnumerator();

            while (it.HasNext())
            {
                SortedRanges.Range range = it.Next();
                sb.Append(range.ToString() + "\n");
            }
            return(sb.ToString());
        }
コード例 #6
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Write(DataOutput @out)
 {
     lock (this)
     {
         @out.WriteLong(indicesCount);
         @out.WriteInt(ranges.Count);
         IEnumerator <SortedRanges.Range> it = ranges.GetEnumerator();
         while (it.HasNext())
         {
             SortedRanges.Range range = it.Next();
             range.Write(@out);
         }
     }
 }
コード例 #7
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void ReadFields(DataInput @in)
 {
     lock (this)
     {
         indicesCount = @in.ReadLong();
         ranges       = new TreeSet <SortedRanges.Range>();
         int size = @in.ReadInt();
         for (int i = 0; i < size; i++)
         {
             SortedRanges.Range range = new SortedRanges.Range();
             range.ReadFields(@in);
             ranges.AddItem(range);
         }
     }
 }
コード例 #8
0
ファイル: TaskStatus.cs プロジェクト: orf53975/hadoop.net
 /// <summary>Update the status of the task.</summary>
 /// <param name="status">updated status</param>
 internal virtual void StatusUpdate(Org.Apache.Hadoop.Mapred.TaskStatus status)
 {
     lock (this)
     {
         SetProgress(status.GetProgress());
         this.runState = status.GetRunState();
         SetStateString(status.GetStateString());
         this.nextRecordRange = status.GetNextRecordRange();
         SetDiagnosticInfo(status.GetDiagnosticInfo());
         if (status.GetStartTime() > 0)
         {
             this.SetStartTime(status.GetStartTime());
         }
         if (status.GetFinishTime() > 0)
         {
             this.SetFinishTime(status.GetFinishTime());
         }
         this.phase      = status.GetPhase();
         this.counters   = status.GetCounters();
         this.outputSize = status.outputSize;
     }
 }
コード例 #9
0
ファイル: TestTaskCommit.cs プロジェクト: orf53975/hadoop.net
 /// <exception cref="System.IO.IOException"/>
 public override void ReportNextRecordRange(TaskAttemptID taskid, SortedRanges.Range
                                            range)
 {
 }
コード例 #10
0
 /// <summary>Report the record range which is going to process next by the Task.</summary>
 /// <param name="taskid">the id of the task involved</param>
 /// <param name="range">the range of record sequence nos</param>
 /// <exception cref="System.IO.IOException"/>
 public abstract void ReportNextRecordRange(TaskAttemptID taskid, SortedRanges.Range
                                            range);
コード例 #11
0
ファイル: LocalJobRunner.cs プロジェクト: orf53975/hadoop.net
 // Ignore for now
 /// <exception cref="System.IO.IOException"/>
 public override void ReportNextRecordRange(TaskAttemptID taskid, SortedRanges.Range
                                            range)
 {
     LocalJobRunner.Log.Info("Task " + taskid + " reportedNextRecordRange " + range);
 }
コード例 #12
0
ファイル: TaskStatus.cs プロジェクト: orf53975/hadoop.net
 /// <summary>Set the next record range which is going to be processed by Task.</summary>
 /// <param name="nextRecordRange"/>
 public virtual void SetNextRecordRange(SortedRanges.Range nextRecordRange)
 {
     this.nextRecordRange = nextRecordRange;
 }