コード例 #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestJobControlWithFailJob()
        {
            Log.Info("Starting testJobControlWithFailJob");
            Configuration conf = CreateJobConf();

            CleanupData(conf);
            // create a Fail job
            Job job1 = MapReduceTestUtil.CreateFailJob(conf, outdir_1, indir);
            // create job dependencies
            JobControl theControl = CreateDependencies(conf, job1);

            // wait till all the jobs complete
            WaitTillAllFinished(theControl);
            NUnit.Framework.Assert.IsTrue(cjob1.GetJobState() == ControlledJob.State.Failed);
            NUnit.Framework.Assert.IsTrue(cjob2.GetJobState() == ControlledJob.State.Success);
            NUnit.Framework.Assert.IsTrue(cjob3.GetJobState() == ControlledJob.State.DependentFailed
                                          );
            NUnit.Framework.Assert.IsTrue(cjob4.GetJobState() == ControlledJob.State.DependentFailed
                                          );
            theControl.Stop();
        }
コード例 #2
0
        // run a job for which all the attempts simply fail.
        /// <exception cref="System.Exception"/>
        private void TestFailedJob(string fileName, Type output, string[] exclude)
        {
            Path outDir = GetNewOutputDir();
            Job  job    = MapReduceTestUtil.CreateFailJob(conf, outDir, inDir);

            job.SetOutputFormatClass(output);
            NUnit.Framework.Assert.IsFalse("Job did not fail!", job.WaitForCompletion(true));
            if (fileName != null)
            {
                Path testFile = new Path(outDir, fileName);
                NUnit.Framework.Assert.IsTrue("File " + testFile + " missing for failed job " + job
                                              .GetJobID(), fs.Exists(testFile));
            }
            // check if the files from the missing set exists
            foreach (string ex in exclude)
            {
                Path file = new Path(outDir, ex);
                NUnit.Framework.Assert.IsFalse("File " + file + " should not be present for failed job "
                                               + job.GetJobID(), fs.Exists(file));
            }
        }