Constructs a result object from a single simulation task execution.
Arguments
- task_id
Character scalar identifying the task
- status
Character scalar: one of "success", "failed", or "skipped"
- metrics
Named list of computed metrics (NULL if task failed or skipped)
- diagnostics
Named list of diagnostic values (NULL if task failed)
- timing
List containing timing information, must include
total- error
NULL, or a list with
error_classanderror_messageif failed- warnings
Character vector of warning messages
Details
The bayesim_task_result class captures the outcome of a single simulation task, including its computed metrics, any diagnostics, timing information, and errors or warnings.
Validation rules:
statusmust be one of "success", "failed", or "skipped"If
statusis "success",metricsmust not be NULLIf
statusis "failed",errormust not be NULLtiming$totalmust be non-negative
Examples
# Successful task
result <- new_task_result(
task_id = "task_001",
status = "success",
metrics = list(rmse = 0.05, bias = 0.01),
diagnostics = list(n_eff = 500, rhat = 1.01),
timing = list(total = 5.2)
)
# Failed task
result <- new_task_result(
task_id = "task_002",
status = "failed",
error = list(error_class = "convergence_error", error_message = "R-hat > 1.1"),
timing = list(total = 2.0)
)