Skip to content

Commit

Permalink
issue #3602 rollback for refactor ResourceMonitoringManager.performAc…
Browse files Browse the repository at this point in the history
…tionOnNetworkConsumingRun to reuse existing method (#3648)

(cherry picked from commit 26ef381)
  • Loading branch information
SilinPavel committed Aug 28, 2024
1 parent ac97106 commit 5d53451
Showing 1 changed file with 12 additions and 6 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()) {
addRunWithMetricToNotifyList(run, cpuUsageRate, pipelinesToNotify);
performNotify(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:
addRunWithMetricToNotifyList(run, cpuUsageRate, pipelinesToNotify);
performNotify(run, cpuUsageRate, pipelinesToNotify);
}

runsToUpdate.add(run);
}

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

private void processHighNetworkConsumingRuns(final List<PipelineRun> runs) {
Expand Down Expand Up @@ -523,11 +523,17 @@ private void performActionOnNetworkConsumingRun(final PipelineRun run,
// TODO
break;
default:
addRunWithMetricToNotifyList(run, bandwidth, pipelinesToNotify);
performHighNetworkConsumingNotify(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

0 comments on commit 5d53451

Please sign in to comment.