Example #1
0
        public static Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job NewJob(ApplicationId appID
                                                                        , int i, int n, int m, Path confFile, bool hasFailedTasks)
        {
            JobId     id     = NewJobID(appID, i);
            string    name   = NewJobName();
            JobReport report = NewJobReport(id);
            IDictionary <TaskId, Task> tasks = NewTasks(id, n, m, hasFailedTasks);

            MockJobs.TaskCount taskCount = GetTaskCount(tasks.Values);
            Counters           counters  = GetCounters(tasks.Values);
            Path configFile = confFile;
            IDictionary <JobACL, AccessControlList> tmpJobACLs = new Dictionary <JobACL, AccessControlList
                                                                                 >();
            Configuration conf = new Configuration();

            conf.Set(JobACL.ViewJob.GetAclName(), "testuser");
            conf.SetBoolean(MRConfig.MrAclsEnabled, true);
            JobACLsManager aclsManager = new JobACLsManager(conf);

            tmpJobACLs = aclsManager.ConstructJobACLs(conf);
            IDictionary <JobACL, AccessControlList> jobACLs = tmpJobACLs;

            return(new _Job_503(id, name, report, counters, tasks, taskCount, configFile, jobACLs
                                , conf));
        }
            public MockJobForAcls(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job mockJob, Configuration
                                  conf)
            {
                this.mockJob = mockJob;
                this.conf    = conf;
                AccessControlList viewAcl = new AccessControlList(FriendlyUser);

                this.jobAcls = new Dictionary <JobACL, AccessControlList>();
                this.jobAcls[JobACL.ViewJob] = viewAcl;
                this.aclsMgr = new JobACLsManager(conf);
            }
Example #3
0
 /// <exception cref="System.IO.IOException"/>
 public CompletedJob(Configuration conf, JobId jobId, Path historyFile, bool loadTasks
                     , string userName, HistoryFileManager.HistoryFileInfo info, JobACLsManager aclsMgr
                     )
 {
     //Can be picked from JobInfo with a conversion.
     //Can be picked up from JobInfo
     Log.Info("Loading job: " + jobId + " from file: " + historyFile);
     this.conf    = conf;
     this.jobId   = jobId;
     this.user    = userName;
     this.info    = info;
     this.aclsMgr = aclsMgr;
     LoadFullHistoryData(loadTasks, historyFile);
 }
Example #4
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestAverageMergeTime()
        {
            string         historyFileName  = "job_1329348432655_0001-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist";
            string         confFileName     = "job_1329348432655_0001_conf.xml";
            Configuration  conf             = new Configuration();
            JobACLsManager jobAclsMgr       = new JobACLsManager(conf);
            Path           fulleHistoryPath = new Path(typeof(TestJobHistoryEntities).GetClassLoader().
                                                       GetResource(historyFileName).GetFile());
            Path fullConfPath = new Path(typeof(TestJobHistoryEntities).GetClassLoader().GetResource
                                             (confFileName).GetFile());

            HistoryFileManager.HistoryFileInfo info = Org.Mockito.Mockito.Mock <HistoryFileManager.HistoryFileInfo
                                                                                >();
            Org.Mockito.Mockito.When(info.GetConfFile()).ThenReturn(fullConfPath);
            JobId        jobId        = MRBuilderUtils.NewJobId(1329348432655l, 1, 1);
            CompletedJob completedJob = new CompletedJob(conf, jobId, fulleHistoryPath, true,
                                                         "user", info, jobAclsMgr);
            JobInfo jobInfo = new JobInfo(completedJob);

            // There are 2 tasks with merge time of 45 and 55 respectively. So average
            // merge time should be 50.
            NUnit.Framework.Assert.AreEqual(50L, jobInfo.GetAvgMergeTime());
        }
 /// <exception cref="System.Exception"/>
 public TestJobHistoryEntities(bool loadTasks)
 {
     jobAclsManager = new JobACLsManager(conf);
     this.loadTasks = loadTasks;
 }