NealSun96 commented on code in PR #2102:
URL: https://github.com/apache/helix/pull/2102#discussion_r882964287


##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));

Review Comment:
   Looks like the below check of `assignableInstances` can be moved here - not 
that it helps with logs, but the logic can be simpliefied. 



##########
helix-core/src/main/java/org/apache/helix/task/WorkflowDispatcher.java:
##########
@@ -150,7 +149,10 @@ && isTimeout(workflowCtx.getStartTime(), 
workflowCfg.getTimeout())) {
     // For workflows that have already reached final states, STOP should not 
take into effect.
     if (!TaskConstants.FINAL_STATES.contains(workflowCtx.getWorkflowState())
         && TargetState.STOP.equals(targetState)) {
-      LOG.info("Workflow {} is marked as stopped. Workflow state is {}", 
workflow,
+      if (workflowCtx.getWorkflowState() == TaskState.STOPPED) {
+        return;
+      }
+      LOG.debug("Workflow {} is marked as stopped. Workflow state is {}", 
workflow,
           workflowCtx.getWorkflowState());
       if (isWorkflowStopped(workflowCtx, workflowCfg)) {
         workflowCtx.setWorkflowState(TaskState.STOPPED);

Review Comment:
   @qqu0127 I suggest moving this condition into the above IF. 



##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
     }
 
     if (tasks == null || !tasks.iterator().hasNext()) {
-      logger.warn("No task to assign!");
       return Collections.emptyMap();
     }
-    if (assignableInstances == null || 
!assignableInstances.iterator().hasNext()) {
-      logger.warn("No instance to assign!");

Review Comment:
   `handleAdditionalTaskAssignment` is called once per pipeline, isn't it? Is 
this log a problem?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to