diff options
author | Robert Guo <robert.guo@mongodb.com> | 2020-01-24 14:37:15 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-01-31 23:21:38 +0000 |
commit | 109047bc5402ffe2b2ada07e677e9699cd74a76e (patch) | |
tree | 1e03f8ff8e841c0bc27c4c89afbf743221a426dc /src/mongo/shell/servers.js | |
parent | f4f87e2b3f04172974b00eb1fb8666c787c05a12 (diff) | |
download | mongo-109047bc5402ffe2b2ada07e677e9699cd74a76e.tar.gz |
SERVER-45377 add global option to enable and disable shell hang analyzer
Diffstat (limited to 'src/mongo/shell/servers.js')
-rw-r--r-- | src/mongo/shell/servers.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index a28e851c29f..68a34e47038 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -103,6 +103,10 @@ function pathJoin(...parts) { return parts.join(separator); } +// Internal state to determine if the hang analyzer should be enabled or not. +// Accessible via global setter/getter defined below. +let _hangAnalyzerEnabled = true; + /** * Run `./buildscripts/hang_analyzer.py`. * @@ -118,6 +122,12 @@ function runHangAnalyzer(pids) { print("Skipping runHangAnalyzer: no TestData (not running from resmoke)"); return; } + + if (!_hangAnalyzerEnabled) { + print('Skipping runHangAnalyzer: manually disabled'); + return; + } + if (typeof pids === 'undefined') { pids = getPids(); } @@ -130,10 +140,18 @@ function runHangAnalyzer(pids) { pids = pids.map(p => p + 0).join(','); print(`Running hang_analyzer.py for pids [${pids}]`); const scriptPath = pathJoin('.', 'buildscripts', 'hang_analyzer.py'); - runProgram('python', scriptPath, '-c', '-d', pids); + return runProgram('python', scriptPath, '-c', '-d', pids); } MongoRunner.runHangAnalyzer = runHangAnalyzer; + +MongoRunner.runHangAnalyzer.enable = function() { + _hangAnalyzerEnabled = true; +}; + +MongoRunner.runHangAnalyzer.disable = function() { + _hangAnalyzerEnabled = false; +}; })(); /** |