Skip to contents

Returns a compact summary plus artifact paths. Does not stream large files.

Usage

collect_nlme_job(
  job_id,
  project_dir = ".",
  refresh_fit_health = TRUE,
  darwin_ofv = NULL,
  ofv_tolerance = NULL
)

Arguments

job_id

Job id.

project_dir

Project root.

refresh_fit_health

When TRUE (the default), recompute fit_health at collection time. Set FALSE to reuse fit_health from a recent get_nlme_job_status() / wait_for_nlme_job() poll when the job already succeeded and artifacts are unlikely to have changed.

darwin_ofv

Optional results.csv$ofv (raw -2LL, NOT fitness) from a pyDarwin (Certara.RDarwin) search candidate that this job is a refit of. When supplied and the fit succeeded, an ofv_parity block is attached reconciling darwin_ofv against this refit's fit_health$neg2ll. Required before treating this job as a qualified structural anchor for any nested LRT (see validate_sequential_lrt()).

ofv_tolerance

Optional absolute tolerance (in -2LL units) for the ofv_parity check. Defaults to max(0.5, 0.001 * abs(darwin_ofv)) to accommodate pyDarwin's chained ##ESTARGS stages, which can shift the final -2LL by a small amount versus a single-stage RsNLME refit.

Value

A list summary with state, run_dir, artifact_dir, artifacts (paths relative to artifact_dir), fit_health, tail of logs, and a next_action directive: save_analysis_plan with blocking = TRUE when no plan is saved and this job was not launched under an approved allow_unplanned exception; get_project_workflow_status (non-blocking) on success once a plan exists or the exception is on record; NULL for a failed/dead job (see $failure instead). For failed/dead jobs requires_user_attention is TRUE and a failure block carries a normalized error_class, suggested_fix, and related_kb entry. When darwin_ofv is supplied, also includes ofv_parity. artifact_integrity reports whether the artifacts still match the manifest recorded for this job; a "violation" takes precedence over every other directive and yields a blocking artifact_integrity_violation next_action.

Details

The summary includes a fit_health block (data file size, engine status, return code, -2LL, and whether stderr mentions a missing dataset) so a state == "succeeded" is not mistaken for a good fit - the common failure mode where a metamodel with a missing ## DATA path "succeeds" on an empty data1.txt.