mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: report warning if memory cgroup is not enabled (#942)
This commit is contained in:
1 parent
744c1ef5a1
commit
f0fa88cfa0
1 file changed
+7
@@ -214,11 +214,13 @@ export function runQueued(
|
||||
export async function versionCheck(reportWarn: (str: string) => void, reportError = reportWarn) {
|
||||
let sandboxVersion: string;
|
||||
let sandboxCgroup: number;
|
||||
let sandboxCgroupControllers: string[] | null;
|
||||
try {
|
||||
const version = await client.version();
|
||||
sandboxVersion = version.buildVersion.split('v')[1];
|
||||
const config = await client.config();
|
||||
sandboxCgroup = config.runnerConfig?.cgroupType || 0;
|
||||
sandboxCgroupControllers = config.runnerConfig?.cgroupControllers || null;
|
||||
} catch (e) {
|
||||
if (e?.code === 'ECONNREFUSED') reportError('Failed to connect to sandbox, please check sandbox_host config and if your sandbox is running.');
|
||||
else reportError('Your sandbox version is tooooooo low! Please upgrade!');
|
||||
@@ -231,6 +233,11 @@ export async function versionCheck(reportWarn: (str: string) => void, reportErro
|
||||
reportWarn('You are using cgroup v2 without kernel 5.19+. This could result in inaccurate memory usage measurements.');
|
||||
}
|
||||
}
|
||||
if (sandboxCgroupControllers) {
|
||||
if (!sandboxCgroupControllers.includes('memory') && gte(sandboxVersion, '1.8.6')) {
|
||||
reportWarn('The memory cgroup controller is not enabled. This could result in inaccurate memory usage measurements.');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user