Skip to content

Commit

Permalink
Merge pull request #2126 from HubSpot/reconcile_fix
Browse files Browse the repository at this point in the history
Use leader cache first for launching check, also check staging
  • Loading branch information
ssalinas authored Aug 25, 2020
2 parents e04f483 + f2261f6 commit efeddbb
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,26 @@ public int getNumLaunchingTasks() {
public List<SingularityTaskId> getLaunchingTasks() {
return getActiveTaskIds()
.stream()
.filter(t -> exists(getUpdatePath(t, ExtendedTaskState.TASK_STARTING)))
.filter(
t -> {
if (leaderCache.active()) {
List<SingularityTaskHistoryUpdate> historyUpdates = leaderCache.getTaskHistoryUpdates(
t
);
return (
historyUpdates.isEmpty() ||
historyUpdates.get(historyUpdates.size() - 1).getTaskState() ==
ExtendedTaskState.TASK_LAUNCHED
);
} else {
return (
!exists(getUpdatePath(t, ExtendedTaskState.TASK_STARTING)) &&
!exists(getUpdatePath(t, ExtendedTaskState.TASK_STAGING)) &&
!exists(getUpdatePath(t, ExtendedTaskState.TASK_RUNNING))
);
}
}
)
.collect(Collectors.toList());
}

Expand Down

0 comments on commit efeddbb

Please sign in to comment.