Skip to content
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 @@ -444,25 +444,6 @@ public static Set<SingularityTaskId> getNewInactiveDeployTasks(
pendingDeploy.getDeployProgress().getFailedDeployTasks()
);

return newInactiveDeployTasks
.stream()
.filter(
t -> {
// All TASK_LOSTs that are not resource limit related should be able to be retried
for (SingularityTaskHistoryUpdate historyUpdate : taskManager.getTaskHistoryUpdates(
t
)) {
String historyUpdateReason = historyUpdate.getStatusReason().orElse("");
if (
historyUpdate.getTaskState() == ExtendedTaskState.TASK_LOST &&
!historyUpdateReason.startsWith("REASON_CONTAINER_LIM")
) {
return false;
}
}
return true;
}
)
.collect(Collectors.toSet());
return newInactiveDeployTasks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.TimeUnit;
import javax.ws.rs.WebApplicationException;
import org.apache.mesos.v1.Protos.TaskState;
import org.apache.mesos.v1.Protos.TaskStatus.Reason;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
Expand Down Expand Up @@ -1622,4 +1623,37 @@ public void testDeployWithImmediateRunSchedulesAfterRunningImmediately() {
Assertions.assertEquals(0, taskManager.getNumActiveTasks());
Assertions.assertEquals(1, taskManager.getNumScheduledTasks());
}

@Test
public void testDeployWithLostTasksFails() {
initRequest();
deploy(
firstDeployId,
Optional.<Boolean>empty(),
Optional.of(1),
Optional.of(false),
false
);
deployChecker.checkDeploys();
scheduler.drainPendingQueue();

Assertions.assertEquals(1, taskManager.getPendingTaskIds().size());

resourceOffers();
Assertions.assertEquals(
1,
taskManager.getActiveTaskIdsForDeploy(requestId, firstDeployId).size()
);

SingularityTaskId firstTaskId = taskManager
.getActiveTaskIdsForDeploy(requestId, firstDeployId)
.get(0);
statusUpdate(taskManager.getTask(firstTaskId).get(), TaskState.TASK_LOST);

deployChecker.checkDeploys();
Assertions.assertEquals(
DeployState.FAILED,
deployManager.getDeployResult(requestId, firstDeployId).get().getDeployState()
);
}
}