Пример #1
0
 protected override void Dispatch(Org.Apache.Hadoop.Yarn.Event.Event @event)
 {
     if (@event is TaskAttemptEvent)
     {
         TaskAttemptEvent killEvent = (TaskAttemptEvent)@event;
         if (killEvent.GetType() == TaskAttemptEventType.TaKill)
         {
             TaskAttemptId taID = killEvent.GetTaskAttemptID();
             if (taID.GetTaskId().GetTaskType() == TaskType.Reduce && taID.GetTaskId().GetId()
                 == 0 && taID.GetId() == 0)
             {
                 base.Dispatch(new TaskAttemptEvent(taID, TaskAttemptEventType.TaDone));
                 base.Dispatch(new TaskAttemptEvent(taID, TaskAttemptEventType.TaContainerCleaned)
                               );
                 base.Dispatch(new TaskTAttemptEvent(taID, TaskEventType.TAttemptSucceeded));
                 this.cachedKillEvent = killEvent;
                 return;
             }
         }
     }
     else
     {
         if (@event is TaskEvent)
         {
             TaskEvent taskEvent = (TaskEvent)@event;
             if (taskEvent.GetType() == TaskEventType.TAttemptSucceeded && this.cachedKillEvent
                 != null)
             {
                 base.Dispatch(this.cachedKillEvent);
                 return;
             }
         }
     }
     base.Dispatch(@event);
 }
 /*
  * This class is used to control when speculative execution happens.
  */
 /*
  * This will only be called if speculative execution is turned on.
  *
  * If either mapper or reducer speculation is turned on, this will be
  * called.
  *
  * This will cause speculation to engage for the first mapper or first
  * reducer (that is, attempt ID "*_m_000000_0" or "*_r_000000_0")
  *
  * If this attempt is killed, the retry will have attempt id 1, so it
  * will not engage speculation again.
  */
 public override long EstimatedRuntime(TaskAttemptId id)
 {
     if ((id.GetTaskId().GetId() == 0) && (id.GetId() == 0))
     {
         return(SpeculateThis);
     }
     return(base.EstimatedRuntime(id));
 }
Пример #3
0
        public virtual void TestToTaskAttemptID()
        {
            TaskAttemptId taid = MRApps.ToTaskAttemptID("attempt_0_1_m_2_3");

            NUnit.Framework.Assert.AreEqual(0, taid.GetTaskId().GetJobId().GetAppId().GetClusterTimestamp
                                                ());
            NUnit.Framework.Assert.AreEqual(1, taid.GetTaskId().GetJobId().GetAppId().GetId()
                                            );
            NUnit.Framework.Assert.AreEqual(1, taid.GetTaskId().GetJobId().GetId());
            NUnit.Framework.Assert.AreEqual(2, taid.GetTaskId().GetId());
            NUnit.Framework.Assert.AreEqual(3, taid.GetId());
        }
Пример #4
0
 protected override void AttemptLaunched(TaskAttemptId attemptID)
 {
     if (attemptID.GetTaskId().GetId() == 0 && attemptID.GetId() == 0)
     {
         GetContext().GetEventHandler().Handle(new TaskAttemptEvent(attemptID, TaskAttemptEventType
                                                                    .TaFailmsg));
     }
     else
     {
         GetContext().GetEventHandler().Handle(new TaskAttemptEvent(attemptID, TaskAttemptEventType
                                                                    .TaDone));
     }
 }
Пример #5
0
 //First attempt is failed
 protected internal override void AttemptLaunched(TaskAttemptId attemptID)
 {
     if (attemptID.GetTaskId().GetId() == 0 && attemptID.GetId() == 0)
     {
         //check if it is first task's first attempt
         // send the Fail event
         GetContext().GetEventHandler().Handle(new TaskAttemptEvent(attemptID, TaskAttemptEventType
                                                                    .TaFailmsg));
     }
     else
     {
         GetContext().GetEventHandler().Handle(new TaskAttemptEvent(attemptID, TaskAttemptEventType
                                                                    .TaDone));
     }
 }
Пример #6
0
 protected internal override void AttemptLaunched(TaskAttemptId attemptID)
 {
     if (attemptID.GetTaskId().GetId() == 0 && attemptID.GetId() == 0)
     {
         //this blocks the first task's first attempt
         //the subsequent ones are completed
         try
         {
             latch.Await();
         }
         catch (Exception e)
         {
             Sharpen.Runtime.PrintStackTrace(e);
         }
     }
     else
     {
         GetContext().GetEventHandler().Handle(new TaskAttemptEvent(attemptID, TaskAttemptEventType
                                                                    .TaDone));
     }
 }
Пример #7
0
 protected override void Dispatch(Org.Apache.Hadoop.Yarn.Event.Event @event)
 {
     if (@event is TaskAttemptEvent)
     {
         TaskAttemptEvent attemptEvent = (TaskAttemptEvent)@event;
         TaskAttemptId    attemptID    = ((TaskAttemptEvent)@event).GetTaskAttemptID();
         if (attemptEvent.GetType() == this.attemptEventTypeToWait && attemptID.GetTaskId(
                 ).GetId() == 0 && attemptID.GetId() == 0)
         {
             try
             {
                 latch.Await();
             }
             catch (Exception e)
             {
                 Sharpen.Runtime.PrintStackTrace(e);
             }
         }
     }
     base.Dispatch(@event);
 }
Пример #8
0
 public static TaskAttemptID FromYarn(TaskAttemptId id)
 {
     return(new TaskAttemptID(FromYarn(id.GetTaskId()), id.GetId()));
 }