示例#1
0
        //Starts the job in a thread. It also starts the taskKill/tasktrackerKill
        //threads.
        /// <exception cref="System.Exception"/>
        private void RunTest(JobClient jc, Configuration conf, string jobClass, string[]
                             args, ReliabilityTest.KillTaskThread killTaskThread, ReliabilityTest.KillTrackerThread
                             killTrackerThread)
        {
            Sharpen.Thread t = new _Thread_202(this, conf, jobClass, args, "Job Test");
            t.SetDaemon(true);
            t.Start();
            JobStatus[] jobs;
            //get the job ID. This is the job that we just submitted
            while ((jobs = jc.JobsToComplete()).Length == 0)
            {
                Log.Info("Waiting for the job " + jobClass + " to start");
                Sharpen.Thread.Sleep(1000);
            }
            JobID      jobId = ((JobID)jobs[jobs.Length - 1].GetJobID());
            RunningJob rJob  = jc.GetJob(jobId);

            if (rJob.IsComplete())
            {
                Log.Error("The last job returned by the querying JobTracker is complete :" + rJob
                          .GetJobID() + " .Exiting the test");
                System.Environment.Exit(-1);
            }
            while (rJob.GetJobState() == JobStatus.Prep)
            {
                Log.Info("JobID : " + jobId + " not started RUNNING yet");
                Sharpen.Thread.Sleep(1000);
                rJob = jc.GetJob(jobId);
            }
            if (killTaskThread != null)
            {
                killTaskThread.SetRunningJob(rJob);
                killTaskThread.Start();
                killTaskThread.Join();
                Log.Info("DONE WITH THE TASK KILL/FAIL TESTS");
            }
            if (killTrackerThread != null)
            {
                killTrackerThread.SetRunningJob(rJob);
                killTrackerThread.Start();
                killTrackerThread.Join();
                Log.Info("DONE WITH THE TESTS TO DO WITH LOST TASKTRACKERS");
            }
            t.Join();
        }