scwhittle commented on code in PR #32953:
URL: https://github.com/apache/beam/pull/32953#discussion_r2156856551


##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java:
##########
@@ -237,14 +255,26 @@ private MemoryMonitor(
       boolean canDumpHeap,
       double gcThrashingPercentagePerPeriod,
       @Nullable String uploadFilePath,
-      File localDumpFolder) {
+      File localDumpFolder,
+      boolean gzipCompress) {
     this.gcStatsProvider = gcStatsProvider;
     this.sleepTimeMillis = sleepTimeMillis;
     this.shutDownAfterNumGCThrashing = shutDownAfterNumGCThrashing;
-    this.canDumpHeap = canDumpHeap;
     this.gcThrashingPercentagePerPeriod = gcThrashingPercentagePerPeriod;
     this.uploadFilePath = uploadFilePath;
     this.localDumpFolder = localDumpFolder;
+    this.gzipCompress = gzipCompress;
+
+    if (canDumpHeap) {
+      try {
+        Files.createDirectories(localDumpFolder.toPath());

Review Comment:
   moved to the fromOptions. More eagerly seems nice since we can log that it 
won't work which gives user more of a chance to fix things before they want to 
investigate ooms.



##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java:
##########
@@ -573,6 +621,7 @@ private static File getLoggingDir() {
   public File dumpHeap()
       throws MalformedObjectNameException, InstanceNotFoundException, 
ReflectionException,
           MBeanException, IOException {
+    Preconditions.checkState(canDumpHeap);

Review Comment:
   done



##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java:
##########
@@ -194,21 +196,35 @@ public long totalGCTimeMilliseconds() {
 
   private final File localDumpFolder;
 
+  private final boolean gzipCompress;
+
   public static MemoryMonitor fromOptions(PipelineOptions options) {
     SdkHarnessOptions sdkHarnessOptions = options.as(SdkHarnessOptions.class);
-    String uploadFilePath = options.getTempLocation();
+    @Nullable String uploadFilePath = 
sdkHarnessOptions.getRemoteHeapDumpLocation();
+    if (uploadFilePath == null) {
+      uploadFilePath = options.getTempLocation();

Review Comment:
   done, added more tests



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to