Re: [rules-users] resource Allocation in Drools planner
Have you taken a look at the CloudBalance example of Drools Planner? http://vimeo.com/25902052 It includes max cpu, max memory and max network bandwith. Just open the download zip (take 5.3.0.Beta1, much better gui for that example), then run examples/runExamples.sh or .bat and pick CloudBalance. Take a look at the sources under examples/sources. Op 29-08-11 20:49, tzimis schreef: Hi I’m newbie so be generous. I’m dealing with a project for a cloud system and I have a cp problem so any advice how to deal with it will be helpful. Suppose that we have 5 machines each machine has the properties below: • Sec_level: level of security that offers. • Max_CPU: Max cpu resources that offers • Max_Ram: Max ram resources that offers • Max_HD: Max Storage resources that offers • Max_Net: Max Bandwidth resources that offers Then suppose that we have 20 VMs that must allocated to these machines Every VM has these demands: • Priority: The priority that this machine has. • Min_sec_level: The minimum sec level of the machine that can service this vm • CPU: the cpu resources that demands • Ram: ram resources that demands • HD: storage resources that demands • Net: resources that demands. We can have a solution where few Vms aren’t allocated but the allocated Vms must have bigger priority than the unallocated. Can anybody help me by giving me few advices hot to cope with this problem??? -- View this message in context: http://drools.46999.n3.nabble.com/resource-Allocation-in-Drools-planner-tp3293449p3293449.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] reloadKnowledgeBase java.lang.NullPointerException
Hi All, I am getting Nullpointer exception the application is trying to reloadKnwledgeBase. I have the following code in application. public void init() { logger.info(Group Rule Engine Initiated..!!); /** * Polling interval needs to be externalized */ knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(FiveSeries); knowledgeAgent.applyChangeSet(ResourceFactory .newFileResource(propertyReader .getProperty(DROOLS_GUVNOR_CHAGNE_SET_XML_PATH))); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); } logger.info(Group Rule Engine is ready to use..!!); } public void reloadKnowledgeBase() { if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); logger.debug(KnowledgeBase reloaded..!!); } else { logger.info(KnowledgeBase not reloaded..!!); ResourceFactory.getResourceChangeScannerService().stop(); ResourceFactory.getResourceChangeNotifierService().stop(); init(); } } reloadKnowledgeBase() is called once in application during Login. The problem is occurring in Development application. When I am using that Change-Set.xml in my local application, it is working perfectly fine. I m not getting the problem. I bounced both Jboss and application servers but still no luck! -- View this message in context: http://drools.46999.n3.nabble.com/reloadKnowledgeBase-java-lang-NullPointerException-tp3295019p3295019.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] reloadKnowledgeBase java.lang.NullPointerException
Do you have at least the stack trace? Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Tue, Aug 30, 2011 at 11:32 AM, ayonchak ayon.chakrabo...@genworth.comwrote: Hi All, I am getting Nullpointer exception the application is trying to reloadKnwledgeBase. I have the following code in application. public void init() { logger.info(Group Rule Engine Initiated..!!); /** * Polling interval needs to be externalized */ knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(FiveSeries); knowledgeAgent.applyChangeSet(ResourceFactory .newFileResource(propertyReader .getProperty(DROOLS_GUVNOR_CHAGNE_SET_XML_PATH))); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); } logger.info(Group Rule Engine is ready to use..!!); } public void reloadKnowledgeBase() { if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); logger.debug(KnowledgeBase reloaded..!!); } else { logger.info(KnowledgeBase not reloaded..!!); ResourceFactory.getResourceChangeScannerService().stop(); ResourceFactory.getResourceChangeNotifierService().stop(); init(); } } reloadKnowledgeBase() is called once in application during Login. The problem is occurring in Development application. When I am using that Change-Set.xml in my local application, it is working perfectly fine. I m not getting the problem. I bounced both Jboss and application servers but still no luck! -- View this message in context: http://drools.46999.n3.nabble.com/reloadKnowledgeBase-java-lang-NullPointerException-tp3295019p3295019.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Classloading error with AspectJ and Drools 5.2.0.Final
We got exactly the same issue, but I think it could just return empty enumeration rather than null? Cited from the javadoc *EnumberationURL getResources(String name)* /An enumeration of URL objects for the resource. If no resources could be found, the enumeration will be empty. Resources that the class loader doesn't have access to will not be in the enumeration./ stevearoonie wrote: Clarification to this - it does also happen when we run our server. So this is preventing us from upgrading to 5.2 My guess is that getResources should return getParent().getResources() rather than null. regards Steve -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Classloading-error-with-AspectJ-and-Drools-5-2-0-Final-tp3143394p3295236.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Trapping runaway rules
My project involves rule creation by customers, business analysts, and developers. We have a base set of rules that fire for every transaction and then we fire custom rules within a stateful session. An issue I've started to run into is rules being created that fire endlessly. I initialize the session with an event listener that we use to extract all rules fired for each line item of a transaction. Once the session is initialized and all rules from various agenda groups loaded we do a fireall rules. My questions are: 1) how can I detect I have a runaway rule/rules. Is there a method or listener that could detect this for me? Does anyone have a formula they use to do so? I had thought that I could use my event listener that I track the rules with to grab the last X number of rules fires and see if rule y gets fired more that z times. But is there a simpler method? 2) once I've detected a runaway rule, how can I gracefully stop drools rule execution? I read of the command drools.halt in different posts, but not sure if this would be what I'm looking at doing. Any thoughts are appreciated. Thank you! Dean StatefulKnowledgeSession ksession = buildOutgoingStatefulKnowledgeSession(supportingUDTList); // AgendaEventListener agendaListener = new HipaaAgendaListener(); ksession.addEventListener(_ruleLog); for (int i = 0; i _agendaGroups.size(); i++) { if (_log.isDebugEnabled()) _log.debug(Focus on Agenda Group + _agendaGroups.get(i)); ksession.getAgenda().getAgendaGroup(_agendaGroups.get(i)).setFocus(); // Fire them all try { ksession.fireAllRules(); } catch (Exception e) { _log.error(FireAllRules exception. Error= + e.getMessage()); // error } } ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] reloadKnowledgeBase java.lang.NullPointerException
Browsing over the text, this hit my eye: DROOLS_GUVNOR_*CHAGNE*_SET_XML_PATH Change this to CHANGE! -W On 30 August 2011 11:32, ayonchak ayon.chakrabo...@genworth.com wrote: Hi All, I am getting Nullpointer exception the application is trying to reloadKnwledgeBase. I have the following code in application. public void init() { logger.info(Group Rule Engine Initiated..!!); /** * Polling interval needs to be externalized */ knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(FiveSeries); knowledgeAgent.applyChangeSet(ResourceFactory .newFileResource(propertyReader .getProperty(DROOLS_GUVNOR_CHAGNE_SET_XML_PATH))); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); } logger.info(Group Rule Engine is ready to use..!!); } public void reloadKnowledgeBase() { if (knowledgeAgent != null knowledgeAgent.getKnowledgeBase()!=null !knowledgeAgent.getKnowledgeBase().getKnowledgePackages().isEmpty()) { knowledgeBase = knowledgeAgent.getKnowledgeBase(); logger.debug(KnowledgeBase reloaded..!!); } else { logger.info(KnowledgeBase not reloaded..!!); ResourceFactory.getResourceChangeScannerService().stop(); ResourceFactory.getResourceChangeNotifierService().stop(); init(); } } reloadKnowledgeBase() is called once in application during Login. The problem is occurring in Development application. When I am using that Change-Set.xml in my local application, it is working perfectly fine. I m not getting the problem. I bounced both Jboss and application servers but still no luck! -- View this message in context: http://drools.46999.n3.nabble.com/reloadKnowledgeBase-java-lang-NullPointerException-tp3295019p3295019.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Classloading error with AspectJ and Drools 5.2.0.Final
This should be fixed by now on the way to 5.3.0, returning an empty collection - I've seen a confirming email from Mark Proctor. -W On 30 August 2011 13:27, Sammi sammi_t...@yahoo.com.hk wrote: We got exactly the same issue, but I think it could just return empty enumeration rather than null? Cited from the javadoc *EnumberationURL getResources(String name)* /An enumeration of URL objects for the resource. If no resources could be found, the enumeration will be empty. Resources that the class loader doesn't have access to will not be in the enumeration./ stevearoonie wrote: Clarification to this - it does also happen when we run our server. So this is preventing us from upgrading to 5.2 My guess is that getResources should return getParent().getResources() rather than null. regards Steve -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Classloading-error-with-AspectJ-and-Drools-5-2-0-Final-tp3143394p3295236.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trapping runaway rules
On 30 August 2011 14:27, Dean Whisnant d...@basys.com wrote: My project involves rule creation by customers, business analysts, and developers. We have a base set of rules that fire for every transaction and then we fire custom rules within a stateful session. An issue I've started to run into is rules being created that fire endlessly. I initialize the session with an event listener that we use to extract all rules fired for each line item of a transaction. Once the session is initialized and all rules from various agenda groups loaded we do a fireall rules. My questions are: 1) how can I detect I have a runaway rule/rules. Is there a method or listener that could detect this for me? Does anyone have a formula they use to do so? I had thought that I could use my event listener that I track the rules with to grab the last X number of rules fires and see if rule y gets fired more that z times. But is there a simpler method? It's not even as simple as that. ;-) Multiple firing of a rule r within n firings may not be loops if this happens with different facts bound to patterns. 2) once I've detected a runaway rule, how can I gracefully stop drools rule execution? I read of the command drools.halt in different posts, but not sure if this would be what I'm looking at doing. If you detect it during a consequence execution, throw an exception and catch it with a custom consequence exception handler. Using a limit on fire all rules might be another way, in combination with logging all activations. Finally, someone with a little savvy should be able to detect some just by looking at them. The telltale marks are well known... -W Any thoughts are appreciated. Thank you! Dean StatefulKnowledgeSession ksession = buildOutgoingStatefulKnowledgeSession(supportingUDTList); // AgendaEventListener agendaListener = new HipaaAgendaListener(); ksession.addEventListener(_ruleLog); for (int i = 0; i _agendaGroups.size(); i++) { if (_log.isDebugEnabled()) _log.debug(Focus on Agenda Group + _agendaGroups.get(i)); ksession.getAgenda().getAgendaGroup(_agendaGroups.get(i)).setFocus(); // Fire them all try { ksession.fireAllRules(); } catch (Exception e) { _log.error(FireAllRules exception. Error= + e.getMessage()); // error } } ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trapping runaway rules
Wolfgang, Thanks for the thoughts and suggestions. My current implementation does have a limited number of rules we would expect to fire, with little chance of multiple firings. I understand the beauty of the way the engine re-evaluates and re-fires if needed (oversimplification). After posing the question here I dug into the javadocs and saw that fireallrules accepts and int for the max activations and returns an int of the number of activations. I feel pretty comfortable using this method and comparing the in and out ints to be able to do some exception handling (email notifications of issues). If anyone else has other possible solutions/formulas they would use to determine a rule is running away I'd be interested in hearing your ideas. I agree, the person with a bit of savvy would detect the errors themselves, but the nature of my application is that the firing is cloud based and somewhat invisible to the rule creators. What I hope to be able to do with halting the process and informing them of runaways is that they can then review their log of rules fired for each transaction and either resolve the rule issue themselves or contact others who can assist them. The one we had last week had created a 6 Gb rules fired log before anyone was suspicious that there was an issue. :O Again, thank you for the wonderful feedback! Dean From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Tuesday, August 30, 2011 11:20 AM To: Rules Users List Subject: Re: [rules-users] Trapping runaway rules On 30 August 2011 14:27, Dean Whisnant d...@basys.commailto:d...@basys.com wrote: My project involves rule creation by customers, business analysts, and developers. We have a base set of rules that fire for every transaction and then we fire custom rules within a stateful session. An issue I've started to run into is rules being created that fire endlessly. I initialize the session with an event listener that we use to extract all rules fired for each line item of a transaction. Once the session is initialized and all rules from various agenda groups loaded we do a fireall rules. My questions are: 1) how can I detect I have a runaway rule/rules. Is there a method or listener that could detect this for me? Does anyone have a formula they use to do so? I had thought that I could use my event listener that I track the rules with to grab the last X number of rules fires and see if rule y gets fired more that z times. But is there a simpler method? It's not even as simple as that. ;-) Multiple firing of a rule r within n firings may not be loops if this happens with different facts bound to patterns. 2) once I've detected a runaway rule, how can I gracefully stop drools rule execution? I read of the command drools.halt in different posts, but not sure if this would be what I'm looking at doing. If you detect it during a consequence execution, throw an exception and catch it with a custom consequence exception handler. Using a limit on fire all rules might be another way, in combination with logging all activations. Finally, someone with a little savvy should be able to detect some just by looking at them. The telltale marks are well known... -W Any thoughts are appreciated. Thank you! Dean StatefulKnowledgeSession ksession = buildOutgoingStatefulKnowledgeSession(supportingUDTList); // AgendaEventListener agendaListener = new HipaaAgendaListener(); ksession.addEventListener(_ruleLog); for (int i = 0; i _agendaGroups.size(); i++) { if (_log.isDebugEnabled()) _log.debug(Focus on Agenda Group + _agendaGroups.get(i)); ksession.getAgenda().getAgendaGroup(_agendaGroups.get(i)).setFocus(); // Fire them all try { ksession.fireAllRules(); } catch (Exception e) { _log.error(FireAllRules exception. Error= + e.getMessage()); // error } } ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting one type from a collection of multiple types
Sweet! Works fine and I can actually understand what it is doing. I wonder if this is a candidate for a more generalized accumulate function? something like max(baseObject, comparatorMethod) something to work on in our spare time ;o) thanks, W -L -- View this message in context: http://drools.46999.n3.nabble.com/Getting-one-type-from-a-collection-of-multiple-types-tp3287877p3296216.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trapping runaway rules
I would also suggest that you add a no-loop directive to each one of your rules, at least to the ones written by the end-users (if I understood correctly). As I have (painfully) found, it is extremely easy to produce never-ending loops on (end)user-created rules. -Stathis Dean Whisnant wrote: Wolfgang, Thanks for the thoughts and suggestions. My current implementation does have a limited number of rules we would expect to fire, with little chance of multiple firings. I understand the beauty of the way the engine re-evaluates and re-fires if needed (oversimplification). After posing the question here I dug into the javadocs and saw that fireallrules accepts and int for the max activations and returns an int of the number of activations. I feel pretty comfortable using this method and comparing the in and out ints to be able to do some exception handling (email notifications of issues). If anyone else has other possible solutions/formulas they would use to determine a rule is running away I'd be interested in hearing your ideas. I agree, the person with a bit of savvy would detect the errors themselves, but the nature of my application is that the firing is cloud based and somewhat invisible to the rule creators. What I hope to be able to do with halting the process and informing them of runaways is that they can then review their log of rules fired for each transaction and either resolve the rule issue themselves or contact others who can assist them. The one we had last week had created a 6 Gb rules fired log before anyone was suspicious that there was an issue. :O Again, thank you for the wonderful feedback! Dean From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Tuesday, August 30, 2011 11:20 AM To: Rules Users List Subject: Re: [rules-users] Trapping runaway rules On 30 August 2011 14:27, Dean Whisnant d...@basys.commailto:d...@basys.com wrote: My project involves rule creation by customers, business analysts, and developers. We have a base set of rules that fire for every transaction and then we fire custom rules within a stateful session. An issue I've started to run into is rules being created that fire endlessly. I initialize the session with an event listener that we use to extract all rules fired for each line item of a transaction. Once the session is initialized and all rules from various agenda groups loaded we do a fireall rules. My questions are: 1) how can I detect I have a runaway rule/rules. Is there a method or listener that could detect this for me? Does anyone have a formula they use to do so? I had thought that I could use my event listener that I track the rules with to grab the last X number of rules fires and see if rule y gets fired more that z times. But is there a simpler method? It's not even as simple as that. ;-) Multiple firing of a rule r within n firings may not be loops if this happens with different facts bound to patterns. 2) once I've detected a runaway rule, how can I gracefully stop drools rule execution? I read of the command drools.halt in different posts, but not sure if this would be what I'm looking at doing. If you detect it during a consequence execution, throw an exception and catch it with a custom consequence exception handler. Using a limit on fire all rules might be another way, in combination with logging all activations. Finally, someone with a little savvy should be able to detect some just by looking at them. The telltale marks are well known... -W Any thoughts are appreciated. Thank you! Dean StatefulKnowledgeSession ksession = buildOutgoingStatefulKnowledgeSession(supportingUDTList); // AgendaEventListener agendaListener = new HipaaAgendaListener(); ksession.addEventListener(_ruleLog); for (int i = 0; i _agendaGroups.size(); i++) { if (_log.isDebugEnabled()) _log.debug(Focus on Agenda Group + _agendaGroups.get(i)); ksession.getAgenda().getAgendaGroup(_agendaGroups.get(i)).setFocus(); // Fire them all try { ksession.fireAllRules(); } catch (Exception e) { _log.error(FireAllRules exception. Error= + e.getMessage()); // error } } ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools is written in Java, but able to run on Java and .NET ?
check out drools server - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/Drools-is-written-in-Java-but-able-to-run-on-Java-and-NET-tp3296402p3297159.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Bulk modification
Hi, How can I modify all objects resulted from a collect operation? I would like to do something like this: (The following does not work) rule test when exists (MyClass()); $l : ArrayList() from collect (MyClass (attribute == false)); $r : AnotherClass(); then $r.doSomething($l); for(Object o : $l) { MyClass o2 = (MyClass) o; modify(o2) { setAttribute(true); } ; } end I do not want to do: rule test when $o : MyClass(attribute == false) $r : AnotherClass() then $r.doSomething($o); modify(o) {setAttribute(true);}; end because I need to do a bulk operation… Doing it one by one is extremely inefficient in my case. Thanks! Rodrigo. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] accessing items from the StatelessKnowledgeSession
I have passed in some lists into the StatelessKnowledgeSession.execute() method and would like to figure out how to get access. I have the following items passed in: - Player - EarnedBadges (list) - Badges (list) and am trying to do something like this: not (EarnedBadge(playerId == $player.id, badge == $badge) from $earnedBadges) but it doesn't know how to evaluate earnedBadges (the name of the variable I passed in): [Unable to Analyse Expression $earnedBadges: [Error: unable to resolve method using strict-mode: java.lang.Object.$earnedBadges()] [Near : {... $earnedBadges }] Been searching through the docs on how to do this but I haven't found anything yet. Any help is greatly appreciated, thank you! :-). -warner ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users