-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[DROOLS-7416] Rebuild RuleUnit option #5391
Conversation
This feature is implemented based on the discussion : https://groups.google.com/g/drools-usage/c/G6A3EMbec90/m/KSGzoOEdAAAJ @mariofusco Please review and let me know if this makes sense, thanks! |
(tests) - drools job Reproducerexport BUILD_MVN_OPTS_CURRENT=-Dfull -Prun-code-coverage NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution Test results:
Those are the test failures: |
Checking test failure... |
c45f56e
to
c018b16
Compare
This reverts commit 9849420.
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 don't like adding a new method to our public API with that additional boolean
and also exposing to end user the presence of that internal cache. In reality I believe that the use case in your test is a bit 'stretched' and maybe the more correct way to implement it would be making that expectedMessage
String to come from a specific DataSource
and being inserted as a fact.
That said I believe that this use case can already work without changing our code but simply implementing the RuleUnitDefinition
as it follows.
public class DynamicHelloWorldUnit implements RuleUnitDefinition, NamedRuleUnitData {
private final String expectedMessage; // this is the dynamic part
public DynamicHelloWorldUnit(String expectedMessage) {
this.expectedMessage = expectedMessage;
}
@Override
public String getUnitName() {
return getClass().getCanonicalNam() + "#" + expectedMessage;
}
}
Be aware that I didn't try this, so please give it a try and double check if I'm right. If so I suggest to simply add the test to our code base and better documenting this behaviour.
Kudos, SonarCloud Quality Gate passed! |
Hi @mariofusco Yes, https://groups.google.com/g/drools-usage/c/G6A3EMbec90/m/KSGzoOEdAAAJ
If the user can "rebuild" the same rule unit in the cache, they don't need to track the old versions and also don't need to worry about the heap memory. Does it make sense? Or we don't want to introduce such a rebuild feature? |
As I said this use case is a bit stretched especially in the microservices scenario. I believe that to cover it the The only remaining concern is indeed the size of the cache Map and then its heap memory occupation. I believe that turning that Map into an LRU one with a fixed maximum size, let's say 100 items for now and we will make it configurable in case any user will ask for it, will also solve this issue. If you agree please close this pull request and create a new one introducing the LRU cache. Another possibility would be to add a method allowing to explicitly invalidate and remove from the cache all
In this way the user could explicitly remove the old rule unit before asking to compile a new one. This solution is also similar to what we have in the KieRepository where we have a method to remove kieModules with a given ReleaseId (GAV). |
Thank you, @mariofusco , I'll go for |
Replaced with https://github.com/kiegroup/drools/pull/5397 |
JIRA:
https://issues.redhat.com/browse/DROOLS-7416
How to replicate CI configuration locally?
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.
build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.
How to retest this PR or trigger a specific build:
for pull request checks
Please add comment: Jenkins retest this
for a specific pull request check
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] tests
for a full downstream build
run_fdb
a compile downstream build please add comment: Jenkins run cdb
a full production downstream build please add comment: Jenkins execute product fdb
an upstream build please add comment: Jenkins run upstream
for quarkus branch checks
Run checks against Quarkus current used branch
Please add comment: Jenkins run quarkus-branch
for a quarkus branch specific check
Run checks against Quarkus current used branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch
for quarkus main checks
Run checks against Quarkus main branch
Please add comment: Jenkins run quarkus-main
for a specific quarkus main check
Run checks against Quarkus main branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-main
for quarkus lts checks
Run checks against Quarkus lts branch
Please add comment: Jenkins run quarkus-lts
for a specific quarkus lts check
Run checks against Quarkus lts branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts
for native checks
Run native checks
Please add comment: Jenkins run native
for a specific native check
Run native checks
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native
for native lts checks
Run native checks against quarkus lts branch
Please add comment: Jenkins run native-lts
for a specific native lts check
Run native checks against quarkus lts branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native-lts
How to backport a pull request to a different branch?
In order to automatically create a backporting pull request please add one or more labels having the following format
backport-<branch-name>
, where<branch-name>
is the name of the branch where the pull request must be backported to (e.g.,backport-7.67.x
to backport the original PR to the7.67.x
branch).Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
If something goes wrong, the author will be notified and at this point a manual backporting is needed.