示例#1
0
        public async Task I_can_submit_the_job_and_wait_for_completion()
        {
            var job = LivyBatchRequest.FromJar(_settings.SparkJobFile, _settings.SparkJobClassName);

            LivyBatchResponse response = await _api.ExecuteWorkflowAsync(job, TimeSpan.FromMinutes(10));

            Assert.NotNull(response);
        }
示例#2
0
        public async Task I_can_submit_job_and_get_back_its_status()
        {
            var job = LivyBatchRequest.FromJar(_settings.SparkJobFile, _settings.SparkJobClassName);

            job.Args = new[] { Guid.NewGuid().ToString(), "p1=v1" };

            LivyBatchResponse response = await _api.ExecuteAsync(job);

            Assert.NotNull(response.SessionId);

            LivyBatchResponse batch = await _api.GetBatchStateAsync(response.SessionId);

            Assert.Equal(SparkJobState.Starting, batch.State);
        }
示例#3
0
        public async Task TestExecute()
        {
            var settings      = new LivySettings("azurecoder", "M!crosoft123", "flightaware-dev");
            var sparkSettings = new LivyBatchRequest(null);
            var api           = new Mock <LivyRestApi>(settings);

            api.Protected()
            .Setup <Task <string> >("MakeRequest", ItExpr.IsAny <string>(), ItExpr.IsAny <string>(), ItExpr.IsAny <string>())
            .Returns(Task.FromResult(ExecuteResponse));

            var application = await api.Object.ExecuteAsync(sparkSettings);

            Assert.Equal(123, application.SessionId);
            Assert.Equal(SparkJobState.Starting, application.State);
        }