Skip to content

Commit 8df955f

Browse files
committed
Setting ./mlruns as the default artifact_location
1 parent c0d7723 commit 8df955f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/experiments.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ Creates an MLFlow experiment.
66
# Arguments
77
- `mlf`: [`MLFlow`](@ref) configuration.
88
- `name`: experiment name. If not specified, MLFlow sets it.
9-
- `artifact_location`: directory where artifacts of this experiment will be stored. If not specified, MLFlow uses its default configuration.
9+
- `artifact_location`: directory where artifacts of this experiment will be
10+
stored. If not specified, `./mlruns` will be used (it will take the directory
11+
where you are running `mlflow` as the root one).
1012
- `tags`: a Dictionary of key-values which tag the experiment.
1113
1214
# Returns
1315
An object of type [`MLFlowExperiment`](@ref).
1416
1517
"""
16-
function createexperiment(mlf::MLFlow; name=missing, artifact_location=missing, tags=missing)
18+
function createexperiment(mlf::MLFlow; name=missing, artifact_location="./mlruns", tags=missing)
1719
endpoint = "experiments/create"
1820

1921
if ismissing(name)
@@ -103,7 +105,7 @@ Gets an experiment if one alrady exists, or creates a new one.
103105
An instance of type [`MLFlowExperiment`](@ref)
104106
105107
"""
106-
function getorcreateexperiment(mlf::MLFlow, experiment_name::String; artifact_location=missing, tags=missing)
108+
function getorcreateexperiment(mlf::MLFlow, experiment_name::String; artifact_location="./mlruns", tags=missing)
107109
experiment = getexperiment(mlf, experiment_name)
108110

109111
if ismissing(experiment)

test/test_loggers.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,29 @@ end
167167
runname = "run-$(UUIDs.uuid4())"
168168
r = createrun(mlf, e.experiment_id)
169169

170+
tempfilename = "./mlflowclient-tempfile.txt"
171+
172+
open(tempfilename, "w") do file
173+
write(file, "Hello, world!\n")
174+
end
175+
176+
logartifact(mlf, r, tempfilename)
177+
170178
@testset "listartifacts_by_run_id" begin
171179
artifacts = listartifacts(mlf, r.info.run_id)
172-
@test length(artifacts) == 0
180+
@test length(artifacts) == 1
173181
end
174182

175183
@testset "listartifacts_by_run" begin
176184
artifacts = listartifacts(mlf, r)
177-
@test length(artifacts) == 0
185+
@test length(artifacts) == 1
178186
end
179187

180188
@testset "listartifacts_by_run_info" begin
181189
artifacts = listartifacts(mlf, r.info)
182-
@test length(artifacts) == 0
190+
@test length(artifacts) == 1
183191
end
184192

193+
rm(tempfilename)
185194
deleteexperiment(mlf, e)
186195
end

0 commit comments

Comments
 (0)