Beispiel #1
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public override YarnClusterMetrics GetYarnClusterMetrics()
        {
            GetClusterMetricsRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <
                GetClusterMetricsRequest>();
            GetClusterMetricsResponse response = rmClient.GetClusterMetrics(request);

            return(response.GetClusterMetrics());
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.GetClusterMetricsResponseProto GetClusterMetrics
            (RpcController arg0, YarnServiceProtos.GetClusterMetricsRequestProto proto)
        {
            GetClusterMetricsRequestPBImpl request = new GetClusterMetricsRequestPBImpl(proto
                                                                                        );

            try
            {
                GetClusterMetricsResponse response = real.GetClusterMetrics(request);
                return(((GetClusterMetricsResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Beispiel #3
0
        /// <exception cref="System.Exception"/>
        public virtual void TestResourceMgrDelegate()
        {
            /* we not want a mock of resource mgr delegate */
            ApplicationClientProtocol clientRMProtocol = Org.Mockito.Mockito.Mock <ApplicationClientProtocol
                                                                                   >();
            ResourceMgrDelegate delegate_ = new _ResourceMgrDelegate_256(clientRMProtocol, conf
                                                                         );

            /* make sure kill calls finish application master */
            Org.Mockito.Mockito.When(clientRMProtocol.ForceKillApplication(Matchers.Any <KillApplicationRequest
                                                                                         >())).ThenReturn(KillApplicationResponse.NewInstance(true));
            delegate_.KillApplication(appId);
            Org.Mockito.Mockito.Verify(clientRMProtocol).ForceKillApplication(Matchers.Any <KillApplicationRequest
                                                                                            >());
            /* make sure getalljobs calls get all applications */
            Org.Mockito.Mockito.When(clientRMProtocol.GetApplications(Matchers.Any <GetApplicationsRequest
                                                                                    >())).ThenReturn(recordFactory.NewRecordInstance <GetApplicationsResponse>());
            delegate_.GetAllJobs();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetApplications(Matchers.Any <GetApplicationsRequest
                                                                                       >());
            /* make sure getapplication report is called */
            Org.Mockito.Mockito.When(clientRMProtocol.GetApplicationReport(Matchers.Any <GetApplicationReportRequest
                                                                                         >())).ThenReturn(recordFactory.NewRecordInstance <GetApplicationReportResponse>()
                                                                                                          );
            delegate_.GetApplicationReport(appId);
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetApplicationReport(Matchers.Any <GetApplicationReportRequest
                                                                                            >());
            /* make sure metrics is called */
            GetClusterMetricsResponse clusterMetricsResponse = recordFactory.NewRecordInstance
                                                               <GetClusterMetricsResponse>();

            clusterMetricsResponse.SetClusterMetrics(recordFactory.NewRecordInstance <YarnClusterMetrics
                                                                                      >());
            Org.Mockito.Mockito.When(clientRMProtocol.GetClusterMetrics(Matchers.Any <GetClusterMetricsRequest
                                                                                      >())).ThenReturn(clusterMetricsResponse);
            delegate_.GetClusterMetrics();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetClusterMetrics(Matchers.Any <GetClusterMetricsRequest
                                                                                         >());
            Org.Mockito.Mockito.When(clientRMProtocol.GetClusterNodes(Matchers.Any <GetClusterNodesRequest
                                                                                    >())).ThenReturn(recordFactory.NewRecordInstance <GetClusterNodesResponse>());
            delegate_.GetActiveTrackers();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetClusterNodes(Matchers.Any <GetClusterNodesRequest
                                                                                       >());
            GetNewApplicationResponse newAppResponse = recordFactory.NewRecordInstance <GetNewApplicationResponse
                                                                                        >();

            newAppResponse.SetApplicationId(appId);
            Org.Mockito.Mockito.When(clientRMProtocol.GetNewApplication(Matchers.Any <GetNewApplicationRequest
                                                                                      >())).ThenReturn(newAppResponse);
            delegate_.GetNewJobID();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetNewApplication(Matchers.Any <GetNewApplicationRequest
                                                                                         >());
            GetQueueInfoResponse queueInfoResponse = recordFactory.NewRecordInstance <GetQueueInfoResponse
                                                                                      >();

            queueInfoResponse.SetQueueInfo(recordFactory.NewRecordInstance <QueueInfo>());
            Org.Mockito.Mockito.When(clientRMProtocol.GetQueueInfo(Matchers.Any <GetQueueInfoRequest
                                                                                 >())).ThenReturn(queueInfoResponse);
            delegate_.GetQueues();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetQueueInfo(Matchers.Any <GetQueueInfoRequest
                                                                                    >());
            GetQueueUserAclsInfoResponse aclResponse = recordFactory.NewRecordInstance <GetQueueUserAclsInfoResponse
                                                                                        >();

            Org.Mockito.Mockito.When(clientRMProtocol.GetQueueUserAcls(Matchers.Any <GetQueueUserAclsInfoRequest
                                                                                     >())).ThenReturn(aclResponse);
            delegate_.GetQueueAclsForCurrentUser();
            Org.Mockito.Mockito.Verify(clientRMProtocol).GetQueueUserAcls(Matchers.Any <GetQueueUserAclsInfoRequest
                                                                                        >());
        }