Skip to content

Commit

Permalink
fix(logs): flush Argo workflow log stream (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
pclata authored Oct 12, 2022
1 parent 70c030f commit 1393854
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.2] - 2022-10-12
### Changed
* Flush Argo Workflow log stream

## [0.15.1] - 2022-10-11
### Changed
* Remove Argo Workflow status call from log streaming
Expand Down
5 changes: 3 additions & 2 deletions service/internal/workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ func (a ArgoWorkflow) Logs(ctx context.Context, workflowName string) (*Logs, err
}

// LogStream returns a log stream for a workflow.
func (a ArgoWorkflow) LogStream(ctx context.Context, workflowName string, w http.ResponseWriter) error {
stream, err := a.svc.WorkflowLogs(ctx, &argoWorkflowAPIClient.WorkflowLogRequest{
func (a ArgoWorkflow) LogStream(argoCtx context.Context, workflowName string, w http.ResponseWriter) error {
stream, err := a.svc.WorkflowLogs(argoCtx, &argoWorkflowAPIClient.WorkflowLogRequest{
Name: workflowName,
Namespace: a.namespace,
LogOptions: &v1.PodLogOptions{
Expand All @@ -157,6 +157,7 @@ func (a ArgoWorkflow) LogStream(ctx context.Context, workflowName string, w http
}

fmt.Fprintf(w, "%s: %s\n", event.PodName, event.Content)
w.(http.Flusher).Flush()
}
}

Expand Down

0 comments on commit 1393854

Please sign in to comment.