public async Task LogTestResultAsync(ITestResult result) { var expId = configuration["MLFlow:ExperimentId"] ?? "default"; // var expId = Guid.NewGuid().ToString(); var userId = configuration["MLFlow:UserId"] ?? "defaultuser"; if (result.Id == null) { throw new NullReferenceException("ResultId cannot be null"); } var exp = await mlflowService.CreateExperiment(expId) ?? new CreateResponse { ExperimentId = 1 }; logger.Log($"Using experiment id: {exp.ExperimentId}"); var run = await CreateRun(exp.ExperimentId, result.Id); if (run == null) { throw new Exception("Could not create run in MLFlow. Please make sure MLFlow is running."); } await mlflowService.LogMetric(run.Run.Info.RunUuid, "percentage_passed", (float)result.PercentagePassed); await mlflowService.LogMetric(run.Run.Info.RunUuid, "total_tested", (float)result.TotalTested); foreach (var p in result.Parameters) { await mlflowService.LogParameter(run.Run.Info.RunUuid, p.Key, p.Value); } }
public async Task <CreateResponse> _createExperiment(string id, IMLFlowService flowService) { var result = await flowService.CreateExperiment(id); return(result); }