@Test public void testProfilingJVMOpts() { Configuration conf = new Configuration(); JavaProfilerOptions profilerOptions = getOptions(conf, "", ""); String jvmOpts = profilerOptions.getProfilerOptions("", "", 0); assertTrue(jvmOpts.trim().equals("")); profilerOptions = getOptions(conf, "", "dir=__VERTEX_NAME__"); jvmOpts = profilerOptions.getProfilerOptions("", "Map 1", 0); assertTrue(jvmOpts.equals("dir=Map1")); profilerOptions = getOptions(conf, "", "dir=__TASK_INDEX__"); jvmOpts = profilerOptions.getProfilerOptions("", "Map 1", 0); assertTrue(jvmOpts.equals("dir=0")); profilerOptions = getOptions(conf, "v[1,3,4]", "dir=/tmp/__VERTEX_NAME__/__TASK_INDEX__"); jvmOpts = profilerOptions.getProfilerOptions("", "v", 1); assertTrue(jvmOpts.equals("dir=/tmp/v/1")); jvmOpts = profilerOptions.getProfilerOptions("", "v", 3); assertTrue(jvmOpts.equals("dir=/tmp/v/3")); jvmOpts = profilerOptions.getProfilerOptions("", "v", 4); assertTrue(jvmOpts.equals("dir=/tmp/v/4")); }
public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOpts + " " + result); LOG.info("Profiling option added to vertexName=" + vertexName + ", taskIdx=" + taskIdx + ", jvmOpts=" + result.trim()); return result.trim(); }
JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOpts + " " + result); LOG.info("Profiling option added to vertexName=" + vertexName + ", taskIdx=" + taskIdx + ", jvmOpts=" + result.trim()); return result.trim(); } }
JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOpts + " " + result); LOG.info("Profiling option added to vertexName=" + vertexName + ", taskIdx=" + taskIdx + ", jvmOpts=" + result.trim()); return result.trim(); } JavaProfilerOptions(Configuration conf); }
JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOpts + " " + result); LOG.info("Profiling option added to vertexName=" + vertexName + ", taskIdx=" + taskIdx + ", jvmOpts=" + result.trim()); return result.trim(); } JavaProfilerOptions(Configuration conf); String getProfilerOptions(String jvmOpts, String vertexName,
      int taskIdx); boolean shouldProfileJVM(String vertexName, int taskId); }
JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOpts + " " + result); LOG.info("Profiling option added to vertexName=" + vertexName + ", taskIdx=" + taskIdx + ", jvmOpts=" + result.trim()); return result.trim(); } JavaProfilerOptions(Configuration conf); String getProfilerOptions(String jvmOpts, String vertexName,
      int taskIdx); boolean shouldProfileJVM(String vertexName, int taskId);  }