Metric
DearDiary.get_metric — Function
get_metric(id::Integer)::Optional{Metric}Get a Metric by id.
Arguments
id::Integer: The id of the metric to query.
Returns
A Metric object. If the record does not exist, return nothing.
get_metric(client::Client, id::Integer)::Optional{Metric}Fetch a Metric via GET /metric/{id}. Returns nothing when the server replies 404 and raises ClientError for other failures.
DearDiary.get_metrics — Function
get_metrics(iteration_id::Integer)::Array{Metric, 1}Get all Metric for a given iteration, ordered by step ascending so the rows already form a chronological time series.
Arguments
iteration_id::Integer: The id of the iteration to query.
Returns
An array of Metric objects.
get_metrics(iteration_id::Integer, page::Pagination)::PaginatedResponse{Metric}Get a page of Metric records for an iteration, with total count populated.
Arguments
iteration_id::Integer: The id of the iteration to query.page::Pagination: The page bounds (limit + offset).
Returns
A PaginatedResponse of Metric.
get_metrics(client::Client, iteration_id::Integer)::Array{Metric,1}Convenience wrapper returning the first 50 Metric rows for iteration_id. Rows arrive ordered by step ascending so they form a chronological series ready to plot.
get_metrics(client::Client, iteration_id::Integer, page::Pagination)::PaginatedResponse{Metric}Fetch a page of Metric records under iteration_id via GET /metric/iteration/{iteration_id}?limit=…&offset=….
DearDiary.create_metric — Function
create_metric(iteration_id::Integer, key::AbstractString, value::AbstractFloat; step=nothing, recorded_at=nothing)::NamedTuple{id::Optional{<:Int64},status::DataType}Create a Metric.
Arguments
iteration_id::Integer: The id of the iteration to create the metric for.key::AbstractString: The key of the metric.value::AbstractFloat: The value of the metric.step::Optional{Integer}: Position in the time series. Whennothing, the nextmax(step) + 1value for the(iteration_id, key)series is used.recorded_at::Optional{DateTime}: When the value was captured. Whennothing, the server clock (now()) is used.
Returns
- The created metric ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
create_metric(client::Client, iteration_id::Integer, key::AbstractString, value::Real; step=nothing, recorded_at=nothing)::Int64Append a Metric to iteration_id via POST /metric/iteration/{iteration_id}.
Pass step=epoch to position the value in the time series; omit it and the server picks max(step) + 1 for the (iteration_id, key) series. recorded_at defaults to the server clock when omitted. The parent iteration must not be terminated.
DearDiary.log_metrics — Function
log_metrics(iteration_id::Integer, metrics::AbstractDict{<:AbstractString,<:AbstractFloat}; step=nothing, recorded_at=nothing)::NamedTuple{ids::Array{Int64,1},status::DataType}Record many metric values against iteration_id in one shot. Every entry shares the same recorded_at (server clock when nothing). When step is omitted, each key independently gets its own max(step) + 1, so per-key counters do not interfere.
Stops at the first failure and returns the ids that were committed before the failure plus the failing status — callers can then decide whether to retry or surface the error.
Arguments
iteration_id::Integer: The id of the iteration to record against.metrics::AbstractDict: Thekey => valuepairs to record.step::Optional{Integer}: Shared step for every entry, ornothingto let each key get its own next value.recorded_at::Optional{DateTime}: Shared timestamp, ornothingfornow().
Returns
ids::Array{Int64,1}: The ids of the insertedMetricrows in iteration order.status::DataType:Createdwhen every insert succeeded; otherwise theUpsertResultof the first failing insert.
log_metrics(client::Client, iteration_id::Integer, metrics::AbstractDict{<:AbstractString,<:Real}; step=nothing, recorded_at=nothing)::Array{Int64,1}Record many metric values at once via POST /metric/iteration/{iteration_id}/batch. Cuts N HTTP round-trips per epoch to one. When step is omitted, each key independently gets its own max(step) + 1 server-side, so per-key counters do not interfere.
log_metrics(
client, iter.id,
Dict("loss" => 0.31, "acc" => 0.94, "val_loss" => 0.42);
step=epoch,
)Returns the ids of the inserted metrics in the order they were processed.
DearDiary.update_metric — Function
update_metric(id::Integer, key::Optional{AbstractString}, value::Optional{AbstractFloat}; step=nothing, recorded_at=nothing)::Type{<:UpsertResult}Update a Metric record.
Arguments
id::Integer: The id of the metric to update.key::Optional{AbstractString}: The new key for the metric.value::Optional{AbstractFloat}: The new value for the metric.step::Optional{Integer}: The new step in the series.recorded_at::Optional{DateTime}: The new timestamp.
Returns
An UpsertResult. Updated if the record was successfully updated (or no changes were made), Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.
update_metric(client::Client, id::Integer; key=nothing, value=nothing, step=nothing, recorded_at=nothing)::NothingPatch a Metric via PATCH /metric/{id}. Any keyword left as nothing is left untouched server-side. The owning iteration must not be terminated.
DearDiary.delete_metric — Function
delete_metric(id::Integer)::BoolDelete a Metric record.
Arguments
id::Integer: The id of the metric to delete.
Returns
true if the record was successfully deleted, false otherwise.
delete_metric(client::Client, id::Integer)::NothingDelete a Metric via DELETE /metric/{id}. Requires DeletePermission on the iteration's project.