Skip to content

Commit 17b162c

Browse files
r-barnesmeta-codesync[bot]
authored andcommitted
fbcode_builder: emit Show runner info step and timeout-minutes per generated job
Summary: Adds two diagnostics to the GitHub Actions workflows generated by `getdeps.py generate-github-actions`: 1. **`Show runner info` step** as the first step in every job, dumping CPU core count, CPU model, and total RAM in OS-appropriate form: `nproc` / `/proc/cpuinfo` / `free -h` on Linux, `sysctl` on macOS, `Get-CimInstance` in pwsh on Windows. Surfaces the runner shape in CI logs so failures with thread-count or memory dependencies are easier to diagnose without manual workflow edits. 2. **`timeout-minutes`** on the build job. Defaults to 60 minutes (vs the 6-hour GitHub default), and can be overridden per-project via `timeout_minutes = N` in the `[github.actions]` section of the project manifest. The `timeout_minutes` field is added to the `[github.actions]` schema in `getdeps/manifest.py`. Rebalancer's downstream OSS branch (richard/fixes) hand-edits both of these into its three generated workflow YAMLs to compensate for the gap. Centralizing them in the generator means rebalancer (and any other downstream that does the same) stops fighting regenerations. None of the 30 `generated` `getdeps_*.yml` files currently checked into fbsource have these additions, so this diff is a strict superset of the existing CI behavior — projects that don't want the diagnostics simply get them at no behavioral cost; projects that already wanted them no longer need to maintain hand-edits. Reviewed By: sahilsd Differential Revision: D101588403 fbshipit-source-id: f67a50755897e6809ea25a6940ca6679e9913c58
1 parent c735e60 commit 17b162c

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

build/fbcode_builder/getdeps.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,9 @@ def write_job_for_platform(self, platform, args): # noqa: C901
10911091
override_build_type = args.build_type or manifest.get(
10921092
"github.actions", "build_type", ctx=manifest_ctx
10931093
)
1094+
timeout_minutes = (
1095+
manifest.get("github.actions", "timeout_minutes", ctx=manifest_ctx) or "60"
1096+
)
10941097
if run_tests:
10951098
manifest_ctx.set("test", "on")
10961099
run_on = self.get_run_on(args)
@@ -1177,11 +1180,38 @@ def write_job_for_platform(self, platform, args): # noqa: C901
11771180

11781181
out.write(" build:\n")
11791182
out.write(" runs-on: %s\n" % runs_on)
1183+
out.write(f" timeout-minutes: {timeout_minutes}\n")
11801184
if use_sccache:
11811185
out.write(" env:\n")
11821186
out.write(' SCCACHE_GHA_ENABLED: "on"\n')
11831187
out.write(" steps:\n")
11841188

1189+
if build_opts.is_linux():
1190+
out.write(" - name: Show runner info\n")
1191+
out.write(" run: |\n")
1192+
out.write(' echo "CPU cores: $(nproc)"\n')
1193+
out.write(" cat /proc/cpuinfo | grep 'model name' | head -1\n")
1194+
out.write(" free -h\n")
1195+
elif build_opts.is_darwin():
1196+
out.write(" - name: Show runner info\n")
1197+
out.write(" run: |\n")
1198+
out.write(' echo "CPU cores: $(sysctl -n hw.ncpu)"\n')
1199+
out.write(" sysctl -n machdep.cpu.brand_string\n")
1200+
out.write(
1201+
" sysctl -n hw.memsize | "
1202+
'awk \'{print "Memory: " $1/1073741824 " GB"}\'\n'
1203+
)
1204+
elif build_opts.is_windows():
1205+
out.write(" - name: Show runner info\n")
1206+
out.write(" run: |\n")
1207+
out.write(' echo "CPU cores: $env:NUMBER_OF_PROCESSORS"\n')
1208+
out.write(" (Get-CimInstance Win32_Processor).Name\n")
1209+
out.write(
1210+
" [math]::Round((Get-CimInstance Win32_ComputerSystem)"
1211+
'.TotalPhysicalMemory / 1GB, 1).ToString() + " GB RAM"\n'
1212+
)
1213+
out.write(" shell: pwsh\n")
1214+
11851215
if build_opts.is_windows():
11861216
# cmake relies on BOOST_ROOT but GH deliberately don't set it in order
11871217
# to avoid versioning issues:

build/fbcode_builder/getdeps/manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"rust_version": OPTIONAL,
112112
"build_type": OPTIONAL,
113113
"sccache": OPTIONAL,
114+
"timeout_minutes": OPTIONAL,
114115
},
115116
},
116117
"crate.pathmap": {"optional_section": True},

0 commit comments

Comments
 (0)