Skip to content

Commit

Permalink
[ML] Only log long time unassigned message if not empty
Browse files Browse the repository at this point in the history
Followup to elastic#100154

The log message about unassigned jobs is simply spam if
there are no unassigned jobs, so it should only be logged
if there's at least one item in the list.
  • Loading branch information
droberts195 committed Oct 6, 2023
1 parent 6cde0df commit 517ffc4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ private void logLongTimeUnassigned(Instant now, ClusterState state) {
}

List<String> itemsToReport = findLongTimeUnassignedTasks(now, tasks);

logger.warn("ML persistent tasks unassigned for a long time [{}]", String.join("|", itemsToReport));
if (itemsToReport.isEmpty() == false) {
logger.warn("ML persistent tasks unassigned for a long time [{}]", String.join("|", itemsToReport));
}
}

/**
Expand Down

0 comments on commit 517ffc4

Please sign in to comment.