Skip to content

Commit

Permalink
Adding health check function (#29)
Browse files Browse the repository at this point in the history
* up logbatch function and creating a new type for parameters

* adding julia 1.6 in the CI pipeline

* adding an IOBuffer test

* adding healthcheck function to ensure port connection
  • Loading branch information
pebeto authored Aug 7, 2023
1 parent 5e6cde0 commit 629bacc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
"""
healthcheck(mlf::MLFlow)
Checks if MLFlow server is up and running. Returns `true` if it is, `false`
otherwise.
"""
function healthcheck(mlf)
uri = "$(mlf.baseuri)/health"
try
response = HTTP.get(uri)
return String(response.body) == "OK"
catch e
return false
end
end

"""
uri(mlf::MLFlow, endpoint="", query=missing)
Expand Down
3 changes: 3 additions & 0 deletions test/test_functional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ end
@testset "utils" begin
using MLFlowClient: uri, headers
using URIs: URI

@test healthcheck(MLFlow()) == true

let baseuri = "http://localhost:5001", apiversion = "2.0", endpoint = "experiments/get"
mlf = MLFlow(baseuri; apiversion)
apiuri = uri(mlf, endpoint)
Expand Down

0 comments on commit 629bacc

Please # to comment.