tvalentyn commented on code in PR #39484:
URL: https://github.com/apache/beam/pull/39484#discussion_r3683043778


##########
sdks/python/container/profiler.go:
##########
@@ -334,3 +354,185 @@ func needsProcessing(binInfo os.FileInfo, path string) 
bool {
        // Don't regenerate when there were no updates to the profile.
        return binInfo.ModTime().After(info.ModTime())
 }
+
+func monitorCoredumpsLoop(ctx context.Context, logger *tools.Logger, pcfg 
*ProfilerConfig) {
+       // We require the core file pattern to be configured as 
"/tmp/core.%e.%p" via pipeline
+       // options experiments (which is automatically set by the Python SDK). 
This ensures
+       // that core dumps are written in /tmp/ with a prefix matching "core.".
+       coreDir := "/tmp"
+       interval := 5 * time.Second
+       if pcfg.PostprocessIntervalSec > 0 {
+               interval = time.Duration(pcfg.PostprocessIntervalSec) * 
time.Second
+       }
+       logger.Printf(ctx, "Monitoring directory %s for core dumps matching 
prefix core. every %v", coreDir, interval)
+
+       ticker := time.NewTicker(interval)
+       defer ticker.Stop()
+
+       for {
+               select {
+               case <-ctx.Done():
+                       return
+               case <-ticker.C:
+                       processNewCoredumps(ctx, logger, pcfg, coreDir)

Review Comment:
   currently profile postprocessing and upload are not coordinate (for this and 
other profilers). Since we write postprocessed content to a semi-persist 
directory, it should survive container restarts, so it should not be critical, 
and the logic is simpler. it is also possible to adjust the uploads to be more 
frequent.



-- 
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: [email protected]

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

Reply via email to