What do this output from Guvnor means?
by Brody bach
Hi all,
while using Guvnor, I noticed several outputs on the console.
And I'm curious enough what does these lines mean, and how can I eventually
make them faster..(questions are below this code block)
..............
14:47:55,562 INFO [STDOUT] [] [2009:04:106 14:04:562:debug] KnowledgeAgent
ChangeSet requires KnowledgeBuilder
14:47:55,562 INFO [STDOUT] [] [2009:04:106 14:04:562:debug] KnowledgeAgent
rebuilding KnowledgeBase using ChangeSet
14:47:55,578 INFO [STDOUT] [] [2009:04:106 14:04:578:debug] KnowledgeAgent
building resource=[UrlResource
path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/test...']
14:47:55,578 INFO [STDOUT] [] PackageName: testRegulation
14:47:55,578 INFO [STDOUT] [] PackageVersion: testRegulation
14:47:55,578 INFO [STDOUT] [] PackageIsLatest: false
14:47:55,578 INFO [STDOUT] [] PackageIsSource: false
14:47:56,671 INFO [STDOUT] [] PackageName: nationalRegulation
14:47:56,671 INFO [STDOUT] [] PackageVersion: nationalRegulation
14:47:56,671 INFO [STDOUT] [] PackageIsLatest: false
14:47:56,671 INFO [STDOUT] [] PackageIsSource: false
14:47:57,609 INFO [STDOUT] [] [2009:04:106 14:04:609:debug] KnowledgeAgent
adding KnowledgeDefinitionsPackage testRegulation
14:47:57,656 INFO [STDOUT] [] [2009:04:106 14:04:656:info] KnowledgeAgent
new KnowledgeBase now built and in use
Several questions:
1. The lines in bold (PackageIsLatest) appears to take the most time. What
is actually happened there?
2. In the application, i usually have several of this code block and they
make the application slower.
Which instances (KnowledgeBase, (Stateless)KnowledgeSession,
KnowledgeAgentConfig, KnowledgeAgent) can I actually reuse (no
reinstantiating) without having the possibility that old rules package is
being used when I have a new one?
Thanks in advance!
Regards
BB
--
View this message in context: http://www.nabble.com/What-do-this-output-from-Guvnor-means--tp23077920p2...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
Re: [rules-users] is this kind of App right for DROOLS?
by Greg Barton
FYI, I ran the attached code using RuleBaseConfiguration.setMultithreadEvaluation(true) and it stopped working correctly. With it false the output was as expected, something like this:
Starting init
Finished init
Matched 902563
Unmatched B 47347
Time 92658ms
But with multithreaded evaluation the results were invalid:
Starting init
Finished init
Matched 0
Unmatched B 0
Time 25546ms
It runs a lot faster, though. :)
Am I doing something wrong?
--- On Wed, 4/15/09, Greg Barton <greg_barton(a)yahoo.com> wrote:
> From: Greg Barton <greg_barton(a)yahoo.com>
> Subject: Re: [rules-users] is this kind of App right for DROOLS?
> To: "Rules Users List" <rules-users(a)lists.jboss.org>
> Date: Wednesday, April 15, 2009, 11:26 PM
> Attached is an simple implementation of what I describe
> below. I was pleasantly surprised that it ran much faster
> than I expected, and using less memory. At times in pegged
> all four cpu cores on my workstation. It's nice to see
> such effective utilization of resources. (Though I did run
> it with UseParallelGC, so that may have helped.)
>
> The only complaint I have is getting it to stop. :)
> You've got to kill or ctrl-C to get it to halt. I am
> calling drools.halt() in a rule that is being executed. Is
> there another way to exit from fireUntilHalt? The console
> messages printed by the app show that fireUntilHalt does
> exit.
>
> I noticed on doing a thread dump that a drools thread is
> blocking after fireUntilHalt exits:
>
> Name: Thread-2
> State: WAITING on
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@4c7e8bf0
> Total blocked: 0 Total waited: 414
>
> Stack trace:
> sun.misc.Unsafe.park(Native Method)
> java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
> org.drools.concurrent.CommandExecutor.run(CommandExecutor.java:77)
> java.lang.Thread.run(Thread.java:619)
>
> CommandExecutor.java line 77 is this:
>
> Command executor = ( Command ) this.queue.take();
>
> "queue" is a BlockingQueue, and
> BlockingQueue.take() will not exit until it returns an
> object from the queue or it's thread is interrupted.
> Dev d00ds, is there an official way to interrupt this
> thread?
>
15 years, 7 months
Re: [rules-users] is this kind of App right for DROOLS?
by Greg Barton
Attached is an simple implementation of what I describe below. I was pleasantly surprised that it ran much faster than I expected, and using less memory. At times in pegged all four cpu cores on my workstation. It's nice to see such effective utilization of resources. (Though I did run it with UseParallelGC, so that may have helped.)
The only complaint I have is getting it to stop. :) You've got to kill or ctrl-C to get it to halt. I am calling drools.halt() in a rule that is being executed. Is there another way to exit from fireUntilHalt? The console messages printed by the app show that fireUntilHalt does exit.
I noticed on doing a thread dump that a drools thread is blocking after fireUntilHalt exits:
Name: Thread-2
State: WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@4c7e8bf0
Total blocked: 0 Total waited: 414
Stack trace:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
org.drools.concurrent.CommandExecutor.run(CommandExecutor.java:77)
java.lang.Thread.run(Thread.java:619)
CommandExecutor.java line 77 is this:
Command executor = ( Command ) this.queue.take();
"queue" is a BlockingQueue, and BlockingQueue.take() will not exit until it returns an object from the queue or it's thread is interrupted. Dev d00ds, is there an official way to interrupt this thread?
--- On Wed, 4/15/09, Greg Barton <greg_barton(a)yahoo.com> wrote:
> From: Greg Barton <greg_barton(a)yahoo.com>
> Subject: Re: [rules-users] is this kind of App right for DROOLS?
> To: "Rules Users List" <rules-users(a)lists.jboss.org>
> Date: Wednesday, April 15, 2009, 5:06 PM
> A more scalable solution may be this: load all transactions
> from site A, start the rule engine in a separate thread
> using fireUntilHalt, then start inserting the transactions
> from site B. The rules should retract transactions that
> match up. (This way ony roughly half of the transactions
> are in memory at any given time and you can scale twice as
> large.) Once all B transactions have been inserted, what
> you have left are all trasnactions that haven't been
> able to match. You can save them off and reload them if you
> want to attempt matching them in the next round of
> processing.
>
> --- On Wed, 4/15/09, Learning BRMS
> <rulerhawk(a)gmail.com> wrote:
>
> > From: Learning BRMS <rulerhawk(a)gmail.com>
> > Subject: Re: [rules-users] is this kind of App right
> for DROOLS?
> > To: "Rules Users List"
> <rules-users(a)lists.jboss.org>
> > Date: Wednesday, April 15, 2009, 4:34 PM
> > Uaw.. very nice example, Greg... Thanks
> >
> > I really like these Drools solution.
> > I will try your example with some more heavy class
> (with 40
> > attributes)
> > and expand the volume to 2.6 mi objects coming from a
> > hibernate
> > session..
> >
> > I'll let you know.... I think I will enjoy those
> tests
> > :-D
> >
> > Thanks again
> >
> > Kris
> >
> > On Tue, 2009-04-14 at 23:01 -0700, Greg Barton wrote:
> > > Yes, drools can handle this, and can handle the
> > volume. You may want to consider sequential mode
> execution,
> > though. See attached code for some simple matching
> rules.
> > In the example there's a 5% chance a transaction
> with a
> > given id will not be present. You could mock this up
> > further to have rules to handle matching in the case a
> > simple match isn't possible.
> > >
> > > --- On Tue, 4/14/09, Learning BRMS
> > <rulerhawk(a)gmail.com> wrote:
> > >
> > > > From: Learning BRMS
> <rulerhawk(a)gmail.com>
> > > > Subject: [rules-users] is this kind of App
> right
> > for DROOLS?
> > > > To: rules-users(a)lists.jboss.org
> > > > Date: Tuesday, April 14, 2009, 10:43 PM
> > > > Hi people...
> > > >
> > > > I need to solve a problem on my work and I
> would
> > hear from
> > > > you if Drools
> > > > could help us...
> > > >
> > > > I have two kinds of "connected by
> > flatfile"
> > > > systems that register our
> > > > products selling transactions.
> > > >
> > > > We need to match dayly every selling
> transaction
> > against
> > > > both systems
> > > > and to track any difference for every store.
>
> > > >
> > > > An transaction could happens on system A and
> not
> > and system
> > > > B and
> > > > vice-versa and on different dates or times
> > (connection
> > > > problems could
> > > > delay the synchronizing).
> > > > The transaction mostly have the same ID, but
> > there are
> > > > manual
> > > > transactions too with no id only date and
> > values...
> > > >
> > > > For each situation I have to fire a
> different
> > action
> > > > resolution (today
> > > > we have humanhand resolution).
> > > >
> > > > We should have an 1 million of transactions
> by
> > day to
> > > > process...
> > > >
> > > > Today we are using a sql script to do
> reports
> > that will be
> > > > humanly
> > > > analyzed...
> > > >
> > > > I want to change this picture as soon as
> > possible...
> > > >
> > > > Could Drools help us with this kind of
> analyze,
> > and support
> > > > this volume
> > > > of objects?
> > > >
> > > > How many objects could we have on working
> memory
> > at same
> > > > time for that
> > > > match?
> > > >
> > > > Thanks a lot for any comments
> > > >
> > > > Kris
> > > >
> > > >
> _______________________________________________
> > > > rules-users mailing list
> > > > rules-users(a)lists.jboss.org
> > > >
> > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> > >
> > > _______________________________________________
> > rules-users mailing list rules-users(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 7 months
Ensure all values in a list are unique?
by campbeln
I have an ArrayList of strings that I need to ensure are all internally
unique (ie: {"1","2","3"} = OK, {"1","2","1"} = Error). I've managed to
cobble together the code below but I'm running into the "forall w/ an
internal from" issue. I don't believe an upgrade is feasible at the moment,
so are there any alternative solutions?
NOTE: The collection of both $factGroups and $checkGroups is almost
definitely redundant, so please keep any laughing to a minimum =)
rule "BR033"
no-loop true
when
$fact : MyFact()
//# Get 2 copies of all the Groups associated with the $fact
$factGroups : ArrayList() from collect (
Group() from $fact.Groups
)
$checkGroups : ArrayList() from collect (
Group() from $fact.Groups
)
//# Traverse the $factGroups comparing each $currentGroup to the list
//# within $checkGroups, erroring out if something other then 1 is found
forall (
$currentGroup : Group(this memberOf $factGroups)
$test : ArrayList(size != 1) from collect(
Group(this == $currentGroup) from $checkGroups
)
)
then
System.out.println("Failed: BR033");
end
I have found a number of postings that seem to be related, namely
http://www.nabble.com/Best-practice-for-rules-against-multiple-objects-td...
but I've been unable to cobble together a solution thus far. All help is
appreciated!
Thanks!
--
View this message in context: http://www.nabble.com/Ensure-all-values-in-a-list-are-unique--tp23071079p...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
is this kind of App right for DROOLS?
by Learning BRMS
Hi people...
I need to solve a problem on my work and I would hear from you if Drools
could help us...
I have two kinds of "connected by flatfile" systems that register our
products selling transactions.
We need to match dayly every selling transaction against both systems
and to track any difference for every store.
An transaction could happens on system A and not and system B and
vice-versa and on different dates or times (connection problems could
delay the synchronizing).
The transaction mostly have the same ID, but there are manual
transactions too with no id only date and values...
For each situation I have to fire a different action resolution (today
we have humanhand resolution).
We should have an 1 million of transactions by day to process...
Today we are using a sql script to do reports that will be humanly
analyzed...
I want to change this picture as soon as possible...
Could Drools help us with this kind of analyze, and support this volume
of objects?
How many objects could we have on working memory at same time for that
match?
Thanks a lot for any comments
Kris
15 years, 7 months
How to traverse a hierarchy?
by Charles Binford
All, I'm trying to figure out a better way to solve this problem. I
have a batch of objects that I want matched against a hierarchy of
rules. I check the rules in order, and as soon as I find a match I'm
done for that level of the hierarchy. In other words, If the object
matches a rule, we'll check the rules children, but not the siblings.
Example:
rule 1
rule 1.1
rule 1.2
rule 1.2.1
rule 1.2.2
rule 1.3
rule 2
If an object matches rule 1, check for a match at level "1.*", but rule
2 will never be checked. If an object matches 1, 1.2, and 1.2.1, we're
done as 1.2.1 has no children.
My current implementation with drools works, but is very inefficient. I
have a "level" string in the objects and whenever I find a match I
update the level of the object and force an object update. Each rule
tests that the level string is correct, e.g. rule 1.2.1 works as follows:
rule "1.2.1"
when
obj(level matches "1.2.*",.....)
...
then
objSetLevel("1.2.1.*");
....
end
I'm also using saliance to keep the evaluation order like I want it.
Changing the contents of the object and doing the update is not good for
drools performance as I understand it so I'm looking for a better way.
The hierarchy and the order of the matching is key to my application so
I'm not wanting to redesign that part of things.
I tried using activation-groups. That worked great as long as I only
had a single object to run through the hierarchy, but given the way the
rest of the system is design I need to load up 10-100 objects before
each call to fireallrules() for performance purposes.
Any suggestions are appreciated.
Charles Binford
15 years, 7 months
Backward chaining in drools 5?
by Alberto Cabas Vidani
I read the information available about drools 5, but support to backward
chaining is never mentioned. Since in the documentation of Drools 4 it's
said that it will be supported in the next major release I'm wondering
wether it will be present in release 5. Does anyone know something about it?
Alberto
15 years, 7 months