Skip to content

Commit

Permalink
Adding service accesor method and fixing instance order
Browse files Browse the repository at this point in the history
  • Loading branch information
pebeto committed Aug 17, 2023
1 parent 5370f0e commit ba42e6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ function save(logger::MLFlowLogger, mach::Machine)
logartifact(logger.service, run, fname, io)
updaterun(logger.service, run, "FINISHED")
end

"""
service(logger::MLFlowLogger)
Returns the MLFlow service of a logger.
"""
service(logger::MLFlowLogger) = logger.service
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ function MLFlowLogger(baseuri; experiment_name="MLJ experiment",
if ~healthcheck(service)
error("It seems that the MLFlow server is not running. For more information, see https://mlflow.org/docs/latest/quickstart.html")
end
MLFlowLogger(service, experiment_name, artifact_location, verbosity)
MLFlowLogger(service, 1, experiment_name, artifact_location)
end
6 changes: 5 additions & 1 deletion test/base.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "logging functions" begin
@testset verbose = true "base" begin
logger = MLFlowLogger("http://localhost:5000";
experiment_name="MLJFlow tests",
artifact_location="./mlj-test")
Expand Down Expand Up @@ -35,6 +35,10 @@
@test loaded_mach.model isa ProbabilisticPipeline
end

@testset "accesor methods" begin
@test MLJFlow.service(logger) isa MLFlow
end

experiment = getorcreateexperiment(logger.service, logger.experiment_name)
deleteexperiment(logger.service, experiment)
end
2 changes: 1 addition & 1 deletion test/types.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "logger type" begin
@testset "types" begin
logger = MLFlowLogger("http://localhost:5000")

@test typeof(logger) == MLFlowLogger
Expand Down

0 comments on commit ba42e6f

Please sign in to comment.