Exemple #1
0
 protected internal override Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job CreateJob(
     Configuration conf, JobStateInternal forcedState, string diagnostic)
 {
     this.spiedJob = Org.Mockito.Mockito.Spy((JobImpl)base.CreateJob(conf, forcedState
                                                                     , diagnostic));
     ((AppContext)this.GetContext()).GetAllJobs()[this.spiedJob.GetID()] = this.spiedJob;
     return(this.spiedJob);
 }
 public TestMRApp(TestStagingCleanup _enclosing, ApplicationAttemptId applicationAttemptId
                  , ContainerAllocator allocator, JobStateInternal jobStateInternal, int maxAppAttempts
                  )
     : this(applicationAttemptId, allocator)
 {
     this._enclosing       = _enclosing;
     this.jobStateInternal = jobStateInternal;
 }
            protected internal override Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job CreateJob(
                Configuration conf, JobStateInternal forcedState, string diagnostic)
            {
                JobImpl jobImpl = Org.Mockito.Mockito.Mock <JobImpl>();

                Org.Mockito.Mockito.When(jobImpl.GetInternalState()).ThenReturn(this.jobStateInternal
                                                                                );
                Org.Mockito.Mockito.When(jobImpl.GetAllCounters()).ThenReturn(new Counters());
                JobID jobID = JobID.ForName("job_1234567890000_0001");
                JobId jobId = TypeConverter.ToYarn(jobID);

                Org.Mockito.Mockito.When(jobImpl.GetID()).ThenReturn(jobId);
                ((AppContext)this.GetContext()).GetAllJobs()[jobImpl.GetID()] = jobImpl;
                return(jobImpl);
            }
Exemple #4
0
 public TestJob(MRApp _enclosing, JobId jobId, ApplicationAttemptId applicationAttemptId
                , Configuration conf, EventHandler eventHandler, TaskAttemptListener taskAttemptListener
                , Clock clock, OutputCommitter committer, bool newApiCommitter, string user, AppContext
                appContext, JobStateInternal forcedState, string diagnostic)
     : base(jobId, MRApp.GetApplicationAttemptId(MRApp.applicationId, this._enclosing.
                                                 GetStartCount()), conf, eventHandler, taskAttemptListener, new JobTokenSecretManager
                (), new Credentials(), clock, this._enclosing.GetCompletedTaskFromPreviousRun(),
            this._enclosing.metrics, committer, newApiCommitter, user, Runtime.CurrentTimeMillis
                (), this._enclosing.GetAllAMInfos(), appContext, forcedState, diagnostic)
 {
     this._enclosing = _enclosing;
     // This "this leak" is okay because the retained pointer is in an
     //  instance variable.
     this.localStateMachine = this.localFactory.Make(this);
 }
Exemple #5
0
        /// <exception cref="System.Exception"/>
        public virtual void WaitForInternalState(JobImpl job, JobStateInternal finalState
                                                 )
        {
            int timeoutSecs         = 0;
            JobStateInternal iState = job.GetInternalState();

            while (!finalState.Equals(iState) && timeoutSecs++ < 20)
            {
                System.Console.Out.WriteLine("Job Internal State is : " + iState + " Waiting for Internal state : "
                                             + finalState);
                Sharpen.Thread.Sleep(500);
                iState = job.GetInternalState();
            }
            System.Console.Out.WriteLine("Task Internal State is : " + iState);
            NUnit.Framework.Assert.AreEqual("Task Internal state is not correct (timedout)",
                                            finalState, iState);
        }
Exemple #6
0
        protected internal override Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job CreateJob(
            Configuration conf, JobStateInternal forcedState, string diagnostic)
        {
            UserGroupInformation currentUser = null;

            try
            {
                currentUser = UserGroupInformation.GetCurrentUser();
            }
            catch (IOException e)
            {
                throw new YarnRuntimeException(e);
            }
            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job newJob = new MRApp.TestJob(this, GetJobId
                                                                                      (), GetAttemptID(), conf, GetDispatcher().GetEventHandler(), GetTaskAttemptListener
                                                                                      (), GetContext().GetClock(), GetCommitter(), IsNewApiCommitter(), currentUser.GetUserName
                                                                                      (), GetContext(), forcedState, diagnostic);
            ((AppContext)GetContext()).GetAllJobs()[newJob.GetID()] = newJob;
            GetDispatcher().Register(typeof(JobFinishEvent.Type), new _EventHandler_473(this)
                                     );
            return(newJob);
        }