Skip to content

Commit

Permalink
chore: remove unused SetAllocationName (#8829)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinaecalderon authored Feb 13, 2024
1 parent 1946d9a commit d8d9965
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 59 deletions.
13 changes: 0 additions & 13 deletions master/internal/rm/agentrm/agent_resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,19 +486,6 @@ func (a *ResourceManager) ResolveResourcePool(name string, workspaceID int, slot
return name, nil
}

// SetAllocationName implements rm.ResourceManager.
func (a *ResourceManager) SetAllocationName(msg sproto.SetAllocationName) {
pool, err := a.poolByName(msg.ResourcePool)
if err != nil {
a.syslog.WithError(err).Warnf("set allocation name found no resource pool with name %s",
msg.ResourcePool)
return
}
// In the actor system, this was a tell before, so the `go` is to keep the same structure. I'm not changing it
// out of principle during the refactor but removing it is very likely fine, just check for deadlocks.
go pool.SetAllocationName(msg)
}

// SetGroupMaxSlots implements rm.ResourceManager.
func (a *ResourceManager) SetGroupMaxSlots(msg sproto.SetGroupMaxSlots) {
pool, err := a.poolByName(msg.ResourcePool)
Expand Down
12 changes: 0 additions & 12 deletions master/internal/rm/agentrm/resource_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,6 @@ func (rp *resourcePool) restoreResources(
return nil
}

func (rp *resourcePool) SetAllocationName(msg sproto.SetAllocationName) {
rp.mu.Lock()
defer rp.mu.Unlock()
rp.receiveSetTaskName(msg)
}

func (rp *resourcePool) receiveSetTaskName(msg sproto.SetAllocationName) {
if task, found := rp.taskList.TaskByID(msg.AllocationID); found {
task.Name = msg.Name
}
}

func (rp *resourcePool) ResourcesReleased(msg sproto.ResourcesReleased) {
rp.mu.Lock()
defer rp.mu.Unlock()
Expand Down
11 changes: 0 additions & 11 deletions master/internal/rm/kubernetesrm/kubernetes_resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,6 @@ func (k *ResourceManager) Release(msg sproto.ResourcesReleased) {
rp.ResourcesReleased(msg)
}

// SetAllocationName implements rm.ResourceManager.
func (k *ResourceManager) SetAllocationName(msg sproto.SetAllocationName) {
rp, err := k.poolByName(msg.ResourcePool)
if err != nil {
k.syslog.WithError(err).Warnf("set allocation name found no resource pool with name %s",
msg.ResourcePool)
return
}
rp.SetAllocationName(msg)
}

// SetGroupMaxSlots implements rm.ResourceManager.
func (k *ResourceManager) SetGroupMaxSlots(msg sproto.SetGroupMaxSlots) {
rp, err := k.poolByName(msg.ResourcePool)
Expand Down
16 changes: 0 additions & 16 deletions master/internal/rm/kubernetesrm/resource_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ func (k *kubernetesResourcePool) SetGroupMaxSlots(msg sproto.SetGroupMaxSlots) {
k.getOrCreateGroup(msg.JobID).MaxSlots = msg.MaxSlots
}

func (k *kubernetesResourcePool) SetAllocationName(msg sproto.SetAllocationName) {
k.mu.Lock()
defer k.mu.Unlock()
k.reschedule = true

k.receiveSetAllocationName(msg)
}

func (k *kubernetesResourcePool) AllocateRequest(msg sproto.AllocateRequest) {
k.mu.Lock()
defer k.mu.Unlock()
Expand Down Expand Up @@ -464,14 +456,6 @@ func (k *kubernetesResourcePool) jobQInfo() map[model.JobID]*sproto.RMJobInfo {
return correctedJobQInfo
}

func (k *kubernetesResourcePool) receiveSetAllocationName(
msg sproto.SetAllocationName,
) {
if task, found := k.reqList.TaskByID(msg.AllocationID); found {
task.Name = msg.Name
}
}

func (k *kubernetesResourcePool) assignResources(
req *sproto.AllocateRequest,
) {
Expand Down
1 change: 0 additions & 1 deletion master/internal/rm/resource_manager_iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type ResourceManager interface {
// Basic functionality
GetAllocationSummary(sproto.GetAllocationSummary) (*sproto.AllocationSummary, error)
GetAllocationSummaries(sproto.GetAllocationSummaries) (map[model.AllocationID]sproto.AllocationSummary, error)
SetAllocationName(sproto.SetAllocationName)
Allocate(sproto.AllocateRequest) (*sproto.ResourcesSubscription, error)
Release(sproto.ResourcesReleased)
ValidateCommandResources(sproto.ValidateCommandResourcesRequest) (sproto.ValidateCommandResourcesResponse, error)
Expand Down
6 changes: 0 additions & 6 deletions master/internal/sproto/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ type (
Priority *int `json:"priority"`
ProxyPorts []*ProxyPortConfig `json:"proxy_ports,omitempty"`
}
// SetAllocationName sets the name of the task.
SetAllocationName struct {
Name string
AllocationID model.AllocationID
ResourcePool string
}

// ValidateCommandResourcesRequest is a message asking resource manager whether the given
// resource pool can (or, rather, if it's not impossible to) fulfill the command request
Expand Down

0 comments on commit d8d9965

Please sign in to comment.