Esempio n. 1
0
 /// <summary>
 /// Constructs a TaskAttemptID object from given
 /// <see cref="TaskID"/>
 /// .
 /// </summary>
 /// <param name="taskId">TaskID that this task belongs to</param>
 /// <param name="id">the task attempt number</param>
 public TaskAttemptID(TaskID taskId, int id)
     : base(id)
 {
     if (taskId == null)
     {
         throw new ArgumentException("taskId cannot be null");
     }
     this.taskId = taskId;
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
 /// <summary>Creates a new TaskReport object</summary>
 /// <param name="taskid"/>
 /// <param name="progress"/>
 /// <param name="state"/>
 /// <param name="diagnostics"/>
 /// <param name="currentStatus"/>
 /// <param name="startTime"/>
 /// <param name="finishTime"/>
 /// <param name="counters"/>
 public TaskReport(TaskID taskid, float progress, string state, string[] diagnostics
                   , TIPStatus currentStatus, long startTime, long finishTime, Counters counters)
 {
     this.taskid        = taskid;
     this.progress      = progress;
     this.state         = state;
     this.diagnostics   = diagnostics;
     this.currentStatus = currentStatus;
     this.startTime     = startTime;
     this.finishTime    = finishTime;
     this.counters      = counters;
 }
Esempio n. 4
0
        public virtual void TestCloneMapContext()
        {
            TaskID        taskId        = new TaskID(jobId, TaskType.Map, 0);
            TaskAttemptID taskAttemptid = new TaskAttemptID(taskId, 0);
            MapContext <IntWritable, IntWritable, IntWritable, IntWritable> mapContext = new MapContextImpl
                                                                                         <IntWritable, IntWritable, IntWritable, IntWritable>(conf, taskAttemptid, null,
                                                                                                                                              null, null, null, null);

            Mapper.Context mapperContext = new WrappedMapper <IntWritable, IntWritable, IntWritable
                                                              , IntWritable>().GetMapContext(mapContext);
            ContextFactory.CloneMapContext(mapperContext, conf, null, null);
        }
Esempio n. 5
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()));
     }
 }
Esempio n. 6
0
        /// <summary>test a kill task</summary>
        /// <exception cref="System.Exception"/>
        private void TestKillTask(Configuration conf)
        {
            Job                   job  = RunJobInBackGround(conf);
            CLI                   jc   = CreateJobClient();
            TaskID                tid  = new TaskID(job.GetJobID(), TaskType.Map, 0);
            TaskAttemptID         taid = new TaskAttemptID(tid, 1);
            ByteArrayOutputStream @out = new ByteArrayOutputStream();
            // bad parameters
            int exitCode = RunTool(conf, jc, new string[] { "-kill-task" }, @out);

            NUnit.Framework.Assert.AreEqual("Exit code", -1, exitCode);
            RunTool(conf, jc, new string[] { "-kill-task", taid.ToString() }, @out);
            string answer = Sharpen.Runtime.GetStringForBytes(@out.ToByteArray(), "UTF-8");

            NUnit.Framework.Assert.IsTrue(answer.Contains("Killed task " + taid));
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
 public TaskAttemptID()
 {
     taskId = new TaskID();
 }
Esempio n. 9
0
 public TaskReport()
 {
     taskid = new TaskID();
 }