Skip to content

Commit

Permalink
[YUNIKORN-2594] Remove unused field AllocationAsk.execTimeout (apache…
Browse files Browse the repository at this point in the history
…#859)

The execTimeout field in AllocationAsk is populated but unused.

Closes: apache#859
  • Loading branch information
craigcondit committed Apr 27, 2024
1 parent cf838f9 commit e3d9429
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 30 deletions.
13 changes: 3 additions & 10 deletions pkg/scheduler/objects/allocation_ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ type AllocationAsk struct {
allocationKey string
applicationID string
partitionName string
taskGroupName string // task group this allocation ask belongs to
placeholder bool // is this a placeholder allocation ask
execTimeout time.Duration // execTimeout for the allocation ask
createTime time.Time // the time this ask was created (used in reservations)
taskGroupName string // task group this allocation ask belongs to
placeholder bool // is this a placeholder allocation ask
createTime time.Time // the time this ask was created (used in reservations)
priority int32
requiredNode string
allowPreemptSelf bool
Expand Down Expand Up @@ -95,7 +94,6 @@ func NewAllocationAskFromSI(ask *si.AllocationAsk) *AllocationAsk {
tags: CloneAllocationTags(ask.Tags),
createTime: time.Now(),
priority: ask.Priority,
execTimeout: common.ConvertSITimeout(ask.ExecutionTimeoutMilliSeconds),
placeholder: ask.Placeholder,
taskGroupName: ask.TaskGroupName,
requiredNode: common.GetRequiredNodeFromTag(ask.Tags),
Expand Down Expand Up @@ -199,11 +197,6 @@ func (aa *AllocationAsk) GetTaskGroup() string {
return aa.taskGroupName
}

// GetTimeout returns the timeout for this ask
func (aa *AllocationAsk) GetTimeout() time.Duration {
return aa.execTimeout
}

// GetRequiredNode gets the node (if any) required by this ask.
func (aa *AllocationAsk) GetRequiredNode() string {
return aa.requiredNode
Expand Down
18 changes: 0 additions & 18 deletions pkg/scheduler/objects/allocation_ask_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,6 @@ func TestPlaceHolder(t *testing.T) {
assert.Equal(t, ask.GetTaskGroup(), "testgroup", "TaskGroupName not set as expected")
}

func TestGetTimeout(t *testing.T) {
siAsk := &si.AllocationAsk{
AllocationKey: "ask1",
ApplicationID: "app1",
PartitionName: "default",
}
ask := NewAllocationAskFromSI(siAsk)
assert.Equal(t, ask.GetTimeout(), time.Duration(0), "standard ask should not have timeout")
siAsk = &si.AllocationAsk{
AllocationKey: "ask1",
ApplicationID: "app1",
PartitionName: "default",
ExecutionTimeoutMilliSeconds: 10,
}
ask = NewAllocationAskFromSI(siAsk)
assert.Equal(t, ask.GetTimeout(), 10*time.Millisecond, "ask timeout not set as expected")
}

func TestGetRequiredNode(t *testing.T) {
tag := make(map[string]string)
// unset case
Expand Down
1 change: 0 additions & 1 deletion pkg/webservice/dao/allocation_ask_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type AllocationAskDAOInfo struct {
ApplicationID string `json:"applicationId,omitempty"`
Partition string `json:"partition,omitempty"`
Placeholder bool `json:"placeholder,omitempty"`
PlaceholderTimeout int64 `json:"placeholderTimeout,omitempty"`
TaskGroupName string `json:"taskGroupName,omitempty"`
AllocationLog []*AllocationAskLogDAOInfo `json:"allocationLog,omitempty"`
TriggeredPreemption bool `json:"triggeredPreemption,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion pkg/webservice/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ func getAllocationAskDAO(ask *objects.AllocationAsk) *dao.AllocationAskDAOInfo {
ApplicationID: ask.GetApplicationID(),
Partition: common.GetPartitionNameWithoutClusterID(ask.GetPartitionName()),
Placeholder: ask.IsPlaceholder(),
PlaceholderTimeout: ask.GetTimeout().Nanoseconds(),
TaskGroupName: ask.GetTaskGroup(),
AllocationLog: getAllocationLogsDAO(ask.GetAllocationLog()),
TriggeredPreemption: ask.HasTriggeredPreemption(),
Expand Down

0 comments on commit e3d9429

Please sign in to comment.