private async Task <RunResponse> CreateRun(int experimentId, string runName) { var userId = "rian finnegan"; var sourceType = SourceType.LOCAL; var sourceName = "My laptop"; var entryPointName = "cli.Program.cs"; var startTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); //unix timestamp RunTag[] tags = { new RunTag() { Key = "test_runner", Value = "No_Regressions" } }; var createRunRequest = new CreateRunRequest() { ExperimentId = experimentId, UserId = userId, Runname = runName, SourceType = sourceType, SourceName = sourceName, EntryPointName = entryPointName, StartTime = startTime, SourceVersion = "d1f3ba3c", Tags = tags }; return(await mlflowService.CreateRun(createRunRequest)); }
/// <summary> /// Creates a run for an application. /// /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> public async Task <CreateRunResponse> CreateRun(CreateRunRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called createRun"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/runs".Trim('/'))); HttpMethod method = new HttpMethod("Post"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken); } else { responseMessage = await this.restClient.HttpSend(requestMessage); } return(Converter.FromHttpResponseMessage <CreateRunResponse>(responseMessage)); } catch (Exception e) { logger.Error($"CreateRun failed with error: {e.Message}"); throw; } }
static async void LogRun(int experimentId, ExperimentResult <MulticlassClassificationMetrics> experimentResults) { // Define run var runObject = new CreateRunRequest(); runObject.ExperimentId = experimentId; runObject.StartTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds(); runObject.UserId = Environment.UserName; runObject.SourceType = SourceType.LOCAL; // Create new run in MLFlow var runRequest = await _mlFlowService.CreateRun(runObject); // Get information for best run var runDetails = experimentResults.BestRun; // Log trainer name await _mlFlowService.LogParameter(runRequest.Run.Info.RunUuid, nameof(runDetails.TrainerName), runDetails.TrainerName); // Log metrics await _mlFlowService.LogMetric(runRequest.Run.Info.RunUuid, nameof(runDetails.RuntimeInSeconds), (float)runDetails.RuntimeInSeconds); await _mlFlowService.LogMetric(runRequest.Run.Info.RunUuid, nameof(runDetails.ValidationMetrics.LogLoss), (float)runDetails.ValidationMetrics.LogLoss); await _mlFlowService.LogMetric(runRequest.Run.Info.RunUuid, nameof(runDetails.ValidationMetrics.MacroAccuracy), (float)runDetails.ValidationMetrics.MacroAccuracy); await _mlFlowService.LogMetric(runRequest.Run.Info.RunUuid, nameof(runDetails.ValidationMetrics.MicroAccuracy), (float)runDetails.ValidationMetrics.MicroAccuracy); }
public async Task <IActionResult> Index() { var newExperiment = await this.flowService.GetOrCreateExperiment("New_Experiement"); var experimentId = newExperiment.ExperimentId; var userId = "azadeh khojandi"; var runName = "this is a run name"; var sourceType = SourceType.NOTEBOOK; var sourceName = "String descriptor for the run’s source"; var entryPointName = "Name of the project entry point associated with the current run, if any."; var startTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds(); //unix timestamp RunTag[] tags = { new RunTag() { Key = "testkey", Value = "testvalue" } }; var createRunRequest = new CreateRunRequest() { ExperimentId = experimentId, UserId = userId, Runname = runName, SourceType = sourceType, SourceName = sourceName, EntryPointName = entryPointName, StartTime = startTime, Tags = tags }; var runResult = await flowService.CreateRun(createRunRequest); var logResultMetric = await flowService .LogMetric( runResult.Run.Info.RunUuid, "Somekey", 1234); var logResultParam = await flowService .LogParameter( runResult.Run.Info.RunUuid, "Somekey", "some parameter"); ViewData["ExperimentId"] = experimentId; ViewData["RunId"] = runResult.Run.Info.RunUuid; return(View()); }
public static async Task <Run> CreateRunAsync(string workspaceId, string message, bool isDestroy) { var tRequest = CreateRunRequest.Create(workspaceId, message, isDestroy); var json = Serialize(tRequest); var content = new StringContent(json); content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.api+json"); var result = await HttpClient.PostAsync("runs", content); result.EnsureSuccessStatusCode(); json = await result.Content.ReadAsStringAsync(); return(Deserialize <Run>(json)); }
public async Task <RunResponse> _createRun(int experiementId, IMLFlowService flowService) { var experimentId = experiementId; var userId = "azadeh khojandi"; var runName = "this is a run name"; var sourceType = SourceType.NOTEBOOK; var sourceName = "String descriptor for the run’s source"; var entryPointName = "Name of the project entry point associated with the current run, if any."; var startTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); //unix timestamp var path = Directory.GetCurrentDirectory(); var repopath = path.Substring(0, path.IndexOf("src", StringComparison.Ordinal)); var repo = new Repository(repopath); var lastcommit = repo.Commits.Last(); var sourceVersion = lastcommit.Sha; RunTag[] tags = { new RunTag() { Key = "testkey", Value = "testvalue" } }; //todo [az] run name is empty - check mlflow source code //todo [az] unix startTime not showing correct time on the UI var createRunRequest = new CreateRunRequest() { ExperimentId = experimentId, UserId = userId, Runname = runName, SourceType = sourceType, SourceName = sourceName, EntryPointName = entryPointName, StartTime = startTime, SourceVersion = sourceVersion, Tags = tags }; var runResult = await flowService.CreateRun( createRunRequest); return(runResult); }
protected override void ProcessRecord() { base.ProcessRecord(); CreateRunRequest request; try { request = new CreateRunRequest { CreateRunDetails = CreateRunDetails, OpcRetryToken = OpcRetryToken, OpcRequestId = OpcRequestId }; response = client.CreateRun(request).GetAwaiter().GetResult(); WriteOutput(response, response.Run); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public async Task <RunResponse> CreateRun(CreateRunRequest request) { var response = await _httpService.Post <RunResponse, CreateRunRequest>(_getPath(MLFlowAPI.Runs.BasePath, MLFlowAPI.Runs.Create), request); return(response); }