Add support to batch-expire jobs (#4677)

This commit is contained in:
Krishnan Parthasarathi
2023-12-02 03:24:10 -08:00
committed by GitHub
parent f5f7147b9e
commit d920e2b34b
3 changed files with 24 additions and 4 deletions
+5
View File
@@ -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)"
+8 -4
View File
@@ -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")
}
+11
View File
@@ -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)