-
Notifications
You must be signed in to change notification settings - Fork 8
Allow querying multiple decision contexts in a single decision #95
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
Allow querying multiple decision contexts in a single decision #95
Conversation
ff67319
to
ca91c23
Compare
FWIW, I've actually tested using this change in Bodhi, by running a dev instance of Bodhi against a dev instance of Greenwave with this patch applied. The changes to Bodhi are small and it definitely improves efficiency (mainly because Greenwave doesn't query the results twice for each package in the update). |
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.
That looks great, thanks!
Added one minor suggestion about stray print()
.
ca91c23
to
263196c
Compare
Oh, I guess one thing I forgot to note: the decisions about when to require a specific type or change a string to a list of strings are actually a bit arbitrary. You may wonder why I didn't have to change any of the I guess the way I thought about it is, the actual canonical path where this stuff gets used in production - which, AFAIK, is only through I also considered changing |
When Greenwave was designed we never really envisaged a use for querying multiple decision contexts at once. We assumed it'd only ever make sense to care about exactly one context for whatever decision you're trying to make. However, we wound up using multiple decision contexts to solve the problem of wanting different policies for the same gating point depending on the contents of the thing being gated. For a specific example, when gating Fedora updates, we have a `bodhi_update_push_testing` context that we always query for any update being pushed to testing, but we also have a `bodhi_update_push_testing_critpath` context that we only query for critical path updates (because it requires some tests that are only *run* on critical path updates). A pending Bodhi pull request - fedora-infra/bodhi#4759 - would make Bodhi query even more decision contexts for critical path updates. Currently when Bodhi wants to query multiple decision contexts, it has to ask for one decision per context. This is pretty inefficient. It actually turns out to be quite easy to just allow the `decision_context` value to be a list of strings as well as a single string; all that really needs to be done to handle this is a fairly small tweak to `Policy.matches()`. Since we already iterate over every policy, I don't think this even has any significant performance impact, it should be about as fast to check every policy against a list of decision contexts as it is to check it against a single context. Signed-off-by: Adam Williamson <awilliam@redhat.com>
263196c
to
5b51c0f
Compare
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
thanks for merging this! what would be the schedule for pushing it to production? I kinda have a whole chain of things in bodhi then openQA update scheduling queued up behind it. |
Any chance you can verify it in stage? The container image with latest changes should be deployed there (I don't see any errors/warnings in logs). To deploy to prod, I could just bump the container image to prod without doing the full release. |
I can 'verify' it by running manual queries, but it's hard to check everything works "for real" because staging Bodhi doesn't really simulate production Bodhi very well. I just threw a manual query at it and I think it was fine, except I also noticed openQA staging's resultsdb submitter has been turned off so the results aren't there to confirm we get a 'passed' decision...I've turned it back on and it's catching up, but it may take a while. Still, AFAICS things are sane for the old updates that are listed in staging Bodhi - it's getting decisions back from greenwave that match the results in resultsdb, i.e. none so everything fails gating, but the decisions are correct and contain the right list of expected test results. So I don't think this broke anything for how we currently have Bodhi deployed at least. |
Oh, as for how this gets pushed to prod exactly: we'd need the 'prod' tag on quay to be updated, because bodhi has integration tests that deploy the 'prod' greenwave container. My PR will fail the bodhi tests as long as they're running against a greenwave that doesn't have this change. |
The change is now in production. I do not see any problems in logs. 🙌 |
whew! thanks. i'll work on the Bodhi PR. |
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Since release-engineering/greenwave#95 , greenwave allows clients to query on multiple decision contexts at once. All relevant policies for all specified decision contexts are then applied to the decision. This means we no longer need to iterate over all relevant decision contexts and send a separate decision query for each one; we can just send one query (per `greenwave_batch_size` subjects, still) with all the decision contexts in it. This makes the code simpler and will make Bodhi more efficient. Signed-off-by: Adam Williamson <awilliam@redhat.com>
When Greenwave was designed we never really envisaged a use for querying multiple decision contexts at once. We assumed it'd only ever make sense to care about exactly one context for whatever decision you're trying to make.
However, we wound up using multiple decision contexts to solve the problem of wanting different policies for the same gating point depending on the contents of the thing being gated. For a specific example, when gating Fedora updates, we have a
bodhi_update_push_testing
context that we always query for any update being pushed to testing, but we also have abodhi_update_push_testing_critpath
context that we only query for critical path updates (because it requires some tests that are only run on critical path updates). A pending Bodhi pull request - fedora-infra/bodhi#4759 - would make Bodhi query even more decision contexts for critical path updates.Currently when Bodhi wants to query multiple decision contexts, it has to ask for one decision per context. This is pretty inefficient. It actually turns out to be quite easy to just allow the
decision_context
value to be a list of strings as well as a single string; all that really needs to be done to handle this is a fairly small tweak toPolicy.matches()
. Since we already iterate over every policy, I don't think this even has any significant performance impact, it should be about as fast to check every policy against a list of decision contexts as it is to check it against a single context.Signed-off-by: Adam Williamson awilliam@redhat.com