Running Jobs¶
Basic Execution¶
from ngpb4py import NgpbConfig, NgpbRunner
config = NgpbConfig.from_prm("options.prm")
result = NgpbRunner(nproc=8).run(config=config)
Working Directories¶
workdir is treated as a scratch parent directory, not the final run directory.
Each call to run() creates a unique child directory inside it.
When workdir is omitted, ngpb4py now uses /tmp/ngpb4py by default so
short runs avoid the overhead of staging files in the current working tree.
result = NgpbRunner().run(config=config, workdir="scratch", keep_files=True)
print(result.scratch_dir)
print(result.workdir)
This makes concurrent runs safer because they do not overwrite each other's files.
Persistent Container Reuse¶
NgpbRunner now reuses a warm Apptainer instance across multiple run() calls.
Use close() or a context manager to release it explicitly:
with NgpbRunner(nproc=8) as runner:
result1 = runner.run(config=config1)
result2 = runner.run(config=config2)
Verbosity¶
Wrapper logging can be controlled globally on the runner or per run:
runner = NgpbRunner(verbosity=1)
result = runner.run(config=config, verbose=3)
Verbosity levels:
0: warnings and errors only1: high-level progress messages2: debug logging from the wrapper3: debug logging plus streamed backend output
The default runner verbosity is 1, which avoids streamed backend output
unless you opt in.
Container Options¶
You can customize the runtime invocation:
runner = NgpbRunner(
container_image="/data/images/NextGenPB.sif",
container_exec_args=["--containall"],
container_extra_args=["--silent"],
)
Use container_exec_args for flags passed to apptainer exec, and
container_extra_args for flags inserted immediately after the runtime command.