Skip to content

Commit 3d887a0

Browse files
committed
Scope --poll-state to bosh run-errand; simplify heartbeat output
Per reviewer feedback: - Remove --poll-state from bosh task (keep it on bosh run-errand only) - Remove task description from heartbeat output to reduce redundancy with the event log - Keep elapsed time in heartbeat output for operator visibility Heartbeat output is now: Task 42 | 16:15:14 | Task state: processing (1m31s elapsed) Made-with: Cursor
1 parent 6678590 commit 3d887a0

File tree

5 files changed

+1
-17
lines changed

5 files changed

+1
-17
lines changed

cmd/cmd.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ func (c Cmd) Execute() (cmdErr error) {
137137
case *TaskOpts:
138138
eventsTaskReporter := boshuit.NewReporter(deps.UI, true)
139139
plainTaskReporter := boshuit.NewReporter(deps.UI, false)
140-
if opts.PollState != nil {
141-
interval := time.Duration(*opts.PollState) * time.Second
142-
eventsTaskReporter.EnableHeartbeat(interval)
143-
plainTaskReporter.EnableHeartbeat(interval)
144-
}
145140
return NewTaskCmd(eventsTaskReporter, plainTaskReporter, c.director()).Run(*opts)
146141

147142
case *TasksOpts:

cmd/opts/opts.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ type TaskOpts struct {
293293
Result bool `long:"result" description:"Track result log"`
294294

295295
All bool `long:"all" short:"a" description:"Include all task types (ssh, logs, vms, etc)"`
296-
PollState *int `long:"poll-state" description:"Print task state every N seconds while waiting. Use '=' to specify interval" optional:"true" optional-value:"30"`
297296
Deployment string
298297

299298
cmd

cmd/opts/opts_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,13 +1283,6 @@ var _ = Describe("Opts", func() {
12831283
})
12841284
})
12851285

1286-
Describe("PollState", func() {
1287-
It("contains desired values", func() {
1288-
Expect(getStructTagForName("PollState", opts)).To(Equal(
1289-
`long:"poll-state" description:"Print task state every N seconds while waiting. Use '=' to specify interval" optional:"true" optional-value:"30"`,
1290-
))
1291-
})
1292-
})
12931286
})
12941287

12951288
Describe("TaskArgs", func() {

ui/task/reporter.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ func (r *ReporterImpl) TaskHeartbeat(id int, state string, description string, s
141141
elapsed := time.Since(time.Unix(startedAt, 0)).Truncate(time.Second)
142142
msg += fmt.Sprintf(" (%s elapsed)", elapsed)
143143
}
144-
if state != "queued" && description != "" {
145-
msg += fmt.Sprintf(" (%s)", description)
146-
}
147144

148145
r.printBlock(fmt.Sprintf("\nTask %d | %s | ", id, now.UTC().Format(boshuifmt.TimeHoursFmt)))
149146
r.printBlock(msg)

ui/task/reporter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ Task 101 done
364364
combined := fmt.Sprintf("%v", fakeUI.Blocks)
365365
Expect(combined).To(ContainSubstring("Task state: processing"))
366366
Expect(combined).To(ContainSubstring("elapsed"))
367-
Expect(combined).To(ContainSubstring("run errand"))
367+
Expect(combined).NotTo(ContainSubstring("run errand"))
368368
})
369369

370370
It("prints state without elapsed time when processing but startedAt is 0", func() {

0 commit comments

Comments
 (0)