Skip to content

Commit

Permalink
Merge pull request #3879 from kerthcet/cleanup/remove-dupliated-code
Browse files Browse the repository at this point in the history
Remove duplicated codes
  • Loading branch information
volcano-sh-bot authored Dec 18, 2024
2 parents 96af1d3 + 63278a0 commit 1484471
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 211 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/job/resume.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ResumeJob(ctx context.Context) error {
return err
}

return createJobCommand(ctx, config,
return util.CreateJobCommand(ctx, config,
resumeJobFlags.Namespace, resumeJobFlags.JobName,
v1alpha1.ResumeJobAction)
}
4 changes: 2 additions & 2 deletions pkg/cli/job/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func RunJob(ctx context.Context) error {
return err
}

req, err := populateResourceListV1(launchJobFlags.Requests)
req, err := util.PopulateResourceListV1(launchJobFlags.Requests)
if err != nil {
return err
}

limit, err := populateResourceListV1(launchJobFlags.Limits)
limit, err := util.PopulateResourceListV1(launchJobFlags.Limits)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/job/suspend.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func SuspendJob(ctx context.Context) error {
return err
}

return createJobCommand(ctx, config,
return util.CreateJobCommand(ctx, config,
suspendJobFlags.Namespace, suspendJobFlags.JobName,
v1alpha1.AbortJobAction)
}
95 changes: 0 additions & 95 deletions pkg/cli/job/util.go

This file was deleted.

110 changes: 0 additions & 110 deletions pkg/cli/job/util_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/cli/job/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func PrintEvents(events []coreV1.Event, writer io.Writer) {
for _, e := range events {
var interval string
if e.Count > 1 {
interval = fmt.Sprintf("%s (x%d over %s)", translateTimestampSince(e.LastTimestamp), e.Count, translateTimestampSince(e.FirstTimestamp))
interval = fmt.Sprintf("%s (x%d over %s)", util.TranslateTimestampSince(e.LastTimestamp), e.Count, util.TranslateTimestampSince(e.FirstTimestamp))
} else {
interval = translateTimestampSince(e.FirstTimestamp)
interval = util.TranslateTimestampSince(e.FirstTimestamp)
}
EventSourceString := []string{e.Source.Component}
if len(e.Source.Host) > 0 {
Expand Down

0 comments on commit 1484471

Please sign in to comment.