Skip to content

Commit

Permalink
Make task limits default == platform defaults (flyteorg#231)
Browse files Browse the repository at this point in the history
Signed-off-by: Haytham Abuelfutuh <[email protected]>
  • Loading branch information
EngHabu authored Aug 14, 2021
1 parent 263d52c commit e6e6576
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/manager/impl/execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ func (m *ExecutionManager) setCompiledTaskDefaults(ctx context.Context, task *co
if resource != nil && resource.Attributes != nil && resource.Attributes.GetTaskResourceAttributes() != nil {
taskResourceSpec = resource.Attributes.GetTaskResourceAttributes().Limits
}

task.Template.GetContainer().Resources.Limits = assignResourcesIfUnset(
ctx, task.Template.Id, createTaskDefaultLimits(ctx, task, m.config.TaskResourceConfiguration().GetLimits()), task.Template.GetContainer().Resources.Limits,
ctx, task.Template.Id, createTaskDefaultLimits(ctx, task, m.config.TaskResourceConfiguration().GetDefaults()), task.Template.GetContainer().Resources.Limits,
taskResourceSpec)
checkTaskRequestsLessThanLimits(ctx, task.Template.Id, task.Template.GetContainer().Resources)
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/manager/impl/execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func TestCreateExecution(t *testing.T) {
for _, task := range tasks {
assert.EqualValues(t, resources.Requests,
task.Template.GetContainer().Resources.Requests)
assert.EqualValues(t, resources.Limits,
assert.EqualValues(t, resources.Requests,
task.Template.GetContainer().Resources.Limits)
}
return &workflowengineInterfaces.ExecutionInfo{
Expand Down Expand Up @@ -2933,15 +2933,15 @@ func TestSetDefaults(t *testing.T) {
Limits: []*core.Resources_ResourceEntry{
{
Name: core.Resources_CPU,
Value: "300m",
Value: "200m",
},
{
Name: core.Resources_MEMORY,
Value: "500Gi",
Value: "200Gi",
},
{
Name: core.Resources_EPHEMERAL_STORAGE,
Value: "501Mi",
Value: "500Mi",
},
},
},
Expand Down Expand Up @@ -3004,7 +3004,7 @@ func TestSetDefaults_MissingDefaults(t *testing.T) {
Limits: []*core.Resources_ResourceEntry{
{
Name: core.Resources_CPU,
Value: "300m",
Value: "200m",
},
{
Name: core.Resources_MEMORY,
Expand Down

0 comments on commit e6e6576

Please sign in to comment.