Skip to content

Commit

Permalink
Add support to batch-expire jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishnan Parthasarathi authored and Krishnan Parthasarathi committed Nov 14, 2023
1 parent c3ebf16 commit 0b3ae5d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cmd/admin-trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ var traceCallTypes = map[string]func(o *madmin.ServiceTraceOpts) (help string){
o.BatchKeyRotation = true
return "Trace Batch KeyRotation (alias: brot)"
},
"batch-expiration": func(o *madmin.ServiceTraceOpts) string {
o.BatchExpire = true
return "Trace Batch Expiration (alias: bexp)"
},

"decommission": func(o *madmin.ServiceTraceOpts) string {
o.Decommission = true
return "Trace Decommission operations (alias: decom)"
Expand Down
12 changes: 8 additions & 4 deletions cmd/batch-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ func mainBatchGenerate(ctx *cli.Context) error {
adminClient, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")

switch jobType {
case string(madmin.BatchJobReplicate):
case string(madmin.BatchJobKeyRotate):
default:
var found bool
for _, job := range madmin.SupportedJobTypes {
if jobType == string(job) {
found = true
break
}
}
if !found {
fatalIf(errInvalidArgument().Trace(jobType), "Unable to generate a job template for the specified job type")
}

Expand Down
11 changes: 11 additions & 0 deletions cmd/batch-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ func (m *batchJobMetricsUI) View() string {
addLine("Transferred: ", humanize.IBytes(uint64(m.current.Replicate.BytesTransferred)))
addLine("Elapsed: ", accElapsedTime.String())
addLine("CurrObjName: ", m.current.Replicate.Object)
case string(madmin.BatchJobExpire):
addLine("JobType: ", m.current.JobType)
addLine("Objects: ", m.current.Expired.Objects)
addLine("FailedObjects: ", m.current.Expired.ObjectsFailed)
addLine("CurrObjName: ", m.current.Expired.Object)

if !m.current.LastUpdate.IsZero() {
accElapsedTime := m.current.LastUpdate.Sub(m.current.StartTime)
addLine("Elapsed: ", accElapsedTime.String())
}

}

table.AppendBulk(data)
Expand Down

0 comments on commit 0b3ae5d

Please sign in to comment.