kaushik-develop commented on a change in pull request #12178:
URL: https://github.com/apache/pulsar/pull/12178#discussion_r719764714
##########
File path:
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java
##########
@@ -403,6 +548,82 @@ private void scheduleCompaction(ScheduledExecutorService
executor, long schedule
}
}
+ @VisibleForTesting
+ List<Assignment> getCurrentPostDrainAssignments() {
+ return currentPostDrainAssignments;
+ }
+
+ @VisibleForTesting
+ void clearCurrentPostDrainAssignments() {
+ currentPostDrainAssignments = null;
+ }
+
+ @VisibleForTesting
+ List<Assignment> invokeDrain(String workerId) {
+
+ long startTime = System.nanoTime();
+
+ Set<String> availableWorkers = getCurrentAvailableWorkers();
+
+ // workerIdToAssignments is a map of the form {workerId :
{FullyQualifiedInstanceId : Assignment}}
+ Map<String, Map<String, Assignment>> workerIdToAssignments =
functionRuntimeManager.getCurrentAssignments();
+
+ // initialize stats collection
+ SchedulerStats schedulerStats = new
SchedulerStats(workerIdToAssignments, availableWorkers);
+
+ boolean drainSuccessful = false;
+ List<Assignment> postDrainAssignments = null;
+
+ try {
+ // The worker was checked to be among the available ones, by the
caller.
+ Preconditions.checkState(availableWorkers.contains(workerId));
Review comment:
Sounds fair; I will remove the precondition check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]