Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jgongd committed Oct 17, 2024
1 parent eea42c6 commit 86794b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions master/pkg/model/task_container_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type TaskContainerDefaultsConfig struct {

StartupHook string `json:"startup_hook"`

LogPolicies *expconf.LogPoliciesConfig `json:"log_policies"`
LogPolicies expconf.LogPoliciesConfig `json:"log_policies"`

PreemptionTimeout int `json:"preemption_timeout,omitempty"`

Expand Down Expand Up @@ -319,13 +319,10 @@ func (c TaskContainerDefaultsConfig) Merge(
res.Pbs.SetSbatchArgs(tmp)
}

if other.LogPolicies != nil {
if res.LogPolicies == nil {
res.LogPolicies = other.LogPolicies
} else {
logPolicies := res.LogPolicies.Merge(*other.LogPolicies)
res.LogPolicies = &logPolicies
}
if res.LogPolicies == nil {
res.LogPolicies = other.LogPolicies
} else {
res.LogPolicies = res.LogPolicies.Merge(other.LogPolicies)
}

if other.PreemptionTimeout > 0 {
Expand Down
6 changes: 3 additions & 3 deletions master/pkg/schemas/expconf/log_pattern_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ const (
type LogPoliciesConfigV0 []LogPolicyV0

// WithDefaults implements the Defaultable psuedointerface.
func (b *LogPoliciesConfigV0) WithDefaults() *LogPoliciesConfigV0 {
func (b LogPoliciesConfigV0) WithDefaults() LogPoliciesConfigV0 {
eccErrorPattern := ECCErrorPattern
eccErrorSignal := ECCErrorSignal
cudaOomPattern := CUDAOOMPattern
cudaOomSignal := CUDAOOMSignal

if b != nil && len(*b) == 0 {
return &LogPoliciesConfigV0{
if b != nil && len(b) == 0 {
return LogPoliciesConfigV0{
LogPolicyV0{RawPattern: eccErrorPattern, RawActions: []LogActionV0{{Signal: &eccErrorSignal}}},
LogPolicyV0{RawPattern: cudaOomPattern, RawActions: []LogActionV0{{Signal: &cudaOomSignal}}},
}
Expand Down

0 comments on commit 86794b5

Please sign in to comment.