Skip to content

Commit

Permalink
Merge pull request #29 from github/status-eta
Browse files Browse the repository at this point in the history
Adding ETA starting at 2% progress
  • Loading branch information
Shlomi Noach committed May 5, 2016
2 parents ee673e2 + 6528010 commit 619be65
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go/logic/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,18 @@ func (this *Migrator) printStatus() {
eta := "N/A"
if isThrottled, throttleReason := this.migrationContext.IsThrottled(); isThrottled {
eta = fmt.Sprintf("throttled, %s", throttleReason)
} else if progressPct > 100.0 {
eta = "Due"
} else if progressPct >= 2.0 {
elapsedRowCopySeconds := this.migrationContext.ElapsedRowCopyTime().Seconds()
totalExpectedSeconds := elapsedRowCopySeconds * float64(rowsEstimate) / float64(totalRowsCopied)
etaSeconds := totalExpectedSeconds - elapsedRowCopySeconds
etaDuration := time.Duration(etaSeconds) * time.Second
if etaDuration >= 0 {
eta = base.PrettifyDurationOutput(etaDuration)
} else {
eta = "Due"
}
}
status := fmt.Sprintf("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Elapsed: %+v(copy), %+v(total); ETA: %s",
totalRowsCopied, rowsEstimate, progressPct,
Expand Down

0 comments on commit 619be65

Please sign in to comment.