|
2 | 2 | @ensuremlf
|
3 | 3 |
|
4 | 4 | experiment_id = createexperiment(mlf, UUIDs.uuid4() |> string)
|
5 |
| - run = createrun(mlf, experiment_id) |
6 | 5 |
|
7 | 6 | @testset "with run id as string" begin
|
| 7 | + run = createrun(mlf, experiment_id) |
8 | 8 | logmetric(mlf, run.info.run_id, "missy", 0.9)
|
9 | 9 |
|
10 | 10 | run = refresh(mlf, run)
|
|
13 | 13 | @test last_metric isa Metric
|
14 | 14 | @test last_metric.key == "missy"
|
15 | 15 | @test last_metric.value == 0.9
|
| 16 | + deleterun(mlf, run) |
16 | 17 | end
|
17 | 18 |
|
18 | 19 | @testset "with run" begin
|
| 20 | + run = createrun(mlf, experiment_id) |
19 | 21 | logmetric(mlf, run, "gala", 0.1)
|
20 | 22 |
|
21 | 23 | run = refresh(mlf, run)
|
|
24 | 26 | @test last_metric isa Metric
|
25 | 27 | @test last_metric.key == "gala"
|
26 | 28 | @test last_metric.value == 0.1
|
| 29 | + deleterun(mlf, run) |
| 30 | + end |
| 31 | + |
| 32 | + @testset "with run id as string and metric" begin |
| 33 | + run = createrun(mlf, experiment_id) |
| 34 | + logmetric(mlf, run.info.run_id, Metric("missy", 0.9, 123, 1)) |
| 35 | + |
| 36 | + run = refresh(mlf, run) |
| 37 | + last_metric = run.data.metrics |> last |
| 38 | + |
| 39 | + @test last_metric isa Metric |
| 40 | + @test last_metric.key == "missy" |
| 41 | + @test last_metric.value == 0.9 |
| 42 | + @test last_metric.timestamp == 123 |
| 43 | + @test last_metric.step == 1 |
| 44 | + deleterun(mlf, run) |
| 45 | + end |
| 46 | + |
| 47 | + @testset "with run and metric" begin |
| 48 | + run = createrun(mlf, experiment_id) |
| 49 | + logmetric(mlf, run, Metric("gala", 0.1, 123, 1)) |
| 50 | + |
| 51 | + run = refresh(mlf, run) |
| 52 | + last_metric = run.data.metrics |> last |
| 53 | + |
| 54 | + @test last_metric isa Metric |
| 55 | + @test last_metric.key == "gala" |
| 56 | + @test last_metric.value == 0.1 |
| 57 | + @test last_metric.timestamp == 123 |
| 58 | + @test last_metric.step == 1 |
| 59 | + deleterun(mlf, run) |
27 | 60 | end
|
28 | 61 |
|
29 | 62 | deleteexperiment(mlf, experiment_id)
|
|
201 | 234 |
|
202 | 235 | deleteexperiment(mlf, experiment_id)
|
203 | 236 | end
|
| 237 | + |
| 238 | +@testset verbose = true "log param" begin |
| 239 | + @ensuremlf |
| 240 | + |
| 241 | + experiment_id = createexperiment(mlf, UUIDs.uuid4() |> string) |
| 242 | + |
| 243 | + @testset "with run id as string" begin |
| 244 | + run = createrun(mlf, experiment_id) |
| 245 | + logparam(mlf, run.info.run_id, "missy", "0.9") |
| 246 | + |
| 247 | + run = refresh(mlf, run) |
| 248 | + last_param = run.data.params |> last |
| 249 | + |
| 250 | + @test last_param isa Param |
| 251 | + @test last_param.key == "missy" |
| 252 | + @test last_param.value == "0.9" |
| 253 | + deleterun(mlf, run) |
| 254 | + end |
| 255 | + |
| 256 | + @testset "with run" begin |
| 257 | + run = createrun(mlf, experiment_id) |
| 258 | + logparam(mlf, run, "gala", "0.1") |
| 259 | + |
| 260 | + run = refresh(mlf, run) |
| 261 | + last_param = run.data.params |> last |
| 262 | + |
| 263 | + @test last_param isa Param |
| 264 | + @test last_param.key == "gala" |
| 265 | + @test last_param.value == "0.1" |
| 266 | + deleterun(mlf, run) |
| 267 | + end |
| 268 | + |
| 269 | + @testset "with run id as string and param" begin |
| 270 | + run = createrun(mlf, experiment_id) |
| 271 | + logparam(mlf, run.info.run_id, Param("missy", "0.9")) |
| 272 | + |
| 273 | + run = refresh(mlf, run) |
| 274 | + last_param = run.data.params |> last |
| 275 | + |
| 276 | + @test last_param isa Param |
| 277 | + @test last_param.key == "missy" |
| 278 | + @test last_param.value == "0.9" |
| 279 | + deleterun(mlf, run) |
| 280 | + end |
| 281 | + |
| 282 | + @testset "with run and param" begin |
| 283 | + run = createrun(mlf, experiment_id) |
| 284 | + logparam(mlf, run, Param("gala", "0.1")) |
| 285 | + |
| 286 | + run = refresh(mlf, run) |
| 287 | + last_param = run.data.params |> last |
| 288 | + |
| 289 | + @test last_param isa Param |
| 290 | + @test last_param.key == "gala" |
| 291 | + @test last_param.value == "0.1" |
| 292 | + deleterun(mlf, run) |
| 293 | + end |
| 294 | + |
| 295 | + deleteexperiment(mlf, experiment_id) |
| 296 | +end |
0 commit comments