Skip to content

Commit

Permalink
add proper support for batch status on key rotate and expiration jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Aug 9, 2023
1 parent 4804da5 commit 0d53e3c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
24 changes: 24 additions & 0 deletions cmd/batch-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ func (m *batchJobMetricsUI) View() string {
s.WriteString("\n")

switch m.current.JobType {
case string(madmin.BatchJobExpire):
accElapsedTime := m.current.LastUpdate.Sub(m.current.StartTime)

addLine("JobType: ", m.current.JobType)
addLine("ExpiredObjects: ", "")
addLine(" - Failed: ", m.current.Expired.ObjectsFailed)
addLine(" - Success: ", m.current.Expired.Objects)
if accElapsedTime > 0 {
objectsPerSec := float64(int64(time.Second)*m.current.Expired.Objects) / float64(accElapsedTime)
addLine("IOPs: ", fmt.Sprintf("%.2f objs/s", objectsPerSec))
}
addLine("Elapsed: ", accElapsedTime.String())
case string(madmin.BatchJobKeyRotate):
accElapsedTime := m.current.LastUpdate.Sub(m.current.StartTime)

addLine("JobType: ", m.current.JobType)
addLine("KeyRotatedObjects: ", "")
addLine(" - Failed: ", m.current.KeyRotate.ObjectsFailed)
addLine(" - Success: ", m.current.KeyRotate.Objects)
if accElapsedTime > 0 {
objectsPerSec := float64(int64(time.Second)*m.current.KeyRotate.Objects) / float64(accElapsedTime)
addLine("IOPs: ", fmt.Sprintf("%.2f objs/s", objectsPerSec))
}
addLine("Elapsed: ", accElapsedTime.String())
case string(madmin.BatchJobReplicate):
accElapsedTime := m.current.LastUpdate.Sub(m.current.StartTime)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
github.com/gdamore/tcell/v2 v2.6.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/juju/ratelimit v1.0.2
github.com/minio/madmin-go/v3 v3.0.10
github.com/minio/madmin-go/v3 v3.0.11-0.20230808202942-b9bc4ea25ee3
github.com/muesli/reflow v0.3.0
github.com/navidys/tvxwidgets v0.3.0
github.com/olekukonko/tablewriter v0.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ github.com/minio/colorjson v1.0.5 h1:P//d521blE5cKDF5YvsHcpqb9TE8IwCdliSv1naPsgk
github.com/minio/colorjson v1.0.5/go.mod h1:Oq6oB83q+sL08u9wx68+91ELf0nV5G4c6l9pQcH5ElI=
github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY=
github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw=
github.com/minio/madmin-go/v3 v3.0.10 h1:oAxbHAVHNnwmM9FNYSvQF4kK1JjRJKYgyuB+Fm+QbKM=
github.com/minio/madmin-go/v3 v3.0.10/go.mod h1:lPrMoc1aeiIWmmrxBthkDqzMPQwC/Lu9ByuyM2wenJk=
github.com/minio/madmin-go/v3 v3.0.11-0.20230808202942-b9bc4ea25ee3 h1:8D1MgGgdwdDZov/nAeJgsxJjsRWB71BcFvq92KiZotc=
github.com/minio/madmin-go/v3 v3.0.11-0.20230808202942-b9bc4ea25ee3/go.mod h1:lPrMoc1aeiIWmmrxBthkDqzMPQwC/Lu9ByuyM2wenJk=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.61 h1:87c+x8J3jxQ5VUGimV9oHdpjsAvy3fhneEBKuoKEVUI=
Expand Down

0 comments on commit 0d53e3c

Please sign in to comment.