-
Notifications
You must be signed in to change notification settings - Fork 663
[RayCluster] Improved the efficiency when checking rayclusters' expectations #4209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[RayCluster] Improved the efficiency when checking rayclusters' expectations #4209
Conversation
|
@Eikykun Since you implemented the first version of RayClusterScaleExpectation, could you view ? |
c5cedc5 to
cf8f80e
Compare
0aaa9f5 to
e9d4859
Compare
e9d4859 to
cc80b2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @fscnick @machichima @seanlaii for review if you are interested
for more detail, you can refer #2566
| // Avoid this by setting a timeout. | ||
| return rp.recordTimestamp.Add(ExpectationsTimeout).Before(time.Now()) | ||
| case Delete: | ||
| if err := r.Get(ctx, types.NamespacedName{Name: rp.name, Namespace: namespace}, pod); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if err := r.Get(ctx, types.NamespacedName{Name: rp.name, Namespace: namespace}, pod); err != nil { | |
| if err := r.Get(ctx, types.NamespacedName{Name: rp.name, Namespace: rp.namespace}, pod); err != nil { |
| } | ||
| } | ||
|
|
||
| func (r *rayClusterScaleExpectationImpl) isPodScaled(ctx context.Context, rp *rayPod, namespace string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we have namespace in rp *rayPod already
| func (r *rayClusterScaleExpectationImpl) isPodScaled(ctx context.Context, rp *rayPod, namespace string) bool { | |
| func (r *rayClusterScaleExpectationImpl) isPodScaled(ctx context.Context, rp *rayPod) bool { |
Why are these changes needed?
The current implementation of
IsSatisfiedinscale_expectation.go, will iterate through all pods in itemsCache. This is not necessary. When one pod fails to meet the expectation, we can return directly.fast-failmeans return earlier once a pod's scaling result is not as expected.Current code:
For example, we may create 10 pods, and expect to successfully get the 10 pods. If none of the pods is ready, no need to iterate through the 10 pods every time. Just find one pod is missing and then break.
I also refactored the code, reduced nested
if-elseconditions.Related issue number
Checks