Skip to main content

prebuild_remotes

Function prebuild_remotes 

Source
pub fn prebuild_remotes(
    project_root: &Path,
    cmd_cwd: &Path,
    cluster: &ClusterConfig,
    cmd_name: &str,
    controller_host: &str,
) -> Result<(), String>
Expand description

Run pre-flight builds for every remote host in cluster. The controller itself is skipped — its build is handled by the normal dispatch path (cargo run in Docker against the local .active).

cmd_name is both the fdl command and the cargo --bin target. controller_host is the local hostname (skipped from the remotes).

Each per-host build runs in a Docker compose service (cuda when the host’s libtorch advertises a CUDA version in .arch, dev otherwise). The build’s env is overridden so:

  • LIBTORCH_HOST_PATH points at the resolved host libtorch dir
  • CARGO_TARGET_DIR points at target/cluster/<host>/<arch>/

Returns Ok(()) on universal success. Returns Err(combined_msg) listing every host that failed (with its stderr tail) on any failure. Builds running when a failure surfaces complete to natural stopping — cargo’s per-crate granularity means cancelling mid-build would leave the per-host target dir in a half-baked state.