From beed7c77cff52600e9bc205ad224059fc2a7547b Mon Sep 17 00:00:00 2001 From: aryawadhwa Date: Thu, 19 Mar 2026 12:43:41 +0530 Subject: [PATCH 1/2] Fix tracking URI to explicitly append /api to map to REST route --- src/types/mlflow.jl | 5 +++++ test/types/mlflow.jl | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/types/mlflow.jl b/src/types/mlflow.jl index 65f7c96..9d2e7aa 100644 --- a/src/types/mlflow.jl +++ b/src/types/mlflow.jl @@ -44,6 +44,11 @@ struct MLFlow apiroot = ENV["MLFLOW_TRACKING_URI"] end + # Automatically append /api to the tracking URI if missing to match standard MLflow REST paths. + if !endswith(apiroot, "/api") && !endswith(apiroot, "/api/") + apiroot = endswith(apiroot, "/") ? apiroot * "api" : apiroot * "/api" + end + if haskey(ENV, "MLFLOW_TRACKING_USERNAME") @warn "The provided username will be ignored as MLFLOW_TRACKING_USERNAME is set." username = ENV["MLFLOW_TRACKING_USERNAME"] diff --git a/test/types/mlflow.jl b/test/types/mlflow.jl index ff4fcbd..332abf9 100644 --- a/test/types/mlflow.jl +++ b/test/types/mlflow.jl @@ -71,4 +71,24 @@ @test_throws ErrorException MLFlow(; username="test", password="test", headers=Dict("Authorization" => "Basic $encoded_credentials")) end + + @testset "appending /api to tracking uri" begin + delete!(ENV, "MLFLOW_TRACKING_URI") + + instance_no_slash = MLFlow("https://dagshub.com/user/repo.mlflow") + @test instance_no_slash.apiroot == "https://dagshub.com/user/repo.mlflow/api" + + instance_with_slash = MLFlow("https://dagshub.com/user/repo.mlflow/") + @test instance_with_slash.apiroot == "https://dagshub.com/user/repo.mlflow/api" + + instance_already_api = MLFlow("https://dagshub.com/user/repo.mlflow/api") + @test instance_already_api.apiroot == "https://dagshub.com/user/repo.mlflow/api" + + instance_already_api_slash = MLFlow("https://dagshub.com/user/repo.mlflow/api/") + @test instance_already_api_slash.apiroot == "https://dagshub.com/user/repo.mlflow/api/" + + if !isnothing(mlflow_tracking_uri) + ENV["MLFLOW_TRACKING_URI"] = mlflow_tracking_uri + end + end end From 84e9fce7c912ce672fc83b1fe02c7a3301df0cdc Mon Sep 17 00:00:00 2001 From: aryawadhwa Date: Sun, 22 Mar 2026 14:55:00 +0530 Subject: [PATCH 2/2] fix: update tests to expect /api appended to tracking URI --- test/types/mlflow.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/types/mlflow.jl b/test/types/mlflow.jl index 332abf9..6c6bc13 100644 --- a/test/types/mlflow.jl +++ b/test/types/mlflow.jl @@ -6,7 +6,7 @@ instance = MLFlow("test", 2.0, Dict(), nothing, nothing) - @test instance.apiroot == "test" + @test instance.apiroot == "test/api" @test instance.apiversion == 2.0 @test instance.headers == Dict() @test isnothing(instance.username) @@ -20,7 +20,7 @@ instance = MLFlow("test") - @test instance.apiroot == "test" + @test instance.apiroot == "test/api" @test instance.apiversion == 2.0 @test instance.headers == Dict() @test isnothing(instance.username)