From 3a6c10068ad92c30f6343381ef48dd22b612e4e2 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Fri, 14 May 2021 11:13:28 +0100 Subject: [PATCH 1/4] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8571da6..fb3f1b9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Checkpoints" uuid = "b4a3413d-e481-5afc-88ff-bdfbd6a50dce" authors = "Invenia Technical Computing Corporation" -version = "0.3.6" +version = "0.3.7" [deps] AWSS3 = "1c724243-ef5b-51ab-93f4-b0a88ac62a95" From 5f581cf5d123a7e20f30279469069079489ebcff Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Fri, 14 May 2021 11:13:50 +0100 Subject: [PATCH 2/4] add namedtuple implementation --- src/Checkpoints.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Checkpoints.jl b/src/Checkpoints.jl index d921072..4abfe86 100644 --- a/src/Checkpoints.jl +++ b/src/Checkpoints.jl @@ -53,6 +53,7 @@ Duplicate tags are repeated, not overwritten. function with_checkpoint_tags(f::Function, context_tags::Pair...) with_context(f, CONTEXT_TAGS => (CONTEXT_TAGS[]..., context_tags...)) end +with_checkpoint_tags(f::Function, context_tags::NamedTuple) = with_checkpoint_tags(f, pairs(context_tags)...) """ available() -> Vector{String} From ee26861d0643c72d53e509d306fbc0f880e9de43 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Fri, 14 May 2021 11:16:01 +0100 Subject: [PATCH 3/4] add test for namedtuple tags --- test/runtests.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 0463d1f..4023831 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -62,6 +62,14 @@ Distributed.addprocs(5) @test isfile(joinpath(path, "tag=a", "date=2017-01-01", "TestPkg", "bar.jlso")) end + @testset "NamedTuple tags" begin + tags = (tag1="some", tag2="thing") + with_checkpoint_tags(tags) do + TestPkg.bar(a) + end + @test isfile(joinpath(path, "tag1=some", "tag2=thing", "date=2017-01-01", "TestPkg", "bar.jlso")) + end + @testset "nested tags" begin @testset "different tags" begin with_checkpoint_tags(:first => "first") do From b4f94b5431a5d42e77443e7ca433202e338ded16 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Fri, 14 May 2021 11:17:02 +0100 Subject: [PATCH 4/4] add docstring --- src/Checkpoints.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Checkpoints.jl b/src/Checkpoints.jl index 4abfe86..a26507e 100644 --- a/src/Checkpoints.jl +++ b/src/Checkpoints.jl @@ -32,6 +32,7 @@ include("deprecated.jl") """ with_checkpoint_tags(f::Function, context_tags::Pair...) + with_checkpoint_tags(f::Function, context_tags::NamedTuple) Runs the function `f`, tagging any [`checkpoint`](@ref)s created by `f` with the `context_tags`. This is normally used via the do-block form: