Skip to content

Commit

Permalink
Renaming MLFlowLogger to Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pebeto committed Oct 13, 2023
1 parent a61528c commit fbd8639
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The entire workload is divided into three different repositories:
- [x] MLflow cycle automation (create experiment, create run, log metrics, log parameters,
log artifacts, etc.)

- [x] Provides a wrapper `MLFlowLogger` for MLFlowClient.jl clients and associated
- [x] Provides a wrapper `Logger` for MLFlowClient.jl clients and associated
metadata; instances of this type are valid "loggers", which can be passed to MLJ
functions supporting the `logger` keyword argument.

Expand Down Expand Up @@ -71,7 +71,7 @@ We first define a logger, providing the address of our running MLflow. The exper
name and artifact location are optional.

```julia
logger = MLFlowLogger(
logger = MLJFlow.Logger(
"http://127.0.0.1:5000";
experiment_name="MLJFlow test",
artifact_location="./mlj-test"
Expand Down
3 changes: 0 additions & 3 deletions src/MLJFlow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ include("types.jl")
include("base.jl")
include("service.jl")

# types.jl
export MLFlowLogger

end
8 changes: 4 additions & 4 deletions src/base.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function log_evaluation(logger::MLFlowLogger, performance_evaluation)
function log_evaluation(logger, performance_evaluation)
experiment = getorcreateexperiment(logger.service, logger.experiment_name;
artifact_location=logger.artifact_location)
run = createrun(logger.service, experiment;
Expand All @@ -19,12 +19,12 @@ function log_evaluation(logger::MLFlowLogger, performance_evaluation)
updaterun(logger.service, run, "FINISHED")
end

function save(logger::MLFlowLogger, mach::Machine)
function save(logger, machine:: Machine)
io = IOBuffer()
save(io, mach)
save(io, machine)
seekstart(io)

model = mach.model
model = machine.model

experiment = getorcreateexperiment(logger.service, logger.experiment_name;
artifact_location=logger.artifact_location)
Expand Down
4 changes: 2 additions & 2 deletions src/service.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ function logmachinemeasures(service::MLFlow, run::MLFlowRun, measures,
end

"""
service(logger::MLFlowLogger)
service(logger)
Returns the MLFlow service of a logger.
"""
service(logger::MLFlowLogger) = logger.service
service(logger) = logger.service
10 changes: 5 additions & 5 deletions src/types.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
MLFlowLogger(baseuri; experiment_name="MLJ experiment",
Logger(baseuri; experiment_name="MLJ experiment",
artifact_location=nothing)
A wrapper around a MLFlow service, with an experiment name and an artifact
Expand All @@ -17,24 +17,24 @@ used to store the artifacts of the experiment. If not provided, a default
artifact location will be defined by MLFlow. For more information, see
[MLFlow documentation](https://www.mlflow.org/docs/latest/tracking.html).
This constructor returns a `MLFlowLogger` object, containing the experiment
This constructor returns a `Logger` object, containing the experiment
name and the artifact location specified previously. Also it contains a
`MLFlow` service, which is used to communicate with the MLFlow server. For
more information, see [MLFlowClient.jl](https://juliaai.github.io/MLFlowClient.jl/dev/reference/#MLFlowClient.MLFlow).
"""
struct MLFlowLogger
struct Logger
service::MLFlow
verbosity::Int
experiment_name::String
artifact_location::Union{String,Nothing}
end
function MLFlowLogger(baseuri; experiment_name="MLJ experiment",
function Logger(baseuri; experiment_name="MLJ experiment",
artifact_location=nothing, verbosity=1)
service = MLFlow(baseuri)

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, verbosity, experiment_name, artifact_location)
Logger(service, verbosity, experiment_name, artifact_location)
end
2 changes: 1 addition & 1 deletion test/base.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset verbose = true "base" begin
logger = MLFlowLogger("http://localhost:5000";
logger = MLJFlow.Logger("http://localhost:5000";
experiment_name="MLJFlow tests",
artifact_location="/tmp/mlj-test")

Expand Down
4 changes: 2 additions & 2 deletions test/types.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "types" begin
logger = MLFlowLogger("http://localhost:5000")
logger = MLJFlow.Logger("http://localhost:5000")

@test typeof(logger) == MLFlowLogger
@test typeof(logger) == MLJFlow.Logger
@test typeof(logger.service) == MLFlow
end

0 comments on commit fbd8639

Please sign in to comment.