Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak cooldown thresholds and evaluation logic #1973

Merged
merged 2 commits into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ public class SingularityConfiguration extends Configuration {

private int fastFailureCooldownCount = 3;

private long fastFailureCooldownMs = 60000;
private long fastFailureCooldownMs = 30000;

private long fastCooldownExpiresMinutesWithoutFailure = 5;

private int slowFailureCooldownCount = 5;

private long slowFailureCooldownMs = 600000;

private long slowCooldownExpiresMinutesWithoutFailure = 8;
private long slowCooldownExpiresMinutesWithoutFailure = 5;

private long cooldownMinScheduleSeconds = 120;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ private boolean hasFailureLoop(SingularityDeployStatistics deployStatistics, Opt
.count();
java.util.Optional<Long> mostRecentFailure = failureTimestamps.stream().max(Comparator.comparingLong(Long::valueOf));

return failureCount >= cooldownCount
&& (!mostRecentFailure.isPresent() || mostRecentFailure.get() > System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(expiresAfterMins));
boolean mostRecentFailureOutsideWindow = !mostRecentFailure.isPresent() || mostRecentFailure.get() < System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(expiresAfterMins);

return failureCount >= cooldownCount && !mostRecentFailureOutsideWindow;
}

boolean hasCooldownExpired(SingularityDeployStatistics deployStatistics, Optional<Long> recentFailureTimestamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,10 @@ private Optional<PendingType> handleCompletedTaskWithStatistics(Optional<Singula
}

if (!status.hasReason() || !status.getReason().equals(Reason.REASON_INVALID_OFFERS)) {
if (!state.isSuccess() && taskHistoryUpdateCreateResult == SingularityCreateResult.CREATED && cooldown.shouldEnterCooldown(request, requestState, deployStatistics, timestamp)) {
if (state != ExtendedTaskState.TASK_KILLED
&& !state.isSuccess()
&& taskHistoryUpdateCreateResult == SingularityCreateResult.CREATED
&& cooldown.shouldEnterCooldown(request, requestState, deployStatistics, timestamp)) {
LOG.info("Request {} is entering cooldown due to task {}", request.getId(), taskId);
requestState = RequestState.SYSTEM_COOLDOWN;
requestManager.cooldown(request, System.currentTimeMillis());
Expand Down Expand Up @@ -715,10 +718,6 @@ private void updateDeployStatistics(SingularityDeployStatistics deployStatistics
} else {
bldr.setAverageSchedulingDelayMillis(Optional.of(startedAt - dueTime));
}

final SingularityDeployStatistics newStatistics = bldr.build();

deployManager.saveDeployStatistics(newStatistics);
}

bldr.setNumTasks(bldr.getNumTasks() + 1);
Expand Down