コード例 #1
0
ファイル: JobEndNotifier.cs プロジェクト: orf53975/hadoop.net
        /// <summary>Notify a server of the completion of a submitted job.</summary>
        /// <remarks>
        /// Notify a server of the completion of a submitted job. The user must have
        /// configured MRJobConfig.MR_JOB_END_NOTIFICATION_URL
        /// </remarks>
        /// <param name="jobReport">JobReport used to read JobId and JobStatus</param>
        /// <exception cref="System.Exception"/>
        public virtual void Notify(JobReport jobReport)
        {
            // Do we need job-end notification?
            if (userUrl == null)
            {
                Org.Mortbay.Log.Log.Info("Job end notification URL not set, skipping.");
                return;
            }
            //Do string replacements for jobId and jobStatus
            if (userUrl.Contains(JobId))
            {
                userUrl = userUrl.Replace(JobId, jobReport.GetJobId().ToString());
            }
            if (userUrl.Contains(JobStatus))
            {
                userUrl = userUrl.Replace(JobStatus, jobReport.GetJobState().ToString());
            }
            // Create the URL, ensure sanity
            try
            {
                urlToNotify = new Uri(userUrl);
            }
            catch (UriFormatException mue)
            {
                Org.Mortbay.Log.Log.Warn("Job end notification couldn't parse " + userUrl, mue);
                return;
            }
            // Send notification
            bool success = false;

            while (numTries-- > 0 && !success)
            {
                Org.Mortbay.Log.Log.Info("Job end notification attempts left " + numTries);
                success = NotifyURLOnce();
                if (!success)
                {
                    Sharpen.Thread.Sleep(waitInterval);
                }
            }
            if (!success)
            {
                Org.Mortbay.Log.Log.Warn("Job end notification failed to notify : " + urlToNotify
                                         );
            }
            else
            {
                Org.Mortbay.Log.Log.Info("Job end notification succeeded for " + jobReport.GetJobId
                                             ());
            }
        }
コード例 #2
0
ファイル: TypeConverter.cs プロジェクト: orf53975/hadoop.net
        public static JobStatus FromYarn(JobReport jobreport, string trackingUrl)
        {
            JobPriority jobPriority = JobPriority.Normal;
            JobStatus   jobStatus   = new JobStatus(FromYarn(jobreport.GetJobId()), jobreport.GetSetupProgress
                                                        (), jobreport.GetMapProgress(), jobreport.GetReduceProgress(), jobreport.GetCleanupProgress
                                                        (), FromYarn(jobreport.GetJobState()), jobPriority, jobreport.GetUser(), jobreport
                                                    .GetJobName(), jobreport.GetJobFile(), trackingUrl, jobreport.IsUber());

            jobStatus.SetStartTime(jobreport.GetStartTime());
            jobStatus.SetFinishTime(jobreport.GetFinishTime());
            jobStatus.SetFailureInfo(jobreport.GetDiagnostics());
            return(jobStatus);
        }