Esempio n. 1
0
        public virtual JobState GetState()
        {
            JobState js = null;

            try
            {
                js = JobState.ValueOf(jobIndexInfo.GetJobStatus());
            }
            catch (Exception e)
            {
                // Meant for use by the display UI. Exception would prevent it from being
                // rendered.e Defaulting to KILLED
                Log.Warn("Exception while parsing job state. Defaulting to KILLED", e);
                js = JobState.Killed;
            }
            return(js);
        }
Esempio n. 2
0
        private void ConstructJobReport()
        {
            report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <JobReport>();
            report.SetJobId(jobId);
            report.SetJobState(JobState.ValueOf(jobInfo.GetJobStatus()));
            report.SetSubmitTime(jobInfo.GetSubmitTime());
            report.SetStartTime(jobInfo.GetLaunchTime());
            report.SetFinishTime(jobInfo.GetFinishTime());
            report.SetJobName(jobInfo.GetJobname());
            report.SetUser(jobInfo.GetUsername());
            if (GetTotalMaps() == 0)
            {
                report.SetMapProgress(1.0f);
            }
            else
            {
                report.SetMapProgress((float)GetCompletedMaps() / GetTotalMaps());
            }
            if (GetTotalReduces() == 0)
            {
                report.SetReduceProgress(1.0f);
            }
            else
            {
                report.SetReduceProgress((float)GetCompletedReduces() / GetTotalReduces());
            }
            report.SetJobFile(GetConfFile().ToString());
            string historyUrl = "N/A";

            try
            {
                historyUrl = MRWebAppUtil.GetApplicationWebURLOnJHSWithoutScheme(conf, jobId.GetAppId
                                                                                     ());
            }
            catch (UnknownHostException)
            {
            }
            //Ignore.
            report.SetTrackingUrl(historyUrl);
            report.SetAMInfos(GetAMInfos());
            report.SetIsUber(IsUber());
        }
Esempio n. 3
0
        public virtual JobsInfo GetJobs(string userQuery, string count, string stateQuery
                                        , string queueQuery, string startedBegin, string startedEnd, string finishBegin,
                                        string finishEnd)
        {
            long countParam = null;

            Init();
            if (count != null && !count.IsEmpty())
            {
                try
                {
                    countParam = long.Parse(count);
                }
                catch (FormatException e)
                {
                    throw new BadRequestException(e.Message);
                }
                if (countParam <= 0)
                {
                    throw new BadRequestException("limit value must be greater then 0");
                }
            }
            long sBegin = null;

            if (startedBegin != null && !startedBegin.IsEmpty())
            {
                try
                {
                    sBegin = long.Parse(startedBegin);
                }
                catch (FormatException e)
                {
                    throw new BadRequestException("Invalid number format: " + e.Message);
                }
                if (sBegin < 0)
                {
                    throw new BadRequestException("startedTimeBegin must be greater than 0");
                }
            }
            long sEnd = null;

            if (startedEnd != null && !startedEnd.IsEmpty())
            {
                try
                {
                    sEnd = long.Parse(startedEnd);
                }
                catch (FormatException e)
                {
                    throw new BadRequestException("Invalid number format: " + e.Message);
                }
                if (sEnd < 0)
                {
                    throw new BadRequestException("startedTimeEnd must be greater than 0");
                }
            }
            if (sBegin != null && sEnd != null && sBegin > sEnd)
            {
                throw new BadRequestException("startedTimeEnd must be greater than startTimeBegin"
                                              );
            }
            long fBegin = null;

            if (finishBegin != null && !finishBegin.IsEmpty())
            {
                try
                {
                    fBegin = long.Parse(finishBegin);
                }
                catch (FormatException e)
                {
                    throw new BadRequestException("Invalid number format: " + e.Message);
                }
                if (fBegin < 0)
                {
                    throw new BadRequestException("finishedTimeBegin must be greater than 0");
                }
            }
            long fEnd = null;

            if (finishEnd != null && !finishEnd.IsEmpty())
            {
                try
                {
                    fEnd = long.Parse(finishEnd);
                }
                catch (FormatException e)
                {
                    throw new BadRequestException("Invalid number format: " + e.Message);
                }
                if (fEnd < 0)
                {
                    throw new BadRequestException("finishedTimeEnd must be greater than 0");
                }
            }
            if (fBegin != null && fEnd != null && fBegin > fEnd)
            {
                throw new BadRequestException("finishedTimeEnd must be greater than finishedTimeBegin"
                                              );
            }
            JobState jobState = null;

            if (stateQuery != null)
            {
                jobState = JobState.ValueOf(stateQuery);
            }
            return(ctx.GetPartialJobs(0l, countParam, userQuery, queueQuery, sBegin, sEnd, fBegin
                                      , fEnd, jobState));
        }
Esempio n. 4
0
 public static JobState ConvertFromProtoFormat(MRProtos.JobStateProto e)
 {
     return(JobState.ValueOf(e.ToString().Replace(JobStatePrefix, string.Empty)));
 }
Esempio n. 5
0
 public virtual JobState GetState()
 {
     return(JobState.ValueOf(jobInfo.GetJobStatus()));
 }