Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to batch-expire jobs #4677

Merged
merged 1 commit into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading