Sanil15 commented on a change in pull request #1402:
URL: https://github.com/apache/samza/pull/1402#discussion_r458514823



##########
File path: samza-core/src/main/java/org/apache/samza/util/Util.java
##########
@@ -123,4 +131,85 @@ private static InetAddress doGetLocalHost() throws 
UnknownHostException, SocketE
     }
     return localHost;
   }
+
+  public static String getDeploymentType(Config config) {
+    JobConfig jobConfig = new JobConfig(config);
+    Optional<String> streamJobFactoryClass = 
jobConfig.getStreamJobFactoryClass();
+    if (streamJobFactoryClass.isPresent()) {
+      if (streamJobFactoryClass.get().equals(YARN_JOB_FACTORY_CLASS)) {
+        return DeploymentType.YARN.name();
+      } else {
+        return DeploymentType.STANDALONE.name();
+      }
+    }
+    return "NOT_DEFINED";
+  }
+
+  public static String getApiType(Config config) {
+    ApplicationConfig appConfig = new ApplicationConfig(config);
+    String appClass = appConfig.getAppClass();
+    if (appClass == null || appClass.isEmpty()) {
+      return ApiType.SAMZA_LOW_LEVEL.name();
+    }
+    if (appClass.equals(BEAM_RUNNER_CLASS)) {
+      return ApiType.SAMZA_BEAM.name();
+    }
+    if (appClass.equals(SQL_RUNNER_CLASS)) {
+      return ApiType.SAMZA_SQL.name();
+    }
+    if (appClass.getClass().isInstance(StreamApplication.class)) {
+      return ApiType.SAMZA_HIGH_LEVEL.name();
+    }
+    return ApiType.SAMZA_LOW_LEVEL.name();
+  }
+
+  public static int getContainerCount(Config config) {
+    JobConfig jobConfig = new JobConfig(config);
+    return jobConfig.getContainerCount();
+  }
+

Review comment:
       +1




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