mynameborat commented on a change in pull request #1478:
URL: https://github.com/apache/samza/pull/1478#discussion_r606449171



##########
File path: samza-core/src/main/java/org/apache/samza/job/model/JobModelUtil.java
##########
@@ -119,6 +120,47 @@ public static JobModel readJobModel(String 
jobModelVersion, MetadataStore metada
     }
   }
 
+  /**
+   * Compares the {@link ContainerModel} for a given <i>processorId</i> across 
two {@link JobModel}.
+   * @param processorId processor id for which work assignments are compared
+   * @param first first job model
+   * @param second second job model
+   * @return true - if {@link ContainerModel} for the processor is same across 
the {@link JobModel}
+   *         false - otherwise
+   */
+  public static boolean compareContainerModelForProcessor(String processorId, 
JobModel first, JobModel second) {
+    Preconditions.checkArgument(StringUtils.isNotBlank(processorId), 
"Processor id cannot be blank");
+    if (first == second) {
+      return true;
+    }
+
+    if (first == null || second == null) {
+      return false;
+    }
+
+    return compareContainerModel(first.getContainers().get(processorId), 
second.getContainers().get(processorId));

Review comment:
       JobModel guarantees `getContainers()` always returns non-null map 
instance.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to