build_metadata_shell: Build metadata from a template

View source: R/build_metadata_shell.R

build_metadata_shellR Documentation

Build metadata from a template

Description

Defaults currently designed for interactive Rstudio sessions.

Usage

build_metadata_shell(
  code_root,
  jobname_filter = "^rst_ide|^vscode",
  submitline_n_char = 1000L,
  regex_to_extract = "singularity-images/rstudio/[[:graph:]]+\\.img",
  regex_to_ignore = "jpy",
  system_user_name = Sys.info()[["user"]],
  cluster_type = "slurm",
  verbose = FALSE
)

Arguments

code_root

[path] Path to top-level code repo folder, require: path contains a '.git' subfolder

jobname_filter

[regex] When you run 'squeue -u <username>', what 'JobName' indicates your interactive Rstudio session? (case-sensitive) - see defaults

submitline_n_char

[int] Length of submitted command string to expect from system 'squeue -j <jobid> -o submitline%xxx' call (set this much longer than you'd think necessary)

regex_to_extract

[regex] What string do you want to extract after running 'squeue -j <jobid> -o submitline%xxx' (default - find Rstudio image for provenance)

regex_to_ignore

[regex] If your 'regex_to_extract' command finds more strings than you want, this removes all strings matching this pattern

system_user_name

[chr] User's identifier, according to the cluster

cluster_type

[chr] Only 'slurm' currently available - methods/calls may differ by system in the future. (case-insensitive)

verbose

[lgl] Do you want a std_err message of arguments to this function?

Value

[list] Full metadata shell, including git info, cluster submission commands

Examples

# Make metadata shell, and message the function's key arguments to console
(or std_err logs)
metadata_shell <- build_metadata_shell(
  code_root = "/mnt/share/code/hiv_tb_selectid/rt-shared-functions/",
  verbose = TRUE
)

# Extract readable git diff to see any uncommitted code changes
# (NULL is good - no uncommitted changes, prints nothing)
cat(metadata_shell$GIT$git_uncommitted)

epi-sam/SamsElves documentation built on June 12, 2025, 7 a.m.