Skip to content

Commit 339edd0

Browse files
authored
[ML] do not fail to start analytics process if memory estimate is lower than predicted memory usage (#1465)
From the management side, we allow users to update configured memory limits after the analytics configuration has started. To help users with their workflow, we should allow analytics processes to attempt to run even if the configured memory limit is lower than our memory estimate. related to: elastic/elasticsearch#61505
1 parent fb20cb5 commit 339edd0

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

lib/api/CDataFrameAnalysisRunner.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ void CDataFrameAnalysisRunner::computeAndSaveExecutionStrategy() {
9999
auto roundMb = [](std::size_t memory) {
100100
return 0.01 * static_cast<double>((100 * memory) / BYTES_IN_MB);
101101
};
102-
103-
// Report rounded up to the nearest MB.
104-
HANDLE_FATAL(<< "Input error: memory limit " << roundMb(memoryLimit)
105-
<< "MB is too low to perform analysis. You need to give the process"
106-
<< " at least " << std::ceil(roundMb(memoryUsage))
107-
<< "MB, but preferably more.");
108-
109-
} else if (m_NumberPartitions > 1) {
102+
// Simply log the limit being configured too low.
103+
// If we exceed the limit during the process, we will fail and the user
104+
// will have to update the limit and attempt to re-run
105+
LOG_DEBUG(<< "Memory limit " << roundMb(memoryLimit) << "MB is configured lower than estimate "
106+
<< std::ceil(roundMb(memoryUsage)) << "MB."
107+
<< "Analytics process may fail due to low memory limit");
108+
}
109+
if (m_NumberPartitions > 1) {
110110
// The maximum number of rows is found by binary search in the interval
111111
// [numberRows / m_NumberPartitions, numberRows / (m_NumberPartitions - 1)).
112112

lib/api/unittest/CDataFrameAnalysisRunnerTest.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,8 @@ BOOST_AUTO_TEST_CASE(testComputeAndSaveExecutionStrategyDiskUsageFlag) {
9595
.diskUsageAllowed(false)
9696
.outlierSpec();
9797

98-
// single error is registered that the memory limit is to low
99-
LOG_DEBUG(<< "errors = " << core::CContainerPrinter::print(errors));
100-
core::CRegex re;
101-
re.init("Input error: memory limit.*");
102-
BOOST_REQUIRE_EQUAL(1, static_cast<int>(errors.size()));
103-
BOOST_TEST_REQUIRE(re.matches(errors[0]));
98+
// no error should be registered
99+
BOOST_REQUIRE_EQUAL(0, static_cast<int>(errors.size()));
104100
}
105101

106102
// Test large memory requirement with disk usage

0 commit comments

Comments
 (0)