public void GetCurrentTimestampMillisecondsShouldReturnCorrectResult() { var datetime = DateTime.UtcNow; var timestampinmiliseconds = UnixDateTimeHelpers.GetCurrentTimestampMilliseconds(); var convertedDatetime = UnixDateTimeHelpers.DateTimeFromUnixTimestampMilliseconds(timestampinmiliseconds); Assert.AreEqual(datetime.ToString(CultureInfo.InvariantCulture), convertedDatetime.UtcDateTime.ToString(CultureInfo.InvariantCulture)); }
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 = UnixDateTimeHelpers.GetCurrentTimestampMilliseconds(); //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 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); }
public async Task <LogMetric> LogMetric(string run_uuid, string key, float value, long?timeStamp = null) { if (!timeStamp.HasValue) { timeStamp = UnixDateTimeHelpers.GetCurrentTimestampMilliseconds(); } var response = await _httpService.Post <LogMetric, Dictionary <string, string> >( _getPath(MLFlowAPI.Runs.BasePath, MLFlowAPI.Runs.LogMetric), _getParameters( ("run_uuid", run_uuid), ("key", key), ("value", value.ToString()), ("timeStamp", timeStamp.ToString()) )); return(response); }