Sliding window "full" length question
by GrantWang
Hi, I found the following statements in Drools document:
"Sliding windows start to match immediately and defining a sliding window
does not imply that the rule has to wait for the sliding window to be "full"
in order to match. For instance, a rule that calculates the average of an
event property on a window:length(10) will start calculating the average
immediately, and it will start at 0 (zero) for no-events, and will update
the average as events arrive one by one."
Would someone please let me know how I can wait for the sliding windows to
be full to match? Our requirement is always use the average reading over at
least 60 seconds.
Thanks!
Grant
--
View this message in context: http://drools.46999.n3.nabble.com/Sliding-window-full-length-question-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Updating project repositories
by Joe White
I have updated my repository configuration but when I build and deploy by package two things happen:
- The jar only gets deployed to my local repo it doesn't go out to the remote instance
- The pom doesn't contain the full repository configuration when deployed. The <snapshot> and <releases> config are dropped
Am I missing a piece of config to get the jar pushed out to my remote repo?
My repository config inside the WB:
<repositories>
<repository>
<id>recondo-repo</id>
<name>papaafrepo001-releases</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://papaafrepo001.recondo.vci:8081/artifactory/repo</url>
</repository>
</repositories>
Repo config inside the deployed pom:
<repositories>
<repository>
<id>recondo-repo</id>
<name>papaafrepo001-releases</name>
<url>http://papaafrepo001.recondo.vci:8081/artifactory/repo</url>
</repository>
</repositories>
Joe White
CIO Technology Enabled Services
303-974-2849 (Office)
720-232-9023 (Cell)
10 years, 9 months
Programmatically load rules classloader NullPointerException
by GrantWang
Hello,
I was trying to build a kie module and programmatically load DRL rules at
runtime. But I found for any new event type I wanted to monitor, I had to
add "@rule(event)" when I 1st created the module. If I didn't, I would get
the following exception when I tried to updateToVersion. My java file is
also attached. Would some one please let me know what caused my problem? And
anyway to get around this problem? We really need to get the
programmatically loading rules working in our project. Thanks a lot.
PlayGround1.java
<http://drools.46999.n3.nabble.com/file/n4028783/PlayGround1.java>
Exception in thread "main" java.lang.NullPointerException
at
org.drools.core.common.ProjectClassLoader$InternalTypesClassLoader.defineClass(ProjectClassLoader.java:230)
at
org.drools.core.common.ProjectClassLoader.defineType(ProjectClassLoader.java:141)
at
org.drools.core.common.ProjectClassLoader.defineClass(ProjectClassLoader.java:152)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:191)
at com.some.app.PlayGround1.runRules(PlayGround1.java:72)
at com.some.app.PlayGround1.main(PlayGround1.java:34)
--
View this message in context: http://drools.46999.n3.nabble.com/Programmatically-load-rules-classloader...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Multithreaded update of facts in Drools 5.5 - how to ensure that a nested value isn't null
by Per Sterner
Hello,
My question is:
How can I ensure that a nested property isn't null (in a multithreaded
environment)?
This is the rule:
rule "Drools Test3: Concurrency"
dialect "java"
when
$testObj : TestObject(
$ref : subObject,
$ref != null,
$ref.message != null
)
then
System.out.println("Received-04-A: " + $testObj);
end
I am getting the following exception if I try to modify the fact in
different threads.
java.lang.NullPointerException: null
at
ConditionEvaluator8d1e3555e8c34810957bbb1670f51176.evaluate(null:-1)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:154)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:157)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at
org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314)
at
org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:483)
at
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:976)
at
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:949)
at
org.drools.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:284)
[...]
There are two threads running which modify the same reference in a
testobject ("subObject"). They trigger a queued update of the fact.
One solution would be:
- insert the nested object in drools
- and modify the rule:
rule "Drools Test3: Concurrency 2"
dialect "java"
when
$subObj : TestObject(
message != null
)
$testObj : TestObject(
subObject == $subObj
)
then
System.out.println("Received-04-A: " + $testObj);
end
Can I achieve a thread safety differently?
Thanks and regards,
Per Sterner
10 years, 9 months
Confirm the usage of agenda-groups
by djb
Hi all,
Sorry if it seems like this is an old question, but it's hard finding a
simple unambiguous example. It's a stack, right? So I push them on
'backwards'.
I've got 5 groups of rules, and I want the groups to fire in the order I've
described the groups as, below.
I also don't want them to start firing as soon as a fact is inserted, which
is what seems to happen, according to my activation listener.
So, would I do this:
--------------
getAgendaGroup( "last group to fire" ).setFocus();
getAgendaGroup( "second last group to fire" ).setFocus();
getAgendaGroup( "middle group to fire" ).setFocus();
getAgendaGroup( "second group to fire" ).setFocus();
getAgendaGroup( "first group to fire" ).setFocus();
insert(facts)
fireAllRules()
--------------
?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Confirm-the-usage-of-agenda-groups-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Pojos not visible in Guided DT
by Joe White
In the workbench has anybody seen a case where you can create a decision table with the Wizard and it sees your classes. But the non- wizard decision table definition fails? I get this exception when creating a table without using the wizard and none of my objects show up in the dropdown for column definition. If I use the wizard and select my imports everything works as expected.
1. java.lang.NullPointerException: null
2. at org.drools.compiler.kie.builder.impl.KieBuilderSetImpl.registerInitialErrors(KieBuilderSetImpl.java:50) ~[drools-compiler-6.0.1.Final.jar:6.0.1.Final]
3. at org.drools.compiler.kie.builder.impl.KieBuilderSetImpl.<init>(KieBuilderSetImpl.java:42) ~[drools-compiler-.0.1.Final.jar:6.0.1.Final]
4. at org.drools.compiler.kie.builder.impl.KieBuilderImpl.createFileSet(KieBuilderImpl.java:703) ~[drools-compiler-6.0.1.Final.jar:6.0.1.Final]
5. at org.guvnor.common.services.builder.Builder.addResource(Builder.java:245) ~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final] at org.guvnor.common.services.builder.Builder.updateResource(Builder.java:319) ~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
6. at org.guvnor.common.services.builder.BuildServiceImpl.updatePackageReso
7. urce(BuildServiceImpl.java:192) ~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
8. at org.guvnor.common.services.builder.BuildServiceImpl$Proxy$_$$_WeldClientProxy.updatePackageResource(BuildServiceImpl$Proxy$_$$_WeldClientProxy.java)
9. [guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
10. at org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder$4.run(ResourceChangeIncrementalBuilder.java:237)[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
11. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
12. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
13. at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
14. 2014-03-18 13:31:02,953 [pool-9-thread-8] ERROR null
15. org.guvnor.common.services.shared.exceptions.GenericPortableException: null
16. at org.guvnor.common.services.backend.exceptions.ExceptionUtilities.handleException(ExceptionUtilities.java:24) ~[guvnor-services-api-6.0.1.Final.jar:6.0.1.Final]
17. at org.guvnor.common.services.builder.BuildServiceImpl.updatePackageResource(BuildServiceImpl.java:200) ~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
18. at org.guvnor.common.services.builder.BuildServiceImpl$Proxy$_$$_WeldClientProxy.updatePackageResource(BuildServiceImpl$Proxy$_$$_WeldClientProxy.java)~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
19. at org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder$4.run(ResourceChangeIncrementalBuilder.java:237) ~[guvnor-project-builder-6.0.1.Final.jar:6.0.1.Final]
20. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
21. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
22. at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
10 years, 9 months
problem in sliding window
by Sandhya Sree
hi,
i have a rule file as follows:
declare Event
@role( event )
end
declare window Ticks
Event()
over window:time(1m )
end
rule "More than 5 file added events"
when
$p: RuleContext()
Number(intValue > 4) from
accumulate( $e :Event (name == "new file added") from window Ticks,
count($e) )
then
Event event = new Event("too many files added last
minute",$p.getOldContext().getParent(),new
Date());
event.display();
end
this rule gets fired only if i add more than 4 files all at once..
say if i add first 2 files within the first 10 seconds, next two files
after the 20th second and next two files after 40th second, this rule is
not getting fired.. ( there are 6 file added events in the window over past
1 min and the rule should have got fired ). what is the problem with the
current rules and how can i modify it to meet my requirement?
Thanks.
10 years, 9 months
physical resource allocation problem
by Scott Danner
Hello,
We have a resource allocation problem. Could this be solved with
OptaPlanner?
Here it is:
There are N projects located in various places that need work done with
machines (just one machine type for all machine work).
Work can be parallelized, e.g. 6 work days can be done in 6 calendar days
by one machine or in 3 calendar days by two, or in 4 calendar days by 2
machines (one works 4, other 2).
How to best allocate machines to projects?
Looking at planned project work, how many machines are needed for each
calendar day? How many machines should we buy, and how many to rent, and
when?
Details
For each project, the work can & must be done only in some selected
calendar periods.
Machine locations are always known.
Machine costs:
* moving from location A to location B (per km). Moving also takes time,
and a machine can be moved a maximum amount of km per day.
* operating (per day)
* staying in a project location (per day)
* staying in a hangar (per day)
* being rented for one day from location L (total cost = transport from
rent location to project location and back, and daily rent)
* being purchased
A machine also needs an operator, but for now that can be considered a
single unit.
Ideally, also take into accounting weather for each project location.
Weather might be known with 2 weeks in advance. Just re-plan by blocking
the rainy days for some projects?
Thanks,
Scott
10 years, 9 months