public async Task Submit_run_to_existing_cluster() { var newRun = new NewRun { ExistingClusterId = "1", /*Libraries = new List<Dictionary<string, string>> * { * new Dictionary<string, string> * { * ["jar"] = "dbfs:/FileStore/jars/1796537b_8feb_43d1_bf5e_9236672fd184-dataquality.jar" * } * },*/ NotebookTask = new NotebookTask { Path = "/hello", Parameters = new[] { new ParamPair("key1", "value1"), new ParamPair("key2", "value2") } } }; long runId = await Client.Jobs.SubmitRunAsync(newRun); Run run = await Client.Jobs.GetRunAsync(runId); Assert.NotNull(run); }
public async Task Submit_run_to_new__autoscale_cluster() { var newRun = new NewRun { NewCluster = new NewCluster { Autoscale = new Autoscale() { MinWorkers = 2, MaxWorkers = 4 }, SparkVersion = "3.4.x-scala2.11", NodeTypeId = "Standard_D3_v2" }, Libraries = new List <Dictionary <string, string> > { new Dictionary <string, string> { ["jar"] = "dbfs:/FileStore/jars/1796537b_8feb_43d1_bf5e_9236672fd184-dataquality.jar" } }, NotebookTask = new NotebookTask { Path = "QATestPHLRules/PHLTestRules", // Parameters = new[] { } } }; long runId = await Client.Jobs.SubmitRunAsync(newRun); Run run = await Client.Jobs.GetRunAsync(runId); Assert.NotNull(run); }
public async Task Submit_run_to_new_cluster() { var newRun = new NewRun { NewCluster = new NewCluster { NumWorkers = 4, SparkVersion = "3.4.x-scala2.11", NodeTypeId = "Standard_D3_v2" }, Libraries = new List <Dictionary <string, string> > { new Dictionary <string, string> { ["jar"] = "dbfs:/FileStore/jars/1796537b_8feb_43d1_bf5e_9236672fd184-dataquality.jar" } }, NotebookTask = new NotebookTask { Path = "/hello", Parameters = new[] { new ParamPair("key1", "value1"), new ParamPair("key2", "value2") } } }; long runId = await Client.Jobs.SubmitRunAsync(newRun); Run run = await Client.Jobs.GetRunAsync(runId); Assert.NotNull(run); }
public void NewTry() { history.Clear(); if (players.Count() > 0) { NewRun?.Invoke(); BeginGame(); } }
/// <summary> /// Submits a new run and returns the run ID. /// </summary> /// <param name="run"></param> /// <returns></returns> public async Task <long> SubmitRunAsync(NewRun run) { try { SubmitRunResponse response = await _endpoint.SubmitRun(run); return(response.RunId); } catch (ApiException ex) { ErrorDetails errorDetails = JsonConvert.DeserializeObject <ErrorDetails>(ex.Content); throw new DataBricksException(errorDetails.ErrorCode, errorDetails.Message); } }
public void CreateRunAsyncDateTrunc_PassObject_ShouldNotThrowException() { var client = new PodfatherClientV1(GetAPIKey()); client.SetLogger(GetLogger()); var testRun = new NewRun() { Date = DateTime.Parse("2021-01-10T12:00:00"), Depot = 39645, Driver = 367665, // Test System Driver, Name = Guid.NewGuid().ToString() }; var runResult = Task.Run(async() => await client.CreateRunAsync(testRun).ConfigureAwait(false)).Result; runResult.Data.Id.Should().BeGreaterThan(0); var testJob = new NewJob() { Customer = 13364055, // WIND ROSE AVIATION COMPANY LTD Depot = 39645, // Test Depot Site = 66090015, // WIND ROSE AVIATION COMPANY LTD Instructions1 = "Integration Test Please Ignore", Template = 1594, // AJW DELIVERY ORDER DueBy = DateTime.Parse("2021-01-10T12:00:00"), Items = new List <NewJobItemsData>(), Fields = new Dictionary <string, string>(), Run = runResult.Data.Id }; testJob.Fields.Add("Despatch Note Number", "TestValue"); var result = Task.Run(async() => await client.CreateJobAsync(testJob).ConfigureAwait(false)).Result; result.Job.Job.Id.Should().BeGreaterThan(0); result.JobFields.JobFieldsData.FirstOrDefault().Name.Should().Be("Despatch Note Number"); result.JobFields.JobFieldsData.FirstOrDefault().Value.Should().Be("TestValue"); Console.WriteLine($"Job Id: {result.Job.Job.Id} Run Id: {runResult.Data.Id}"); var deleteResult = Task.Run(async() => await client.DeleteJobAsync(result.Job.Job.Id).ConfigureAwait(false)).Result; deleteResult.Should().BeTrue(); }
public async Task <CreatedRun> CreateRunAsync(NewRun run) { using (var client = HttpClientFactory.CreateClient(serviceUri, accessKey)) { String json = JsonConvert.SerializeObject(run, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-ddThh:mm:ssZ" }); HttpResponseMessage responseMessage = await client.PostAsync("/v1/runs", new StringContentWithoutCharset(json, Encoding.UTF8, "application/json")).ConfigureAwait(false); if (responseMessage.IsSuccessStatusCode) { var responseJson = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); return(JsonConvert.DeserializeObject <CreatedRun>(responseJson)); } else { LogDebug("CreateRunAsync|Received response code: " + responseMessage.StatusCode); throw new HttpResponseException(responseMessage); } } }
public async Task <Run> Create(Guid playerId, NewRun newRun) { var run = new Run(newRun); return(await repository.CreateRun(playerId, run)); }