Skip to content

Commit

Permalink
Add --actions flag to watch command
Browse files Browse the repository at this point in the history
It's often useful to see the pipeline actions when watching a pipeline that was
enqueued by a higher level workflow engine.
  • Loading branch information
Aaron Kemp committed Nov 16, 2018
1 parent a32c298 commit 2c27639
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pipelines/internal/commands/watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
var (
flags = flag.NewFlagSet("", flag.ExitOnError)

actions = flags.Bool("actions", false, "show action details")
details = flags.Bool("details", false, "show event details")
)

Expand Down Expand Up @@ -68,6 +69,15 @@ func watch(ctx context.Context, service *genomics.Service, name string) (interfa
return nil, fmt.Errorf("parsing metadata: %v", err)
}

if *actions {
*actions = false
encoded, err := json.MarshalIndent(metadata.Pipeline.Actions, "", " ")
if err != nil {
return nil, fmt.Errorf("encoding actions: %v", err)
}
fmt.Printf("%s\n", encoded)
}

if len(events) != len(metadata.Events) {
for i := len(metadata.Events) - len(events) - 1; i >= 0; i-- {
timestamp, _ := time.Parse(time.RFC3339Nano, metadata.Events[i].Timestamp)
Expand Down

0 comments on commit 2c27639

Please sign in to comment.