API

Checkpoints

Checkpoints.CheckpointsModule
Checkpoints

A very minimal module for defining checkpoints or save location in large codebase with the ability to configure how those checkpoints save data externally (similar to how Memento.jl works for logging).

source
Checkpoints.checkpointMethod
checkpoint([prefix], name, data)
checkpoint([prefix], name, data::Pair...)
checkpoint([prefix], name, data::Dict)

Defines a data checkpoint with a specified label and values data. By default checkpoints are no-ops and need to be explicitly configured.

checkpoint(session, data)
checkpoint(handler, name, data::Dict)

Alternatively, you can also checkpoint with to a session which stages the data to be commited later by commit!(session). Explicitly calling checkpoint on a handler is generally not advised, but is an option.

source
Checkpoints.configMethod
config(handler::AbstractHandler, labels::Vector{String})
config(handler::AbstractHandler, prefix::String)
config(labels::Vector{String}, args...; kwargs...)
config(prefix::String, args...; kwargs...)

Configures the specified checkpoints with a AbstractHandler. If the first argument is not an AbstractHandler then all args and kwargs are passed to a JLSOHandler constructor for you.

source
Checkpoints.with_checkpoint_tagsMethod
with_checkpoint_tags(f::Function, context_tags::Pair...)
with_checkpoint_tags(f::Function, context_tags::NamedTuple)

Runs the function f, tagging any checkpoints created by f with the context_tags. This is normally used via the do-block form: For example

with_checkpoint_tags(:foo=>1, :bar=>2) do
    q_out = qux()
    checkpoint("foobar"; :output=q_out)
end

This snippet will result in "foobar" checkpoint having the foo=1 and bar=2 tags, as will any checkpoints created by qux(). The context tags are dynamically scoped and so are retained through function calls.

Nested contexts (nested with_checkpoint_tags calls) are allowed. Duplicate tag names and values are allowed, including the tags provided directly in the checkpoint call. Duplicate tags are repeated, not overwritten.

source