You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2019/01/03 18:33:40 UTC

[GitHub] nabarunnag closed pull request #33: GEODE-6243: New method to get number of members.

nabarunnag closed pull request #33: GEODE-6243: New method to get number of members.
URL: https://github.com/apache/geode-benchmarks/pull/33
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
index a1be80d..c0a7a71 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
@@ -60,8 +60,8 @@ public PrePopulateRegion(long keyRangeToPrepopulate) {
   public void run(TestContext context) throws InterruptedException {
     Cache serverCache = (Cache) context.getAttribute("SERVER_CACHE");
     Region<Long, Portfolio> region = serverCache.getRegion("region");
-    int numLocators = context.getHostsForRole(LOCATOR).size();
-    int numServers = context.getHostsForRole(SERVER).size();
+    int numLocators = context.getHostsIDsForRole(LOCATOR).size();
+    int numServers = context.getHostsIDsForRole(SERVER).size();
     int jvmID = context.getJvmID();
 
     run(region, numLocators, numServers, jvmID);
diff --git a/harness/src/main/java/org/apache/geode/perftest/TestContext.java b/harness/src/main/java/org/apache/geode/perftest/TestContext.java
index f64e616..d73cd51 100644
--- a/harness/src/main/java/org/apache/geode/perftest/TestContext.java
+++ b/harness/src/main/java/org/apache/geode/perftest/TestContext.java
@@ -25,6 +25,8 @@
 public interface TestContext extends Serializable {
   Set<InetAddress> getHostsForRole(String role);
 
+  Set<Integer> getHostsIDsForRole(String role);
+
   File getOutputDir();
 
   /**
diff --git a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestContext.java b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestContext.java
index bd586d8..1dae065 100644
--- a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestContext.java
+++ b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestContext.java
@@ -48,6 +48,11 @@ public int getJvmID() {
     return sharedContext.getHostsForRole(role);
   }
 
+  @Override
+  public Set<Integer> getHostsIDsForRole(String role) {
+    return sharedContext.getHostIDsForRole(role);
+  }
+
   @Override
   public void setAttribute(String attribute, Object value) {
     attributeMap.put(attribute, value);
diff --git a/harness/src/main/java/org/apache/geode/perftest/runner/SharedContext.java b/harness/src/main/java/org/apache/geode/perftest/runner/SharedContext.java
index a36defe..892efd6 100644
--- a/harness/src/main/java/org/apache/geode/perftest/runner/SharedContext.java
+++ b/harness/src/main/java/org/apache/geode/perftest/runner/SharedContext.java
@@ -45,4 +45,11 @@ public SharedContext(List<JVMMapping> jvmMappings) {
         .map(mapping -> mapping.getNode().getAddress())
         .collect(Collectors.toSet());
   }
+
+  public Set<Integer> getHostIDsForRole(String role) {
+    return jvmMappings.stream()
+        .filter(mapping -> mapping.getRole().equals(role))
+        .map(mapping -> mapping.getId())
+        .collect(Collectors.toSet());
+  }
 }


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services