Example #1
0
        public static TaskId ToYarn(TaskID id)
        {
            TaskId taskId = recordFactory.NewRecordInstance <TaskId>();

            taskId.SetId(id.GetId());
            taskId.SetTaskType(ToYarn(id.GetTaskType()));
            taskId.SetJobId(ToYarn(id.GetJobID()));
            return(taskId);
        }
Example #2
0
        /// <summary>Construct a TaskAttemptID object from given string</summary>
        /// <returns>constructed TaskAttemptID object or null if the given String is null</returns>
        /// <exception cref="System.ArgumentException">if the given string is malformed</exception>
        public static Org.Apache.Hadoop.Mapreduce.TaskAttemptID ForName(string str)
        {
            if (str == null)
            {
                return(null);
            }
            string exceptionMsg = null;

            try
            {
                string[] parts = str.Split(char.ToString(Separator));
                if (parts.Length == 6)
                {
                    if (parts[0].Equals(Attempt))
                    {
                        string   type = parts[3];
                        TaskType t    = TaskID.GetTaskType(type[0]);
                        if (t != null)
                        {
                            return(new Org.Apache.Hadoop.Mapred.TaskAttemptID(parts[1], System.Convert.ToInt32
                                                                                  (parts[2]), t, System.Convert.ToInt32(parts[4]), System.Convert.ToInt32(parts[5]
                                                                                                                                                          )));
                        }
                        else
                        {
                            exceptionMsg = "Bad TaskType identifier. TaskAttemptId string : " + str + " is not properly formed.";
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            //fall below
            if (exceptionMsg == null)
            {
                exceptionMsg = "TaskAttemptId string : " + str + " is not properly formed";
            }
            throw new ArgumentException(exceptionMsg);
        }
Example #3
0
 /// <summary>Returns the TaskType of the TaskAttemptID</summary>
 public virtual TaskType GetTaskType()
 {
     return(taskId.GetTaskType());
 }
Example #4
0
 /// <summary>Downgrade a new TaskID to an old one</summary>
 /// <param name="old">a new or old TaskID</param>
 /// <returns>either old or a new TaskID build to match old</returns>
 public static Org.Apache.Hadoop.Mapred.TaskID Downgrade(Org.Apache.Hadoop.Mapreduce.TaskID
                                                         old)
 {
     if (old is Org.Apache.Hadoop.Mapred.TaskID)
     {
         return((Org.Apache.Hadoop.Mapred.TaskID)old);
     }
     else
     {
         return(new Org.Apache.Hadoop.Mapred.TaskID(JobID.Downgrade(old.GetJobID()), old.GetTaskType
                                                        (), old.GetId()));
     }
 }