public async Task TestGetClusterMetrics()
        {
            var injector = TangFactory.GetTang().NewInjector();
            var cred = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();
            injector.BindVolatileInstance(GenericType<IYarnRestClientCredential>.Class, cred);
            injector.BindVolatileInstance(GenericType<IUrlProvider>.Class, urlProvider);
            var client = injector.GetInstance<IYarnRMClient>();

            var clusterMetrics = await client.GetClusterMetricsAsync();

            Assert.NotNull(clusterMetrics);
            Assert.True(clusterMetrics.TotalMB > 0);
            Assert.True(clusterMetrics.ActiveNodes > 0);
        }
        public async Task TestGetClusterInfo()
        {
            var injector = TangFactory.GetTang().NewInjector();
            var cred = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();
            injector.BindVolatileInstance(GenericType<IYarnRestClientCredential>.Class, cred);
            injector.BindVolatileInstance(GenericType<IUrlProvider>.Class, urlProvider);
            var client = injector.GetInstance<IYarnRMClient>();

            var clusterInfo = await client.GetClusterInfoAsync();

            Assert.NotNull(clusterInfo);
            Assert.Equal(ClusterState.STARTED, clusterInfo.State);
            Assert.True(clusterInfo.StartedOn > 0);
        }
Beispiel #3
0
        public async Task TestGetClusterMetrics()
        {
            var injector    = TangFactory.GetTang().NewInjector();
            var cred        = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();

            injector.BindVolatileInstance(GenericType <IYarnRestClientCredential> .Class, cred);
            injector.BindVolatileInstance(GenericType <IUrlProvider> .Class, urlProvider);
            var client = injector.GetInstance <IYarnRMClient>();

            var clusterMetrics = await client.GetClusterMetricsAsync();

            Assert.NotNull(clusterMetrics);
            Assert.True(clusterMetrics.TotalMB > 0);
            Assert.True(clusterMetrics.ActiveNodes > 0);
        }
Beispiel #4
0
        public async Task TestGetClusterInfo()
        {
            var injector    = TangFactory.GetTang().NewInjector();
            var cred        = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();

            injector.BindVolatileInstance(GenericType <IYarnRestClientCredential> .Class, cred);
            injector.BindVolatileInstance(GenericType <IUrlProvider> .Class, urlProvider);
            var client = injector.GetInstance <IYarnRMClient>();

            var clusterInfo = await client.GetClusterInfoAsync();

            Assert.NotNull(clusterInfo);
            Assert.Equal(ClusterState.STARTED, clusterInfo.State);
            Assert.True(clusterInfo.StartedOn > 0);
        }
        public async Task TestApplicationSubmissionAndQuery()
        {
            var injector = TangFactory.GetTang().NewInjector();
            var cred = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();
            injector.BindVolatileInstance(GenericType<IYarnRestClientCredential>.Class, cred);
            injector.BindVolatileInstance(GenericType<IUrlProvider>.Class, urlProvider);
            var client = injector.GetInstance<IYarnRMClient>();

            var newApplication = await client.CreateNewApplicationAsync();

            Assert.NotNull(newApplication);
            Assert.False(string.IsNullOrEmpty(newApplication.ApplicationId));
            Assert.True(newApplication.MaximumResourceCapability.MemoryMB > 0);
            Assert.True(newApplication.MaximumResourceCapability.VCores > 0);

            string applicationName = "REEFTEST_APPLICATION_" + Guid.NewGuid();
            Console.WriteLine(applicationName);

            const string anyApplicationType = "REEFTest";
            var submitApplicationRequest = new SubmitApplication
            {
                ApplicationId = newApplication.ApplicationId,
                AmResource = new Resouce
                {
                    MemoryMB = 500,
                    VCores = 1
                },
                ApplicationType = anyApplicationType,
                ApplicationName = applicationName,
                KeepContainersAcrossApplicationAttempts = false,
                MaxAppAttempts = 1,
                Priority = 1,
                UnmanagedAM = false,
                AmContainerSpec = new AmContainerSpec
                {
                    Commands = new Commands
                    {
                        Command = @"DONTCARE"
                    },
                    LocalResources = new LocalResources
                    {
                        Entries = new List<YARN.RestClient.DataModel.KeyValuePair<string, LocalResourcesValue>>
                        {
                            new YARN.RestClient.DataModel.KeyValuePair<string, LocalResourcesValue>
                            {
                                Key = "APPLICATIONWILLFAILBUTWEDONTCAREHERE",
                                Value = new LocalResourcesValue
                                {
                                    Resource = "Foo",
                                    Type = ResourceType.FILE,
                                    Visibility = Visibility.APPLICATION
                                }
                            }
                        }
                    }
                }
            };

            var application = await client.SubmitApplicationAsync(submitApplicationRequest);

            Assert.NotNull(application);
            Assert.Equal(newApplication.ApplicationId, application.Id);
            Assert.Equal(applicationName, application.Name);
            Assert.Equal(anyApplicationType, application.ApplicationType);

            var getApplicationResult = client.GetApplicationAsync(newApplication.ApplicationId).GetAwaiter().GetResult();

            Assert.NotNull(getApplicationResult);
            Assert.Equal(newApplication.ApplicationId, getApplicationResult.Id);
            Assert.Equal(applicationName, getApplicationResult.Name);
            Assert.Equal(anyApplicationType, getApplicationResult.ApplicationType);
        }
Beispiel #6
0
        public async Task TestApplicationSubmissionAndQuery()
        {
            var injector    = TangFactory.GetTang().NewInjector();
            var cred        = new HDInsightTestCredential();
            var urlProvider = new HDInsightRMUrlProvider();

            injector.BindVolatileInstance(GenericType <IYarnRestClientCredential> .Class, cred);
            injector.BindVolatileInstance(GenericType <IUrlProvider> .Class, urlProvider);
            var client = injector.GetInstance <IYarnRMClient>();

            var newApplication = await client.CreateNewApplicationAsync();

            Assert.NotNull(newApplication);
            Assert.False(string.IsNullOrEmpty(newApplication.ApplicationId));
            Assert.True(newApplication.MaximumResourceCapability.MemoryMB > 0);
            Assert.True(newApplication.MaximumResourceCapability.VCores > 0);

            string applicationName = "REEFTEST_APPLICATION_" + Guid.NewGuid();

            Console.WriteLine(applicationName);

            const string anyApplicationType       = "REEFTest";
            var          submitApplicationRequest = new SubmitApplication
            {
                ApplicationId = newApplication.ApplicationId,
                AmResource    = new Resouce
                {
                    MemoryMB = 500,
                    VCores   = 1
                },
                ApplicationType = anyApplicationType,
                ApplicationName = applicationName,
                KeepContainersAcrossApplicationAttempts = false,
                MaxAppAttempts  = 1,
                Priority        = 1,
                UnmanagedAM     = false,
                AmContainerSpec = new AmContainerSpec
                {
                    Commands = new Commands
                    {
                        Command = @"DONTCARE"
                    },
                    LocalResources = new LocalResources
                    {
                        Entries = new List <YARN.RestClient.DataModel.KeyValuePair <string, LocalResourcesValue> >
                        {
                            new YARN.RestClient.DataModel.KeyValuePair <string, LocalResourcesValue>
                            {
                                Key   = "APPLICATIONWILLFAILBUTWEDONTCAREHERE",
                                Value = new LocalResourcesValue
                                {
                                    Resource   = "Foo",
                                    Type       = ResourceType.FILE,
                                    Visibility = Visibility.APPLICATION
                                }
                            }
                        }
                    }
                }
            };

            var application = await client.SubmitApplicationAsync(submitApplicationRequest);

            Assert.NotNull(application);
            Assert.Equal(newApplication.ApplicationId, application.Id);
            Assert.Equal(applicationName, application.Name);
            Assert.Equal(anyApplicationType, application.ApplicationType);

            var getApplicationResult = client.GetApplicationAsync(newApplication.ApplicationId).GetAwaiter().GetResult();

            Assert.NotNull(getApplicationResult);
            Assert.Equal(newApplication.ApplicationId, getApplicationResult.Id);
            Assert.Equal(applicationName, getApplicationResult.Name);
            Assert.Equal(anyApplicationType, getApplicationResult.ApplicationType);
        }