-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(ingest/gc): add limit, add actual loop for iterating over batches #11809
Conversation
Hello @anshbansal 😄 Thank you so much for opening a pull request!
|
@@ -59,6 +59,9 @@ class SoftDeletedEntitiesCleanupConfig(ConfigModel): | |||
default=None, | |||
description="Query to filter entities", | |||
) | |||
limit_entities_delete: int = Field( |
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.
Can we make this optional?
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.
I
self.report.num_soft_deleted_entity_removed | ||
<= self.config.limit_entities_delete | ||
): | ||
urns = list( |
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.
You get here more items than the limit.
I think it would be better to only iterate over the get_urns_by_filter
and stop when you hit the limit and only keep limit
number of item in memory and in the list
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.
Do you mean in the case where batch_size > limit?
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.
What if I do this
while (
- self.report.num_soft_deleted_entity_removed
- <= self.config.limit_entities_delete
+ self.config.limit_entities_delete <= 0
+ or self.report.num_soft_deleted_entity_removed
+ <= max(self.config.limit_entities_delete, self.config.batch_size)
):
10000, description="Max number of entities to delete." | ||
) | ||
|
||
runtime_limit_seconds: Optional[int] = Field( |
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.
Think this makes more sense as minutes
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.
probably true in reality but dev-ops is pretty used to dealing with seconds for lots of things, feel free to change it later but not a blocker imho
Checklist