[ https://issues.apache.org/jira/browse/BEAM-13713?focusedWorklogId=720050&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-720050 ]
ASF GitHub Bot logged work on BEAM-13713: ----------------------------------------- Author: ASF GitHub Bot Created on: 03/Feb/22 11:54 Start Date: 03/Feb/22 11:54 Worklog Time Spent: 10m Work Description: daria-malkova commented on a change in pull request #16683: URL: https://github.com/apache/beam/pull/16683#discussion_r798485116 ########## File path: playground/backend/internal/code_processing/code_processing.go ########## @@ -112,6 +114,7 @@ func runStep(ctx context.Context, cacheService cache.Cache, paths *fs_tool.LifeC var runError bytes.Buffer runOutput := streaming.RunOutputWriter{Ctx: pipelineLifeCycleCtx, CacheService: cacheService, PipelineId: pipelineId} go readLogFile(pipelineLifeCycleCtx, ctx, cacheService, paths.AbsoluteLogFilePath, pipelineId, stopReadLogsChannel, finishReadLogsChannel) + go readGraphFile(pipelineLifeCycleCtx, ctx, cacheService, filepath.Join(paths.AbsoluteBaseFolderPath, preparers.GraphFileName), pipelineId) Review comment: Done ########## File path: playground/backend/internal/preparers/python_preparers.go ########## @@ -18,19 +18,32 @@ package preparers import ( Review comment: This PR is based on Python graph PR ########## 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: + utils.ReadAndSetToCacheGraph(backgroundCtx, cacheService, pipelineId, graphFilePath) + return + // waiting when graph file appears + case <-ticker.C: + if _, err := os.Stat(graphFilePath); err == nil { + startReadGraphChannel <- true + } Review comment: Done in python graph review ########## File path: playground/backend/internal/preparers/java_preparers.go ########## @@ -88,12 +97,35 @@ func (builder *JavaPreparersBuilder) WithFileNameChanger() *JavaPreparersBuilder return builder } +func (builder *JavaPreparersBuilder) WithGraphExtractor() *JavaPreparersBuilder { Review comment: Done -- 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 Issue Time Tracking ------------------- Worklog Id: (was: 720050) Time Spent: 0.5h (was: 20m) > [Playground] Support Graph for Java > ----------------------------------- > > Key: BEAM-13713 > URL: https://issues.apache.org/jira/browse/BEAM-13713 > Project: Beam > Issue Type: Sub-task > Components: beam-playground > Reporter: Ilya Kozyrev > Assignee: Ilya Kozyrev > Priority: P2 > Labels: beam-playground-backend, beam-playground-sprint-7 > Time Spent: 0.5h > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.20.1#820001)