remote-jobs.md 9.3 KB

Exact-source remote jobs

The existing tools/remote/prod2u-remote-job.sh and Windows tools/windows/remote-run.ps1 and tools/remote/prod2u-remote.ps1 forward to tools/remote_job.py. Run its --help for argument details. Source synchronization remains Git over SSH to the LAN bare repository; checkout the exact commit in a clean build snapshot first.

Linux host example (options can follow the run ID; the command follows --):

python3 tools/remote_job.py submit motor-sim-ATTEMPT \
  --snapshot-id SNAPSHOT --target mrdimm-chamber --task smoke \
  --toolchain-id ENVIRONMENT-ID --workspace /data/prod2u/build-snapshots/SNAPSHOT \
  -- python3 -m pytest tests/unit/test_remote_job.py
python3 tools/remote_job.py status motor-sim-ATTEMPT
python3 tools/remote_job.py logs motor-sim-ATTEMPT
python3 tools/remote_job.py cancel motor-sim-ATTEMPT

From Windows, add --ssh-runner and the exact remote copy of this script before the action. Arguments are quoted for the remote POSIX shell by Python, including spaces and Chinese characters. Only the configured edk2-uefi-lab host is used. The native Windows Python executable runs the client; compilation remains Linux.

python tools/remote_job.py --ssh-runner /data/prod2u/build-snapshots/SNAPSHOT/tools/remote_job.py status motor-sim-ATTEMPT

The high-level PowerShell entry accepts exactly the same arguments, with global options before the action. The former default branch dropped action names and could run an unrelated raw SSH command. It now uses the same Python dispatcher:

tools/remote/prod2u-remote.ps1 --ssh-runner /data/prod2u/build-snapshots/SNAPSHOT/tools/remote_job.py logs motor-sim-ATTEMPT
tools/remote/prod2u-remote.ps1 sync

sync pushes this local source HEAD to its configured lan remote, with SSH options scoped to that process. snapshot --commit FULL40 --workspace ABSOLUTE creates a detached, self-contained clone from the local LAN bare repository (override with --repository ABSOLUTE). It reuses only an existing clean clone at the exact commit, without resetting or replacing other content. Partial clones are private temporary directories and are never published as snapshots. These actions do not start a product build.

quick RUN_ID and td RUN_ID take the same snapshot-id, target, toolchain-id, workspace and container options as submit, without --task or a trailing command. They submit canonical fw diagnose (180 seconds per test) or fw build into the run's native directory. full RUN_ID requires an explicit suite command after -- and always uses the shared heavy lock. It does not relabel the current regression as complete Full acceptance. Job status, logs, cancel and fetch retain their existing meaning; fetch retrieves failure diagnostics. Use the separate resumable transfer entry for a selected BIT, EXE or delivery archive.

container-up, container-stop, container-down, container-recreate and container-status delegate to tools/dev_container.py. They accept --container and optional --workspace. doctor runs that tool's actual Icarus and Verilator functional smoke in the persistent container; it no longer prints a historical bootstrap receipt. The legacy remote-doctor.ps1 requires -RemoteRunner and forwards to this same action. The established container lifecycle and locks remain authoritative; these aliases do not create another runner.

Submission records snapshot/target/task/toolchain identifiers, full commit/tree, exact command and runner hash. run_id is immutable. Concurrent identical submissions start one systemd unit; later submissions return existing state. Changed arguments or input identity with the same ID are rejected. A new attempt uses a new ID. Empty commands are rejected and cannot produce PASS.

The systemd unit is detached from SSH. The worker waits for host attachment to a dedicated child cgroup of the existing privileged task container before starting the command. This includes descendants that call setsid, such as TD subprocesses. Cancel kills this job cgroup, and the supervisor records CANCELLED. A queued heavy job can be cancelled before it starts. Commands that exit leaving background processes receive FAIL and those processes are terminated. The container itself and other task cgroups are retained.

Heavy tasks td, formal, build, full, and package automatically use the existing heavy lock; --heavy covers other expensive commands. All running jobs hold the shared container lifecycle lock. Tools retain their documented phase timeouts. The generic SSH invoker does not repeat commands after either a remote error or an ambiguous SSH disconnect. Repeating an immutable submission is safe.

The run directory is available as PROD2U_RUN_DIR inside the command. Put native logs, reports and artifacts there. RUN-STATUS and RESULT record phase, exit code, boot/process/cgroup identity, log paths and a streamed SHA256 artifact inventory. PASS means the command exited zero without leaked processes; product acceptance must still inspect the command's native reports and test scope.

Status uses boot ID and live cgroup state. A different boot invalidates old PID identities and marks unfinished work INTERRUPTED. An inactive worker with no remaining job processes is also INTERRUPTED. A transient systemctl query failure is an observation error, not a terminal result. This avoids restarting an unobserved but still live command. No job is automatically restarted after reboot.

Live source53629cd checks exercised three concurrent duplicate submissions, continued execution after the submitting SSH sessions ended, rejection of changed arguments, native exit7, cancellation of a separate process group, and cleanup of leaked background children. Boot-change handling has a unit fixture; an actual host reboot was not performed. Artifact transport now uses the shared resumable tools/remote_transfer.py implementation. Content-bound RTL result reuse is documented in rtl-result-reuse.md; TD evidence is not cached by this runner.

Failed-stage diagnostics

Terminal failures automatically create FAILURE-LOGS.zip. It includes native reports/logs, nested RESULT.json files, small VCD/FST waveforms and a FAILURE-INDEX.json describing the exact job status, command, included bytes and omissions. Native file bytes are limited to 64 MiB; an oversized log may be a clearly labelled tail. Waveforms larger than 4 MiB remain remote with their path/size/SHA256 in the index. Supply a failure window or seed/timestamp report in the run directory when available. Large waveforms and binary build products are not silently included in the download.

Windows queries using --ssh-runner automatically fetch a failed result's archive when submit/status/cancel returns a terminal failure. The fetch action provides the same explicit operation. --fetch-root before the action overrides the local directory; the default is TEMP/prod2u-thermal/analysis/run-RUN_ID. The adjacent TRANSFER-RECEIPT.json proves archive byte integrity. Archives are not automatically extracted. Repeated queries reuse an identical local archive without retransmitting its chunks. Modified local copies are preserved with a transfer conflict.

The remote job status and exit code remain unchanged. The client adds a separate failure_download result. Query exit3 means that reading the job succeeded but its diagnostic transfer failed; it does not replace the native failure with a new job status. Collection errors are similarly recorded as failure_bundle_error. Old results lacking a diagnostic archive remain unchanged and report UNAVAILABLE. The runner and transfer module must both exist in the exact remote source copy.

On source3afb0f6, an intentional real Icarus failure generated a large full VCD and a small failure window. The native log, window, nested result and Unicode report were downloaded; the full waveform remained remote. Repeated status used zero transferred chunks. Local archive corruption was reported separately while native exit7 remained FAIL, and a fresh download recovered the verified archive. This validates diagnostic collection/transport, not production RTL acceptance.

Public alias verification

On source c2553bd, the Linux runner/lifecycle/closure suite passed53 tests. The Windows c376b8c public entry was exercised from a path with Chinese characters and spaces: exact snapshot creation/reuse, invalid commit rejection, duplicate Quick submission, explicit Full command, live logs, cancellation, failure fetch, legacy doctor and unchanged container identity. The Quick alias completed31 MR RTL compile/behavior checks using source80d4a61. These commits have identical product RTL; this is integration evidence for the entrypoints.

The initial Windows live run exposed advanced PowerShell parameter binding consuming the child's options after --. Both thin launchers now forward automatic $args unchanged. The permanent regression runs on Windows with:

python -m pytest tests/unit/test_windows_remote_entrypoints.py -q

It executes the real PowerShell scripts from paths containing Chinese and spaces, checks a literal --, child options, quotes, dollar expressions and backticks, and requires the child's failing exit code to survive. It needs native PowerShell; a skip elsewhere is not its Windows acceptance evidence. The test is included in the analysis source closure. Help and invalid/missing-command cases were also run through both Windows entrypoints. None of these checks closes product Full, MR resource fit or hardware validation.