/// <exception cref="System.IO.IOException"/>
            /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
            public override void LaunchAM(ApplicationAttemptId attemptId)
            {
                YarnApplicationAttemptState attemptState = this.rmClient.GetApplicationAttemptReport
                                                               (attemptId).GetYarnApplicationAttemptState();

                NUnit.Framework.Assert.IsTrue(attemptState.Equals(YarnApplicationAttemptState.Launched
                                                                  ));
                base.LaunchAM(attemptId);
            }
 public override void SetYarnApplicationAttemptState(YarnApplicationAttemptState state
                                                     )
 {
     MaybeInitBuilder();
     if (state == null)
     {
         builder.ClearYarnApplicationAttemptState();
         return;
     }
     builder.SetYarnApplicationAttemptState(ConvertToProtoFormat(state));
 }
예제 #3
0
 public AppAttemptFinishedEvent(ApplicationAttemptId appAttemptId, string trackingUrl
                                , string originalTrackingUrl, string diagnosticsInfo, FinalApplicationStatus appStatus
                                , YarnApplicationAttemptState state, long finishedTime)
     : base(SystemMetricsEventType.AppAttemptFinished, finishedTime)
 {
     this.appAttemptId = appAttemptId;
     // This is the tracking URL after the application attempt is finished
     this.trackingUrl         = trackingUrl;
     this.originalTrackingUrl = originalTrackingUrl;
     this.diagnosticsInfo     = diagnosticsInfo;
     this.appStatus           = appStatus;
     this.state = state;
 }
예제 #4
0
        public static ApplicationAttemptFinishData NewInstance(ApplicationAttemptId appAttemptId
                                                               , string diagnosticsInfo, string trackingURL, FinalApplicationStatus finalApplicationStatus
                                                               , YarnApplicationAttemptState yarnApplicationAttemptState)
        {
            ApplicationAttemptFinishData appAttemptFD = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                        <ApplicationAttemptFinishData>();

            appAttemptFD.SetApplicationAttemptId(appAttemptId);
            appAttemptFD.SetDiagnosticsInfo(diagnosticsInfo);
            appAttemptFD.SetTrackingURL(trackingURL);
            appAttemptFD.SetFinalApplicationStatus(finalApplicationStatus);
            appAttemptFD.SetYarnApplicationAttemptState(yarnApplicationAttemptState);
            return(appAttemptFD);
        }
예제 #5
0
 public AppAttemptInfo(ApplicationAttemptReport appAttempt)
 {
     // JAXB needs this
     appAttemptId        = appAttempt.GetApplicationAttemptId().ToString();
     host                = appAttempt.GetHost();
     rpcPort             = appAttempt.GetRpcPort();
     trackingUrl         = appAttempt.GetTrackingUrl();
     originalTrackingUrl = appAttempt.GetOriginalTrackingUrl();
     diagnosticsInfo     = appAttempt.GetDiagnostics();
     appAttemptState     = appAttempt.GetYarnApplicationAttemptState();
     if (appAttempt.GetAMContainerId() != null)
     {
         amContainerId = appAttempt.GetAMContainerId().ToString();
     }
 }
예제 #6
0
        protected override void CreateAttemptHeadRoomTable(HtmlBlock.Block html)
        {
            RMAppAttempt attempt = GetRMAppAttempt();

            if (attempt != null)
            {
                if (!IsApplicationInFinalState(YarnApplicationAttemptState.ValueOf(attempt.GetAppAttemptState
                                                                                       ().ToString())))
                {
                    RMAppAttemptMetrics metrics = attempt.GetRMAppAttemptMetrics();
                    Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> pdiv = html.(typeof(InfoBlock
                                                                                                 )).Div(JQueryUI.InfoWrap);
                    Info("Application Attempt Overview").Clear();
                    Info("Application Attempt Metrics").("Application Attempt Headroom : ", metrics ==
                                                         null ? "N/A" : metrics.GetApplicationAttemptHeadroom());
                    pdiv.();
                }
            }
        }
예제 #7
0
 private bool IsApplicationInFinalState(YarnApplicationAttemptState state)
 {
     return(state == YarnApplicationAttemptState.Finished || state == YarnApplicationAttemptState
            .Failed || state == YarnApplicationAttemptState.Killed);
 }
예제 #8
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private ApplicationAttemptReport MonitorCurrentAppAttempt(ApplicationId appId, YarnApplicationAttemptState
                                                                  attemptState)
        {
            long startTime = Runtime.CurrentTimeMillis();
            ApplicationAttemptId attemptId = null;

            while (true)
            {
                if (attemptId == null)
                {
                    attemptId = rmClient.GetApplicationReport(appId).GetCurrentApplicationAttemptId();
                }
                ApplicationAttemptReport attemptReport = null;
                if (attemptId != null)
                {
                    attemptReport = rmClient.GetApplicationAttemptReport(attemptId);
                    if (attemptState.Equals(attemptReport.GetYarnApplicationAttemptState()))
                    {
                        return(attemptReport);
                    }
                }
                Log.Info("Current attempt state of " + appId + " is " + (attemptReport == null ?
                                                                         " N/A " : attemptReport.GetYarnApplicationAttemptState()) + ", waiting for current attempt to reach "
                         + attemptState);
                try
                {
                    Sharpen.Thread.Sleep(1000);
                }
                catch (Exception)
                {
                    Log.Warn("Interrupted while waiting for current attempt of " + appId + " to reach "
                             + attemptState);
                }
                if (Runtime.CurrentTimeMillis() - startTime > AmStateWaitTimeoutMs)
                {
                    string errmsg = "Timeout for waiting current attempt of " + appId + " to reach "
                                    + attemptState;
                    Log.Error(errmsg);
                    throw new RuntimeException(errmsg);
                }
            }
        }
예제 #9
0
 public abstract void SetYarnApplicationAttemptState(YarnApplicationAttemptState yarnApplicationAttemptState
                                                     );
예제 #10
0
        public static ApplicationAttemptHistoryData NewInstance(ApplicationAttemptId appAttemptId
                                                                , string host, int rpcPort, ContainerId masterContainerId, string diagnosticsInfo
                                                                , string trackingURL, FinalApplicationStatus finalApplicationStatus, YarnApplicationAttemptState
                                                                yarnApplicationAttemptState)
        {
            ApplicationAttemptHistoryData appAttemptHD = new ApplicationAttemptHistoryData();

            appAttemptHD.SetApplicationAttemptId(appAttemptId);
            appAttemptHD.SetHost(host);
            appAttemptHD.SetRPCPort(rpcPort);
            appAttemptHD.SetMasterContainerId(masterContainerId);
            appAttemptHD.SetDiagnosticsInfo(diagnosticsInfo);
            appAttemptHD.SetTrackingURL(trackingURL);
            appAttemptHD.SetFinalApplicationStatus(finalApplicationStatus);
            appAttemptHD.SetYarnApplicationAttemptState(yarnApplicationAttemptState);
            return(appAttemptHD);
        }
예제 #11
0
 public virtual void SetYarnApplicationAttemptState(YarnApplicationAttemptState yarnApplicationAttemptState
                                                    )
 {
     this.yarnApplicationAttemptState = yarnApplicationAttemptState;
 }
예제 #12
0
 public static YarnApplicationAttemptState ConvertFromProtoFormat(YarnProtos.YarnApplicationAttemptStateProto
                                                                  e)
 {
     return(YarnApplicationAttemptState.ValueOf(e.ToString().Replace(YarnApplicationAttemptStatePrefix
                                                                     , string.Empty)));
 }
예제 #13
0
 /*
  * YarnApplicationAttemptState
  */
 public static YarnProtos.YarnApplicationAttemptStateProto ConvertToProtoFormat(YarnApplicationAttemptState
                                                                                e)
 {
     return(YarnProtos.YarnApplicationAttemptStateProto.ValueOf(YarnApplicationAttemptStatePrefix
                                                                + e.ToString()));
 }
 private YarnProtos.YarnApplicationAttemptStateProto ConvertToProtoFormat(YarnApplicationAttemptState
                                                                          state)
 {
     return(ProtoUtils.ConvertToProtoFormat(state));
 }
        private static ApplicationAttemptReport ConvertToApplicationAttemptReport(TimelineEntity
                                                                                  entity)
        {
            string      host                   = null;
            int         rpcPort                = -1;
            ContainerId amContainerId          = null;
            string      trackingUrl            = null;
            string      originalTrackingUrl    = null;
            string      diagnosticsInfo        = null;
            YarnApplicationAttemptState state  = null;
            IList <TimelineEvent>       events = entity.GetEvents();

            if (events != null)
            {
                foreach (TimelineEvent @event in events)
                {
                    if (@event.GetEventType().Equals(AppAttemptMetricsConstants.RegisteredEventType))
                    {
                        IDictionary <string, object> eventInfo = @event.GetEventInfo();
                        if (eventInfo == null)
                        {
                            continue;
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.HostEventInfo))
                        {
                            host = eventInfo[AppAttemptMetricsConstants.HostEventInfo].ToString();
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.RpcPortEventInfo))
                        {
                            rpcPort = (int)eventInfo[AppAttemptMetricsConstants.RpcPortEventInfo];
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.MasterContainerEventInfo))
                        {
                            amContainerId = ConverterUtils.ToContainerId(eventInfo[AppAttemptMetricsConstants
                                                                                   .MasterContainerEventInfo].ToString());
                        }
                    }
                    else
                    {
                        if (@event.GetEventType().Equals(AppAttemptMetricsConstants.FinishedEventType))
                        {
                            IDictionary <string, object> eventInfo = @event.GetEventInfo();
                            if (eventInfo == null)
                            {
                                continue;
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.TrackingUrlEventInfo))
                            {
                                trackingUrl = eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo].ToString
                                                  ();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo))
                            {
                                originalTrackingUrl = eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo
                                                      ].ToString();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.DiagnosticsInfoEventInfo))
                            {
                                diagnosticsInfo = eventInfo[AppAttemptMetricsConstants.DiagnosticsInfoEventInfo].
                                                  ToString();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.StateEventInfo))
                            {
                                state = YarnApplicationAttemptState.ValueOf(eventInfo[AppAttemptMetricsConstants.
                                                                                      StateEventInfo].ToString());
                            }
                        }
                    }
                }
            }
            return(ApplicationAttemptReport.NewInstance(ConverterUtils.ToApplicationAttemptId
                                                            (entity.GetEntityId()), host, rpcPort, trackingUrl, originalTrackingUrl, diagnosticsInfo
                                                        , state, amContainerId));
        }
        public static ApplicationAttemptReport NewInstance(ApplicationAttemptId applicationAttemptId
                                                           , string host, int rpcPort, string url, string oUrl, string diagnostics, YarnApplicationAttemptState
                                                           state, ContainerId amContainerId)
        {
            ApplicationAttemptReport report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <ApplicationAttemptReport
                                                                                             >();

            report.SetApplicationAttemptId(applicationAttemptId);
            report.SetHost(host);
            report.SetRpcPort(rpcPort);
            report.SetTrackingUrl(url);
            report.SetOriginalTrackingUrl(oUrl);
            report.SetDiagnostics(diagnostics);
            report.SetYarnApplicationAttemptState(state);
            report.SetAMContainerId(amContainerId);
            return(report);
        }