Tutorials › Pharmacometric Workflows and Reproducible Modeling › Recording the Execution Environment

Run Management and Model Comparison · Tutorial 173 of 399

Recording the Execution Environment

Build a concise, verifiable record of the execution environment so that run results can be interpreted and computational differences investigated.

Intermediate 12 min read

What You'll Learn

  • Distinguish an execution-environment record from model, data, and estimator settings.
  • Identify software, platform, dependency, and runtime details that can affect estimation.
  • Record resolved dependencies and effective settings rather than relying only on intended configuration.
  • Check an environment record for missing, ambiguous, or sensitive information.
  • Explain what an environment record can and cannot establish about reproducibility.

Why the Execution Environment Belongs in a Run Record

An estimation result is produced not only by a model and data, but also by the software and computing environment that execute the estimation. Software versions, numerical libraries, operating-system details, and runtime settings can affect available functionality, numerical calculations, parallel execution, or the way inputs are interpreted. If those details are absent, a later analyst may be unable to explain why a rerun differs or even determine what software produced the reported result.

A useful environment record is specific enough to characterize the conditions under which the run actually executed. It is not a general inventory of everything installed on a workstation, nor is it a claim that recording those details guarantees identical results on every computer. The goal is to preserve relevant evidence: what was invoked, what versions and dependencies were resolved, what platform ran the job, and which environment settings could have influenced execution.

Definition: The execution environment is the set of software, platform characteristics, dependencies, and runtime settings that were active when a particular estimation run executed. An environment record is a run-specific account of those characteristics, with enough detail to identify what was observed and how it was obtained.

The environment record complements a run manifest; it does not replace the manifest's description of the run. In particular, model specification, input data, estimation options, and run identity should remain identifiable through the run's established records. The environment record answers a different question: what computing context executed this run?

What to Record

Organize the record into a few categories. The appropriate level of detail depends on the software and the computational methods used, but every recorded item should have a plausible connection to interpreting or repeating the estimation.

CategoryUseful detailsWhy it may matter
Estimation and scripting softwareProduct or engine name, exact version, build or patch identifier, scripting-language version, and relevant command-line optionsBehavior, defaults, available algorithms, and numerical fixes can differ across releases.
PlatformOperating system and release, kernel where applicable, processor architecture, and relevant hardware acceleratorsPlatform and hardware differences can affect compatibility, execution pathways, and numerical results.
DependenciesResolved package or library names and versions, including important transitive dependencies and numerical librariesApplications often rely on libraries that are not visible in the top-level application version.
Runtime settingsThread counts, parallelization settings, locale, timezone, relevant environment variables, and random-number settings where applicableThese settings can affect execution order, parsing, reproducibility, or reported timestamps.
Capture evidenceCollection time, method or command, and whether the values describe the host, container, or actual job processThis helps establish what the record describes and makes omissions easier to identify.

Record exact versions rather than broad labels such as “current,” “latest,” or “R 4.” When a platform reports a build number, distribution release, or architecture, include it if it is relevant and available. For dependencies, distinguish the directly requested packages from the versions actually resolved at execution. A dependency declaration such as “package A, version 2” may not identify the versions of libraries that package A uses.

Capture the effective settings of the running job, not merely the values someone intended to set. A submitted batch job may inherit settings from a scheduler or container, and those settings can differ from an interactive terminal. If a setting is not available, mark it as unavailable or unknown rather than implying that a default was verified.

Worked Example: Building a Run-Specific Environment Record

Suppose a hypothetical estimation job, run E-042, executed a pharmacometric model on a Linux compute node. The job log and environment inspection report the following: estimation engine version 7.3.2, R version 4.4.1, Linux distribution release 24.04, 64-bit x86-64 architecture, BLAS library version 3.12.0, and four computational threads. The job used locale C and UTC timezone.

A concise record can be assembled directly from those observations:

Run: E-042. Estimation engine: version 7.3.2. R: version 4.4.1. Platform: Linux distribution 24.04, x86-64, 64-bit. Numerical library: BLAS 3.12.0. Runtime: four threads; locale C; timezone UTC. Evidence: job log and process-level environment report collected during execution.

The four threads are a recorded value, not an inferred one: the job report says “4,” so the record reports 4. If the available configuration file had requested four threads but the job report were silent, the correct wording would be “requested: 4; effective: unverified,” not “used: 4.” Likewise, “Linux” alone would omit the reported distribution release and architecture. The record is scoped to this job, rather than claiming that these values describe every run on the same machine.

Why Resolved Dependencies and Effective Settings Matter

A program's named version is only one part of its computational context. Suppose an estimation engine calls a numerical library, which in turn uses a platform-specific implementation. Two installations can report the same engine version while resolving different library versions or different implementations. A list of direct dependencies alone may miss that difference.

The reason can be expressed as a dependency chain. If application A depends on library B, and B depends on library C, then execution of A can depend on C even when the user never requested C directly. Recording only A and B does not fully describe the resolved chain. The same reasoning applies to settings: the value that affects the job is the value inherited or applied at runtime, not necessarily the value in a template.

$$ \text{declared configuration} \longrightarrow \text{resolved dependencies and settings} \longrightarrow \text{effective execution environment} $$

This is a conceptual chain, not a numerical formula. It helps identify where an environment record can become inaccurate: a dependency may resolve differently, or an execution layer may override a setting. A lock file, package snapshot, container description, or software-generated session report can help establish resolved versions. Name the source and capture its relevant output; do not assume that the mere existence of a configuration file proves what was active.

Worked Example: Finding an Unrecorded Transitive Dependency

In a hypothetical Python-based workflow, an analyst records the estimation interface version 1.8.0 and the directly requested packages: numpy 2.0.1 and pandas 2.2.2. The environment's resolved package report also shows scipy 1.14.0 and an OpenBLAS library version 0.3.27. A second run on another node has the same interface and direct package versions, but the report shows OpenBLAS 0.3.26.

The initial record identifies two direct packages, but it omits two resolved components relevant to execution. The completed record adds scipy 1.14.0 and OpenBLAS 0.3.27 for the first run. For the second run, it records OpenBLAS 0.3.26. The comparison is then explicit: the interface and listed direct packages match, while the reported numerical-library versions differ by one patch version.

That difference is evidence of an environment difference, not proof that it caused any change in estimates. To test whether it matters, an analyst would need an appropriately controlled comparison and must consider other differences as well. The environment record makes the candidate explanation visible; it does not establish causation.

A Practical Capture and Review Process

A reliable capture process collects information close to execution, identifies its source, and checks that it describes the job rather than an unrelated login session. The following sequence provides a compact review.

1
Identify the job context.
Link the environment record to the run identifier and establish whether execution occurred on a local host, scheduled node, virtual machine, or container.
2
Collect software and platform details.
Query the actual engine and language versions, build information where available, operating-system release, architecture, and any relevant accelerator or numerical library.
3
Resolve dependencies and settings.
Use software reports, package snapshots, or lock information to capture versions that were installed and used. Record effective thread, locale, timezone, and other relevant runtime settings.
4
Document evidence and uncertainty.
State when and how the information was collected. Label missing or inferred values plainly, and distinguish requested settings from verified effective settings.
5
Review for scope and sensitivity.
Check that the record is specific to the run, includes the components needed to interpret it, and excludes credentials or unrelated personal information.

Collection should be automated when practical, because manual transcription is vulnerable to omissions and typographical errors. Automation is not a substitute for review: a script that inspects the interactive shell may report a different environment from a batch process, and a package report may include many irrelevant packages while omitting a system library. Confirm the collection method against the actual execution pathway.

Worked Example: Separating Requested from Effective Thread Settings

A hypothetical job submission script requests eight threads. The scheduler allocates four CPU cores, and the job's process-level report shows that the numerical library is configured to use four threads. The analyst wants the environment record to state the thread setting used by the estimation process.

The two observations are: requested threads = 8, and effective numerical-library threads = 4. The discrepancy is \(8 - 4 = 4\) threads. The record should therefore report both values, with their meanings: “eight threads requested by submission script; four threads reported for the numerical library in the running job.” It should not collapse them into a single value or state that the estimation used eight threads.

This difference could arise because the scheduler limited the allocation or because a runtime setting overrode the request. The record alone does not decide which mechanism applied. It does, however, expose the mismatch and directs follow-up to the scheduler allocation and process configuration.

Diagnostics, Alternatives, and Limitations

An environment record is suspect when values are vague, contradictory, or disconnected from the job that produced the result. Common warning signs include “latest version” instead of a version number; a package file that lists requested but not resolved dependencies; a host report captured after the run rather than during it; or an environment-variable dump with no indication of which entries matter. A particularly important diagnostic is disagreement between requested settings and the settings reported by the running process.

There are several ways to capture environment information, and each has strengths and limitations:

ApproachStrengthLimitation
Manual checklistReadable and easy to begin usingCan omit transitive dependencies or contain transcription errors
Software-generated session reportCan report versions from the active processMay omit operating-system libraries, scheduler settings, or hardware details
Package lock or dependency snapshotCan specify resolved package versions in detailDoes not by itself prove that the recorded environment was the one used
Container or virtual-machine descriptionCan standardize many software componentsMay not fully specify the host kernel, hardware, external services, or runtime overrides

These approaches can be combined. For example, a software-generated report can describe active package versions, while a job log captures the platform and scheduler-provided settings. A container description may narrow variation but does not imply that all host characteristics are identical. The strongest record is the one whose claims are supported by observations from the execution context and whose boundaries are clear.

Environment capture also has limits. It cannot guarantee bit-for-bit identical output: hardware, compiler behavior, parallel execution order, numerical-library implementations, and other factors may affect results. Nor does a match in recorded versions prove that two runs used identical data, model code, or estimation settings. An environment record supports interpretation and investigation; it is one part of a reproducible workflow, not a substitute for the other run records.

Avoid indiscriminately saving every environment variable or command output. Such dumps can contain access tokens, passwords, usernames, or unrelated machine details. Capture the variables that could affect execution, redact secrets, and record that redaction occurred without preserving the secret value. If a potentially important value cannot safely be recorded, describe the setting and the reason it is withheld.

Common Mistake: Treating a Version Label as the Whole Environment

Wrong reasoning: “Both runs used engine version 7.3, so their environments were the same.” This ignores the possibility of different patch builds, dependencies, operating systems, architectures, numerical libraries, or effective runtime settings.

Correction: Record the exact engine version or build that is available, along with relevant resolved dependencies, platform details, and effective settings. Then compare those fields between runs. Even a complete match in the recorded fields means only that no difference was detected among those fields; it does not prove that every computational condition was identical.

Key takeaway: Record the environment that actually executed the run, not merely the environment that was intended. Include exact software versions, relevant platform and dependency details, effective runtime settings, and the evidence used to collect them; label uncertainty and protect sensitive values.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. A run record says “Python 3, latest packages.” Name two changes that would make the software description more useful.
  2. A workflow's lock file lists a package version, but the job log shows a different version loaded at runtime. Which should the environment record report?
  3. A script requests six threads, but the running process reports two. What should the record say, and what conclusion should not be drawn from that difference alone?
  4. Why might two runs with the same estimation-engine version still have different execution environments?
  5. Does a matching environment record prove that two runs must return identical estimates? Explain.

Solutions. (1) Report an exact Python version and exact resolved package versions, including relevant dependencies; “latest” is not a stable version identifier. (2) Report the version observed in the running job as effective, and note the lock-file version separately as declared or intended; investigate the discrepancy. (3) Record “six requested; two reported effective,” with the source of each observation. Do not conclude from that difference alone that thread allocation caused any change in estimates. (4) They may differ in operating system, architecture, numerical libraries, transitive dependencies, or runtime settings, among other relevant details. (5) No. The record covers only the fields captured, and other computational or run inputs may differ; a matching record supports comparison but does not guarantee identical results.

Clinical Biostats