KhaninArtur commented on a change in pull request #16611:
URL: https://github.com/apache/beam/pull/16611#discussion_r796836236



##########
File path: playground/backend/internal/code_processing/code_processing.go
##########
@@ -406,6 +409,32 @@ func cancelCheck(ctx context.Context, pipelineId 
uuid.UUID, cancelChannel chan b
        }
 }
 
+// readGraphFile reads graph from the log file and keeps it to the cache.
+// If context is done it means that the code processing was finished 
(successfully/with error/timeout). Write no graph to the cache.
+// If <-startReadGraphChannel it means that the graph written to the file and 
can be read.
+// In other case each pauseDuration checks that graph file exists or not.
+func readGraphFile(pipelineLifeCycleCtx, backgroundCtx context.Context, 
cacheService cache.Cache, graphFilePath string, pipelineId uuid.UUID) {
+       startReadGraphChannel := make(chan bool, 1)
+       ticker := time.NewTicker(pauseDuration)
+       for {
+               select {
+               // in case of timeout or cancel
+               case <-pipelineLifeCycleCtx.Done():
+                       ticker.Stop()
+                       return
+               // in case of graph file exists and can be read
+               case <-startReadGraphChannel:

Review comment:
       Shouldn't we make this case first, so if the pipeline is finished and we 
have the file with the graph we don't miss it?

##########
File path: playground/backend/internal/preparers/python_preparers.go
##########
@@ -112,3 +133,76 @@ func writeToFile(to *os.File, str string) error {
        }
        return nil
 }
+
+// saveGraph add code to pipeline to save the pipeline's graph to the file 
graph.dot

Review comment:
       ```suggestion
   // saveGraph adds code to pipeline to save the pipeline's graph to the file 
GraphFileName
   ```

##########
File path: playground/backend/internal/code_processing/code_processing.go
##########
@@ -406,6 +409,32 @@ func cancelCheck(ctx context.Context, pipelineId 
uuid.UUID, cancelChannel chan b
        }
 }
 
+// readGraphFile reads graph from the log file and keeps it to the cache.

Review comment:
       ```suggestion
   // readGraphFile reads the graph from the file and keeps it to the cache.
   ```




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