jerrypeng commented on a change in pull request #2613: Avoid scheduling
heartbeat function if owner-worker not available
URL: https://github.com/apache/pulsar/pull/2613#discussion_r220090195
##########
File path:
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/scheduler/IScheduler.java
##########
@@ -22,9 +22,22 @@
import org.apache.pulsar.functions.proto.Function.Instance;
import java.util.List;
+import java.util.Set;
public interface IScheduler {
- List<Assignment> schedule(List<Instance> unassignedFunctionInstances,
- List<Assignment> currentAssignments,
List<String> workers);
+ /**
+ * Scheduler schedules assignments to appropriate workers and adds into
#resultAssignments
+ *
+ * @param resultAssignments
Review comment:
So when you iterate through the instances, why can't you just put the heart
beat assignments in a separate list and then merge the assignment lists at the
end after the scheduler calculates actual assignments.
The interface is confusing because you are returning the same list that is
also a parameter to the "schedule" method which is redundant. If you are
passing in resultAssignment and adding new assignment to the list, you don't
even need to return it. However, I would suggest what I mentioned above and
use separate lists and merge them at the end.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services