Skip to content

Commit

Permalink
issue 3602 fix HIGH_CONSUMED_NETWORK_BANDWIDTH.html and refactor Reso…
Browse files Browse the repository at this point in the history
…urceMonitoringManager.performActionOnNetworkConsumingRun to reuse existing method (#3648)

(cherry picked from commit 47988ee)
  • Loading branch information
SilinPavel committed Aug 28, 2024
1 parent d3b9e6f commit ac97106
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private void performActionOnIdleRun(PipelineRun run, IdleRunAction action,
switch (action) {
case PAUSE:
if (run.getInstance().getSpot()) {
performNotify(run, cpuUsageRate, pipelinesToNotify);
addRunWithMetricToNotifyList(run, cpuUsageRate, pipelinesToNotify);
} else {
performPause(run, cpuUsageRate);
}
Expand All @@ -400,16 +400,16 @@ private void performActionOnIdleRun(PipelineRun run, IdleRunAction action,
performStop(run, cpuUsageRate);
break;
default:
performNotify(run, cpuUsageRate, pipelinesToNotify);
addRunWithMetricToNotifyList(run, cpuUsageRate, pipelinesToNotify);
}

runsToUpdate.add(run);
}

private void performNotify(PipelineRun run, double cpuUsageRate,
List<Pair<PipelineRun, Double>> pipelinesToNotify) {
private void addRunWithMetricToNotifyList(PipelineRun run, double metric,
List<Pair<PipelineRun, Double>> pipelinesToNotify) {
run.setLastIdleNotificationTime(DateUtils.nowUTC());
pipelinesToNotify.add(new ImmutablePair<>(run, cpuUsageRate));
pipelinesToNotify.add(new ImmutablePair<>(run, metric));
}

private void processHighNetworkConsumingRuns(final List<PipelineRun> runs) {
Expand Down Expand Up @@ -523,17 +523,11 @@ private void performActionOnNetworkConsumingRun(final PipelineRun run,
// TODO
break;
default:
performHighNetworkConsumingNotify(run, bandwidth, pipelinesToNotify);
addRunWithMetricToNotifyList(run, bandwidth, pipelinesToNotify);
}
runsToUpdate.add(run);
}

private void performHighNetworkConsumingNotify(PipelineRun run, double networkBandwidthLevel,
List<Pair<PipelineRun, Double>> pipelinesToNotify) {
run.setLastNetworkConsumptionNotificationTime(DateUtils.nowUTC());
pipelinesToNotify.add(new ImmutablePair<>(run, networkBandwidthLevel));
}

private void performStop(PipelineRun run, double cpuUsageRate) {
if (run.isNonPause() || run.isClusterRun()) {
log.debug(messageHelper.getMessage(MessageConstants.DEBUG_RUN_IDLE_SKIP_CHECK, run.getPodId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
</style>
</head>

#set( $bandwidth = $templateParameters.get("bandwidth") / 1048576 )
#set( $bandwidthLimit = $templateParameters.get("bandwidthLimit") / 1048576 )

<body>
<p>Dear user,</p>
<p>*** This is a system generated email, do not reply to this email ***</p>
<p>Looks like a job with ID ${CP_DOLLAR}templateParameters["id"], launched from ${CP_DOLLAR}templateParameters.get("owner") account, is high network consuming: network bandwidth ${CP_DOLLAR}numberTool.format("#0.00", ${CP_DOLLAR}templateParameters.get("bandwidth")/1048576) Mb/sec is over the limit ${CP_DOLLAR}numberTool.format("#0.00", ${CP_DOLLAR}templateParameters.get("bandwidthLimit")/1048576) Mb/sec.</p>
<p>Looks like a job with ID ${CP_DOLLAR}templateParameters["id"], launched from ${CP_DOLLAR}templateParameters.get("owner") account, is high network consuming: network bandwidth ${CP_DOLLAR}numberTool.format("#0.00", $bandwidth) Mb/sec is over the limit ${CP_DOLLAR}numberTool.format("#0.00", $bandwidthLimit) Mb/sec.</p>
<br />
<p><b>Job details:</b></p>
<table>
Expand Down

0 comments on commit ac97106

Please sign in to comment.