Skip to content

Commit 629bacc

Browse files
authored
Adding health check function (#29)
* 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
1 parent 5e6cde0 commit 629bacc

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/utils.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
healthcheck(mlf::MLFlow)
3+
4+
Checks if MLFlow server is up and running. Returns `true` if it is, `false`
5+
otherwise.
6+
"""
7+
function healthcheck(mlf)
8+
uri = "$(mlf.baseuri)/health"
9+
try
10+
response = HTTP.get(uri)
11+
return String(response.body) == "OK"
12+
catch e
13+
return false
14+
end
15+
end
16+
117
"""
218
uri(mlf::MLFlow, endpoint="", query=missing)
319

test/test_functional.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ end
3434
@testset "utils" begin
3535
using MLFlowClient: uri, headers
3636
using URIs: URI
37+
38+
@test healthcheck(MLFlow()) == true
39+
3740
let baseuri = "http://localhost:5001", apiversion = "2.0", endpoint = "experiments/get"
3841
mlf = MLFlow(baseuri; apiversion)
3942
apiuri = uri(mlf, endpoint)

0 commit comments

Comments
 (0)