mod target

module target

Declarative transport, executor, runtime, and EasyBuild workload routing.

Variables

const TARGET_CONFIG_SCHEMA_VERSION: u32

Schema version of a target configuration layer.

Functions

fn doctor_target(target: &BuildTarget) -> Result<TargetDoctorReport, TargetError>

Probe every layer of a target and report what answered.

Run this before a campaign: a target that cannot be reached should fail here rather than halfway through a build.

fn resolve_target_layers(layers: &[TargetConfigLayer]) -> Result<Vec<BuildTarget>, TargetError>

Merge layers by target name and return the fully resolved targets.

A later layer overrides an earlier one field by field, so a site layer can change the scheduler account without restating the transport.

Enums

enum TargetError

Why a target could not be configured or reached.

UnsupportedSchema(u32)

The layer declares a schema this build does not read.

Toml(toml::de::Error)

The layer is not valid TOML.

Io(String, std::io::Error)

A target file could not be read.

EmptyName

A target has no name, so no layer could merge onto it.

MissingLayer(String, &'static str)

A target left a layer undefined that has no default.

Spawn(String, std::io::Error)

The command could not be started.

CommandFailed

The command ran and failed.

program: String

Program that failed.

exit_code: Option<i32>

Exit status, when there was one.

stderr: String

What it printed on standard error.

enum TargetExecutor

How work is scheduled on the target.

Direct

Run immediately, in the foreground.

Slurm

Submit through Slurm and wait.

command: String

Submission program.

partition: Option<String>

Partition to submit to.

account: Option<String>

Account to charge.

cpus: Option<u32>

CPUs to request.

memory: Option<String>

Memory to request, in the scheduler’s own units.

time: Option<String>

Wall-clock limit, in the scheduler’s own format.

gres: Option<String>

Generic resources, e.g. GPUs.

enum TargetRuntime

What the build runs inside.

A container limits ABI contamination. It is not by itself a security boundary, so mount only what the build needs.

Host

Directly on the host.

Podman

Inside a Podman container.

image: String

Image to run.

command: String

Container program.

args: Vec<String>

Extra arguments passed to it.

mounts: Vec<String>

Mounts, in the runtime’s own syntax.

workdir: Option<String>

Working directory inside the container.

Docker

Inside a Docker container.

image: String

Image to run.

command: String

Container program.

args: Vec<String>

Extra arguments passed to it.

mounts: Vec<String>

Mounts, in the runtime’s own syntax.

workdir: Option<String>

Working directory inside the container.

Eessi

EESSI apptainer via eessi_container.sh (CVMFS fuse in the image).

Plan on the host; this runtime is the install backend. The host EasyBuild binary need not run inside the Debian 12 image.

command: String

Path to eessi_container.sh.

storage: String

Host directory used as --storage (image cache and tmp).

access: String

ro or rw CVMFS access.

extra_bind_paths: Vec<String>

Extra binds in src:dest:mode form, joined as --extra-bind-paths.

resume: Option<String>

Resume an existing --storage session directory.

enum TargetTransport

How a command gets to the target machine.

Local

Run on this machine.

Ssh

Run over SSH.

host: String

Host to connect to, as ssh understands it.

port: Option<u16>

Port, when it is not the default.

command: String

SSH client program.

sync_command: String

Program used to copy the bundle across.

Structs and Unions

struct BuildTarget

A fully resolved target: every layer decided.

name: String

Target name.

transport: TargetTransport

How commands reach it.

executor: TargetExecutor

How work is scheduled.

runtime: TargetRuntime

What the build runs inside.

easybuild: EasyBuildWorkload

How EasyBuild is invoked.

Implementations

impl BuildTarget

Functions

fn build_command(&self, recipe: &str) -> CommandPlan

The command that builds one recipe, wrapped by every layer.

fn build_command_with_robot_paths(&self, recipe: &str, additional_robot_paths: &[String]) -> CommandPlan

Route an EasyBuild command with additional robot roots after configured roots.

fn stage_bundle(&self, local_bundle: &Path) -> Result<String, TargetError>

Copy the bundle to the target and return its path there.

fn staged_bundle_path(&self, local_bundle: &Path) -> String

Where the bundle will live on the target.

fn verification_command(&self, program: &str, args: &[String]) -> CommandPlan

The command that runs a verification program on the target.

struct CommandPlan

A command as it will be run, after every layer has wrapped it.

Kept as program and arguments rather than a string so it can be executed without a shell, and quoted back to a reader exactly as it ran.

program: String

Program to execute.

args: Vec<String>

Arguments, already ordered.

Implementations

impl CommandPlan

Functions

fn execute(&self) -> Result<std::process::Output, TargetError>

Run the command and capture its output.

Executed without a shell, so nothing in the plan is re-parsed for metacharacters.

struct DoctorCheck

One probe of a target layer and what it returned.

layer: String

Layer probed: transport, executor, runtime, or easybuild.

command: CommandPlan

The command run, so it can be repeated by hand.

success: bool

Whether the probe passed.

exit_code: Option<i32>

Exit status, when the process produced one.

stdout: String

Captured standard output.

stderr: String

Captured standard error.

struct EasyBuildWorkload

How EasyBuild is invoked on the target.

command: String

The eb program.

robot_paths: Vec<String>

Robot search paths, in order.

work_root: String

Where builds are staged.

tmp_root: String

Temporary space. Point this at disk, not a small tmpfs.

environment: BTreeMap<String, String>

Environment variables set for the build.

struct TargetConfigLayer

One TOML layer of build-target configuration.

schema_version: u32

Must equal TARGET_CONFIG_SCHEMA_VERSION.

targets: Vec<TargetPatch>

Target definitions, merged by name across layers.

Implementations

impl TargetConfigLayer

Functions

fn from_path(path: &Path) -> Result<Self, TargetError>

Parse a target layer from a file.

fn from_toml_str(input: &str) -> Result<Self, TargetError>

Parse a target layer from TOML text.

struct TargetDoctorReport

The result of probing every layer of a target.

target: String

Target probed.

checks: Vec<DoctorCheck>

One check per layer, in the order they were run.

Implementations

impl TargetDoctorReport

Functions

fn ok(&self) -> bool

Whether every check passed.

struct TargetPatch

A target definition, or an override of one from an earlier layer.

Each layer is optional so a site can override just the piece it cares about, e.g. only the scheduler account.

name: String

Target name, the key layers merge on.

transport: Option<TargetTransport>

How commands reach the machine.

executor: Option<TargetExecutor>

How work is scheduled once there.

runtime: Option<TargetRuntime>

What the build runs inside.

easybuild: Option<EasyBuildWorkload>

How EasyBuild itself is invoked.