Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

improvement: Remove resource reservation cache and instead just use a store backed by a lister #254

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

k-simons
Copy link
Contributor

@k-simons k-simons commented Apr 7, 2023

Before this PR

After this PR

==COMMIT_MSG==
==COMMIT_MSG==

Possible downsides?

Copy link
Contributor

@Alexis-D Alexis-D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall seems like a good idea (and would allow us to revert the #262 hack), but unless I'm missing something won't this lead to a situation where we create an rr, we silently timeout trying to see that update, then later on we fail to see that rr because we're lagging behind?

(i guess you could argue that we already have this issue when running multiple spark scheduler nodes anyway?)


func (d *defaultStore) allowListerToSync(ctx context.Context, result *v1beta2.ResourceReservation) {
ticker := time.NewTicker(time.Millisecond * 20)
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(time.Second*5))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(time.Second*5))
ctx, cancel := context.WithTimeout(ctx, time.Second*5)

return err
}

func (d *defaultStore) allowListerToSync(ctx context.Context, result *v1beta2.ResourceReservation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the potential unintended consequences on this failing silently, should this return an error at least?

return err
}
d.allowListerToSync(ctx, result)
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return err
return nil

return err
}
d.allowListerToSync(ctx, result)
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return err
return nil

return rrm.resourceReservations.Get(namespace, appID)
func (rrm *ResourceReservationManager) GetResourceReservation(ctx context.Context, appID string, namespace string) (*v1beta2.ResourceReservation, bool) {
r, err := rrm.resourceReservationStore.Get(ctx, namespace, appID)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err != nil {
return r, err == nil

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants