Skip to content

Commit

Permalink
Merge pull request #26 from invenia/bc/enabled
Browse files Browse the repository at this point in the history
Add function to get enabled checkpoints
  • Loading branch information
bencottier authored May 27, 2021
2 parents 4ceb398 + 9047404 commit 9283756
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Checkpoints"
uuid = "b4a3413d-e481-5afc-88ff-bdfbd6a50dce"
authors = "Invenia Technical Computing Corporation"
version = "0.3.8"
version = "0.3.9"

[deps]
AWSS3 = "1c724243-ef5b-51ab-93f4-b0a88ac62a95"
Expand Down
8 changes: 8 additions & 0 deletions src/Checkpoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using Memento
using OrderedCollections

export checkpoint, with_checkpoint_tags # creating stuff
export enabled_checkpoints
# indexing stuff
export IndexEntry, index_checkpoint_files
export checkpoint_name, checkpoint_path, prefixes, tags
Expand Down Expand Up @@ -68,6 +69,13 @@ Returns a vector of all available (registered) checkpoints.
"""
available() = collect(keys(CHECKPOINTS))

"""
enabled_checkpoints() -> Vector{String}
Returns a vector of all enabled ([`config`](@ref)ured) checkpoints.
"""
enabled_checkpoints() = filter(k -> CHECKPOINTS[k] !== nothing, available())

"""
checkpoint([prefix], name, data)
checkpoint([prefix], name, data::Pair...)
Expand Down
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ Distributed.addprocs(5)
@testset "Checkpoints" begin
@everywhere include("testpkg.jl")

@testset "enabled" begin
mktempdir() do path
@test enabled_checkpoints() == []
Checkpoints.register(["c1", "c2", "c3"])
@test enabled_checkpoints() == []

Checkpoints.config("c1", path)
@test enabled_checkpoints() == ["c1"]

Checkpoints.config("c2", path)
@test enabled_checkpoints() == ["c1", "c2"]
end
end

x = reshape(collect(1:100), 10, 10)
y = reshape(collect(101:200), 10, 10)
a = collect(1:10)
Expand Down

4 comments on commit 9283756

@bencottier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Register Failed
@bencottier, it looks like you are not a publicly listed member/owner in the parent organization (invenia).
If you are a member/owner, you will need to change your membership to public. See GitHub Help

@bencottier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/37661

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.9 -m "<description of version>" 92837561306a115df38aa388ad3e394372b41960
git push origin v0.3.9

Please sign in to comment.