Symlink Tool - Quick Start

Walkthrough

1 - Setup

modeling_root <- file.path(tempdir(), "slt_demo", "modeling_root")
dir.create(modeling_root, recursive = TRUE, showWarnings = FALSE)

slt <- SLT$new(
   root_list          = list("modeling_root" = modeling_root)
   , central_log_root = modeling_root
)

The tool is now tied to modeling_root. All symlinks, logs, and reports will live there.


2 - Create Versioned Folders

‘Run’ your modeling pipeline three times and populate each run with dummy results.

Version folder names are yours to choose, with one rule: names the tool uses for its own symlinks (shortcuts) are reserved. That means best and latest, and anything starting with keep_ or remove_. Any type you add (see vignette("user_defined_symlink_types", package = "vmTools")) reserves its name the same way.

v1 <- next_version(modeling_root, "2024_02_01")
slt$make_new_version_folder(version_name = v1)
#> [1] "2024_02_01.01"
root_v1 <- slt$return_dynamic_fields()[["VERS_PATHS"]][["modeling_root"]]
invisible(file.create(file.path(root_v1, paste0("model_", 1:5, ".csv"))))

v2 <- next_version(modeling_root, "2024_02_01")
slt$make_new_version_folder(version_name = v2)
#> [1] "2024_02_01.02"
root_v2 <- slt$return_dynamic_fields()[["VERS_PATHS"]][["modeling_root"]]
invisible(file.create(file.path(root_v2, paste0("model_", 1:5, ".csv"))))

v3 <- next_version(modeling_root, "2024_02_01")
slt$make_new_version_folder(version_name = v3)
#> [1] "2024_02_01.03"
root_v3 <- slt$return_dynamic_fields()[["VERS_PATHS"]][["modeling_root"]]
invisible(file.create(file.path(root_v3, paste0("model_", 1:5, ".csv"))))
print_tree(modeling_root)
#> |-- 2024_02_01.01
#> |  |-- logs
#> |  |  `-- log_version_history.csv
#> |  |-- model_1.csv
#> |  |-- model_2.csv
#> |  |-- model_3.csv
#> |  |-- model_4.csv
#> |  `-- model_5.csv
#> |-- 2024_02_01.02
#> |  |-- logs
#> |  |  `-- log_version_history.csv
#> |  |-- model_1.csv
#> |  |-- model_2.csv
#> |  |-- model_3.csv
#> |  |-- model_4.csv
#> |  `-- model_5.csv
#> `-- 2024_02_01.03
#>    |-- logs
#>    |  `-- log_version_history.csv
#>    |-- model_1.csv
#>    |-- model_2.csv
#>    |-- model_3.csv
#>    |-- model_4.csv
#>    `-- model_5.csv

3 - Mark Latest

Tag the most recent run as latest - useful when downstream consumers always want the newest output regardless of validation status.

slt$mark_latest(version_name = v3, user_entry = list(comment = "Most recent run"))
print_tree(modeling_root, level = 1)
#> |-- 2024_02_01.01
#> |-- 2024_02_01.02
#> |-- 2024_02_01.03
#> |-- latest -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.03
#> |-- log_symlinks_central.csv
#> `-- report_key_versions.csv

latest is a singleton: only one folder can hold it at a time, and the tool auto-demotes the previous holder. It is also mutually exclusive with best - marking a folder latest will auto-demote it from best, and vice versa.


4 - Mark Best

After reviewing v1 results, promote it to best.

best is also a singleton - only one folder holds it at a time.

slt$mark_best(version_name = v1, user_entry = list(comment = "First passing run"))
print_tree(modeling_root, level = 1)
#> |-- 2024_02_01.01
#> |-- 2024_02_01.02
#> |-- 2024_02_01.03
#> |-- best -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.01
#> |-- latest -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.03
#> |-- log_symlinks_central.csv
#> `-- report_key_versions.csv

v3 looks even better - promote it. The tool automatically demotes v1. Because v3 currently holds latest, promoting it to best will also auto-demote it from latest.

slt$mark_best(version_name = v3, user_entry = list(comment = "Improved priors, 2024 best"))
print_tree(modeling_root, level = 1)
#> |-- 2024_02_01.01
#> |-- 2024_02_01.02
#> |-- 2024_02_01.03
#> |-- best -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.03
#> |-- log_symlinks_central.csv
#> `-- report_key_versions.csv

5 - Mark Keep

v1 was used in a submitted paper - flag it so it won’t be lost or accidentally cleaned up.

slt$mark_keep(version_name = v1, user_entry = list(comment = "Journal submission 2024"))

Unlike best, many folders can carry a keep_ symlink simultaneously.

print_tree(modeling_root, level = 1)
#> |-- 2024_02_01.01
#> |-- 2024_02_01.02
#> |-- 2024_02_01.03
#> |-- best -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.03
#> |-- keep_2024_02_01.01 -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.01
#> |-- log_symlinks_central.csv
#> `-- report_key_versions.csv

6 - Stage and Delete a Deprecated Run

v2 was an experimental dead-end. Stage it for removal, then delete.

slt$mark_remove(version_name = v2, user_entry = list(comment = "Experimental - poor convergence"))
(to_remove <- slt$roundup_remove())
#>        root_name  version_name                                                    dir_name
#>           <char>        <char>                                                      <char>
#> 1: modeling_root 2024_02_01.02 /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/remove_2024_02_01.02
#>                                       dir_name_resolved
#>                                                  <char>
#> 1: /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.02
for (ver in to_remove$version_name) {
   slt$delete_version_folders(
      version_name         = ver
      , user_entry         = list(comment = "Cleaning up experimental run")
      , require_user_input = FALSE
   )
}
#> Deleting /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.02
#> Deleting /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/remove_2024_02_01.02

7 - Reports

Key-version report

Scans every symlink-marked run and shows its current status. v2 is absent - it was deleted.

  • Reports are built from versioned folder logs for portability, and are the source of truth for all logging and reports.
data.table::fread(file.path(modeling_root, "report_key_versions.csv"))[, ..show_vars]
#>    log_id         timestamp  version_name       action                    comment
#>     <int>            <char>        <char>       <char>                     <char>
#> 1:      3 2026_11_17_223511 2024_02_01.03 promote_best Improved priors, 2024 best
#> 2:      3 2026_11_17_223511 2024_02_01.01 promote_keep    Journal submission 2024

Central log

Full audit trail across all runs.

  • the Central Log is for convenience only - it accumulates appended SLT actions in one place, but is not the source of truth for any logging or reports, since any given modeling folder could be moved/deleted manually by a user.
path_log <- slt$return_dictionaries()[["LOG_CENTRAL"]][["path"]]
data.table::fread(path_log)[, ..show_vars]
#>    log_id         timestamp  version_name               action                         comment
#>     <int>            <char>        <char>               <char>                          <char>
#> 1:      0 2026_11_17_223510   CENTRAL_LOG               create                     log created
#> 2:      1 2026_11_17_223510 2024_02_01.03       promote_latest                 Most recent run
#> 3:      2 2026_11_17_223510 2024_02_01.01         promote_best               First passing run
#> 4:      3 2026_11_17_223511 2024_02_01.03        demote_latest      Improved priors, 2024 best
#> 5:      4 2026_11_17_223511 2024_02_01.01          demote_best      Improved priors, 2024 best
#> 6:      5 2026_11_17_223511 2024_02_01.03         promote_best      Improved priors, 2024 best
#> 7:      6 2026_11_17_223511 2024_02_01.01         promote_keep         Journal submission 2024
#> 8:      7 2026_11_17_223511 2024_02_01.02       promote_remove Experimental - poor convergence
#> 9:      8 2026_11_17_223511 2024_02_01.02 delete_remove_folder    Cleaning up experimental run
print_tree(modeling_root, level = 1)
#> |-- 2024_02_01.01
#> |-- 2024_02_01.03
#> |-- best -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.03
#> |-- keep_2024_02_01.01 -> /tmp/Rtmp3Nhm3U/slt_demo/modeling_root/2024_02_01.01
#> |-- log_symlinks_central.csv
#> `-- report_key_versions.csv

What’s Next?

This walkthrough covers the core workflow. The technical reference, vignette("symlink_tool_vignette_technical", package = "vmTools"), covers:

  • the Symlink Composer class, which collects best symlinks across several projects into a full ‘best set’,
  • several roots per tool instance (e.g., separating model inputs from outputs while keeping them in sync with the same version names) - SUNSET NOTICE: support for several roots using one tool will likely be sunset in a future version,
  • a worked example of a user-defined symlink type,
  • reports and discrepancy detection, and
  • how links work on Windows.

To add your own symlink types, see vignette("user_defined_symlink_types", package = "vmTools").