Skip to content

Commit 5600514

Browse files
committed
Fix for comments
1 parent 109d7b8 commit 5600514

2 files changed

Lines changed: 4 additions & 29 deletions

File tree

SingularityService/src/main/java/com/hubspot/singularity/data/TaskManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,9 @@ private void createTaskAndDeletePendingTaskPrivate(SingularityTask task)
13941394
}
13951395
}
13961396

1397+
AtomicBoolean hasErr = new AtomicBoolean(false);
13971398
try {
13981399
final String path = getTaskPath(task.getTaskId());
1399-
1400-
AtomicBoolean hasErr = new AtomicBoolean(false);
14011400
curator
14021401
.transaction()
14031402
.forOperations(
@@ -1422,12 +1421,13 @@ private void createTaskAndDeletePendingTaskPrivate(SingularityTask task)
14221421
// Not checking isActive here, already called within offer check flow
14231422
leaderCache.putActiveTask(task.getTaskId());
14241423
taskCache.set(path, task);
1424+
} catch (KeeperException.NodeExistsException nee) {
1425+
LOG.error("Task or active path already existed for {}", task.getTaskId());
1426+
} finally {
14251427
if (hasErr.get()) {
14261428
// Rare case, but in case the transaction failed to write task data, try again from the cache data
14271429
tryRepairTask(task.getTaskId());
14281430
}
1429-
} catch (KeeperException.NodeExistsException nee) {
1430-
LOG.error("Task or active path already existed for {}", task.getTaskId());
14311431
}
14321432
}
14331433

SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityDeployChecker.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,31 +1497,6 @@ private SingularityDeployResult enqueueAndProcessLbRequest(
14971497

14981498
Iterable<SingularityTaskId> allIds = Iterables.concat(deployActiveTasks, toShutDown);
14991499
final Map<SingularityTaskId, SingularityTask> tasks = taskManager.getTasks(allIds);
1500-
// Handle a case where occasionally a task's data cannot be found in zk, but the task is running
1501-
if (
1502-
!tasks.keySet().containsAll(deployActiveTasks) ||
1503-
!tasks.keySet().containsAll(toShutDown)
1504-
) {
1505-
LOG.warn("Could not find task data for task to shut down, will check taskCache");
1506-
for (SingularityTaskId taskId : deployActiveTasks) {
1507-
if (!tasks.containsKey(taskId)) {
1508-
Optional<SingularityTask> maybeRepaired = taskManager.tryRepairTask(taskId);
1509-
if (maybeRepaired.isPresent()) {
1510-
LOG.info("Repaired and fetched definition for {}", taskId);
1511-
tasks.put(taskId, maybeRepaired.get());
1512-
}
1513-
}
1514-
}
1515-
for (SingularityTaskId taskId : toShutDown) {
1516-
if (!tasks.containsKey(taskId)) {
1517-
Optional<SingularityTask> maybeRepaired = taskManager.tryRepairTask(taskId);
1518-
if (maybeRepaired.isPresent()) {
1519-
LOG.info("Repaired and fetched definition for {}", taskId);
1520-
tasks.put(taskId, maybeRepaired.get());
1521-
}
1522-
}
1523-
}
1524-
}
15251500
final LoadBalancerRequestId lbRequestId = SingularityDeployCheckHelper.getNewLoadBalancerRequestId(
15261501
pendingDeploy
15271502
);

0 commit comments

Comments
 (0)