public virtual void TestMRAppMasterSuccessLock() { string applicationAttemptIdStr = "appattempt_1317529182569_0004_000002"; string containerIdStr = "container_1317529182569_0004_000002_1"; string userName = "******"; JobConf conf = new JobConf(); conf.Set(MRJobConfig.MrAmStagingDir, stagingDir); ApplicationAttemptId applicationAttemptId = ConverterUtils.ToApplicationAttemptId (applicationAttemptIdStr); JobId jobId = TypeConverter.ToYarn(TypeConverter.FromYarn(applicationAttemptId.GetApplicationId ())); Path start = MRApps.GetStartJobCommitFile(conf, userName, jobId); Path end = MRApps.GetEndJobCommitSuccessFile(conf, userName, jobId); FileSystem fs = FileSystem.Get(conf); fs.Create(start).Close(); fs.Create(end).Close(); ContainerId containerId = ConverterUtils.ToContainerId(containerIdStr); MRAppMaster appMaster = new MRAppMasterTest(applicationAttemptId, containerId, "host" , -1, -1, Runtime.CurrentTimeMillis(), false, false); bool caught = false; try { MRAppMaster.InitAndStartAppMaster(appMaster, conf, userName); } catch (IOException e) { //The IO Exception is expected Log.Info("Caught expected Exception", e); caught = true; } NUnit.Framework.Assert.IsTrue(caught); NUnit.Framework.Assert.IsTrue(appMaster.errorHappenedShutDown); NUnit.Framework.Assert.AreEqual(JobStateInternal.Succeeded, appMaster.forcedState ); appMaster.Stop(); // verify the final status is SUCCEEDED VerifyFailedStatus((MRAppMasterTest)appMaster, "SUCCEEDED"); }
public virtual void TestMRAppMasterMissingStaging() { string applicationAttemptIdStr = "appattempt_1317529182569_0004_000002"; string containerIdStr = "container_1317529182569_0004_000002_1"; string userName = "******"; JobConf conf = new JobConf(); conf.Set(MRJobConfig.MrAmStagingDir, stagingDir); ApplicationAttemptId applicationAttemptId = ConverterUtils.ToApplicationAttemptId (applicationAttemptIdStr); //Delete the staging directory FilePath dir = new FilePath(stagingDir); if (dir.Exists()) { FileUtils.DeleteDirectory(dir); } ContainerId containerId = ConverterUtils.ToContainerId(containerIdStr); MRAppMaster appMaster = new MRAppMasterTest(applicationAttemptId, containerId, "host" , -1, -1, Runtime.CurrentTimeMillis(), false, false); bool caught = false; try { MRAppMaster.InitAndStartAppMaster(appMaster, conf, userName); } catch (IOException e) { //The IO Exception is expected Log.Info("Caught expected Exception", e); caught = true; } NUnit.Framework.Assert.IsTrue(caught); NUnit.Framework.Assert.IsTrue(appMaster.errorHappenedShutDown); //Copying the history file is disabled, but it is not really visible from //here NUnit.Framework.Assert.AreEqual(JobStateInternal.Error, appMaster.forcedState); appMaster.Stop(); }