[JBoss JIRA] (JBRULES-3288) Sliding time window ignored when using @timestamp and pseudo clock
by Davide Sottara (JIRA)
[ https://issues.jboss.org/browse/JBRULES-3288?page=com.atlassian.jira.plug... ]
Davide Sottara commented on JBRULES-3288:
-----------------------------------------
You're welcome! and I know, sometimes it takes quite some time before tickets are considered.
Reasking questions on the user list also helps :)
In any case, I'm trying to push the team to fix as many bugs as possible for an imminent 5.6 release
> Sliding time window ignored when using @timestamp and pseudo clock
> ------------------------------------------------------------------
>
> Key: JBRULES-3288
> URL: https://issues.jboss.org/browse/JBRULES-3288
> Project: JBRULES
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-core (fusion)
> Affects Versions: 5.3.0.Final
> Environment: Mac OSX 10.6.8
> Reporter: Colin Webber
> Assignee: Edson Tirelli
> Labels: @timestamp, drools, fusion, pseudoclock
>
> When using a custom @timestamp together with PSEUDO clock, all events are accumulated rather than just those within the window:time period. I have tried using long (millisecond) and java.util.Date without success.
> ==================================
> declare SimpleObject
> @role(event)
> @timestamp(customTime)
> @expires(10m)
> end;
> rule "honour custom timestamp"
> when
> $avgVal : Number (longValue > 0) from accumulate ( SimpleObject($valueLng : valueLong ) over window:time (10s) from entry-point "SimpleEP", average ( $valueLng ) )
> then
> System.out.println("avg: " + $avgVal);
> end
> ---------------------------------------
> import java.util.Date;
> public class SimpleObject {
>
> private long customTime;
> public long valueLong;
>
> public SimpleObject(Date customTime, long valueLong) {
> this.customTime = customTime.getTime();
> this.valueLong = valueLong;
> }
>
> public long getCustomTime() {
> return customTime;
> }
> public void setCustomTime(long customTime) {
> this.customTime = customTime;
> }
> public long getValueLong() {
> return valueLong;
> }
> public void setValueLong(long valueLong) {
> this.valueLong = valueLong;
> }
>
> }
> ------------ Trivial Spock/Groovy unit test ----------------
> @IgnoreRest
> def "should honour custom timestamp"() {
> when:
> use (TimeCategory) {
> def now = new Date()
> simpleEp.insert(new SimpleObject(now, 100))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(5.seconds.from.now, 90))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(10.seconds.from.now, 80))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(15.seconds.from.now, 70))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(20.seconds.from.now, 60))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(25.seconds.from.now, 50))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> }
> then:
> 1 == 1 // no assertions - we're examining the stdout.
> }
> ==================================
> OUTPUT (INCORRECT - all values are included for each evalutation):
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> Note that when commenting out the @timestamp tag the output changes to the following (correct) output:
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> avg: 70.0
> avg: 65.0
> avg: 60.0
> avg: 55.0
> avg: 50.0
> Also note that when using the REALTIME clock with Thread.sleep the output is correct.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (JBRULES-3288) Sliding time window ignored when using @timestamp and pseudo clock
by Colin Webber (JIRA)
[ https://issues.jboss.org/browse/JBRULES-3288?page=com.atlassian.jira.plug... ]
Colin Webber commented on JBRULES-3288:
---------------------------------------
Thanks for taking the time to reply Davide - much appreciated. Even a year later your advice is still useful!
> Sliding time window ignored when using @timestamp and pseudo clock
> ------------------------------------------------------------------
>
> Key: JBRULES-3288
> URL: https://issues.jboss.org/browse/JBRULES-3288
> Project: JBRULES
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-core (fusion)
> Affects Versions: 5.3.0.Final
> Environment: Mac OSX 10.6.8
> Reporter: Colin Webber
> Assignee: Edson Tirelli
> Labels: @timestamp, drools, fusion, pseudoclock
>
> When using a custom @timestamp together with PSEUDO clock, all events are accumulated rather than just those within the window:time period. I have tried using long (millisecond) and java.util.Date without success.
> ==================================
> declare SimpleObject
> @role(event)
> @timestamp(customTime)
> @expires(10m)
> end;
> rule "honour custom timestamp"
> when
> $avgVal : Number (longValue > 0) from accumulate ( SimpleObject($valueLng : valueLong ) over window:time (10s) from entry-point "SimpleEP", average ( $valueLng ) )
> then
> System.out.println("avg: " + $avgVal);
> end
> ---------------------------------------
> import java.util.Date;
> public class SimpleObject {
>
> private long customTime;
> public long valueLong;
>
> public SimpleObject(Date customTime, long valueLong) {
> this.customTime = customTime.getTime();
> this.valueLong = valueLong;
> }
>
> public long getCustomTime() {
> return customTime;
> }
> public void setCustomTime(long customTime) {
> this.customTime = customTime;
> }
> public long getValueLong() {
> return valueLong;
> }
> public void setValueLong(long valueLong) {
> this.valueLong = valueLong;
> }
>
> }
> ------------ Trivial Spock/Groovy unit test ----------------
> @IgnoreRest
> def "should honour custom timestamp"() {
> when:
> use (TimeCategory) {
> def now = new Date()
> simpleEp.insert(new SimpleObject(now, 100))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(5.seconds.from.now, 90))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(10.seconds.from.now, 80))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(15.seconds.from.now, 70))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(20.seconds.from.now, 60))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(25.seconds.from.now, 50))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> }
> then:
> 1 == 1 // no assertions - we're examining the stdout.
> }
> ==================================
> OUTPUT (INCORRECT - all values are included for each evalutation):
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> Note that when commenting out the @timestamp tag the output changes to the following (correct) output:
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> avg: 70.0
> avg: 65.0
> avg: 60.0
> avg: 55.0
> avg: 50.0
> Also note that when using the REALTIME clock with Thread.sleep the output is correct.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (JBRULES-3288) Sliding time window ignored when using @timestamp and pseudo clock
by Davide Sottara (JIRA)
[ https://issues.jboss.org/browse/JBRULES-3288?page=com.atlassian.jira.plug... ]
Davide Sottara commented on JBRULES-3288:
-----------------------------------------
This is not a bug.. there is a mismatch between the clock and the timestamps.
now() is based on the system clock and starts from "epoch", the pseudo-clock starts at 0.
You are not seeing the final activations because the engine is waiting to expire the
events, i.e. the pseudo-clock to advance to now()+10...
When you use the realtime clock, instead, the times are aligned as you would expect
> Sliding time window ignored when using @timestamp and pseudo clock
> ------------------------------------------------------------------
>
> Key: JBRULES-3288
> URL: https://issues.jboss.org/browse/JBRULES-3288
> Project: JBRULES
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-core (fusion)
> Affects Versions: 5.3.0.Final
> Environment: Mac OSX 10.6.8
> Reporter: Colin Webber
> Assignee: Edson Tirelli
> Labels: @timestamp, drools, fusion, pseudoclock
>
> When using a custom @timestamp together with PSEUDO clock, all events are accumulated rather than just those within the window:time period. I have tried using long (millisecond) and java.util.Date without success.
> ==================================
> declare SimpleObject
> @role(event)
> @timestamp(customTime)
> @expires(10m)
> end;
> rule "honour custom timestamp"
> when
> $avgVal : Number (longValue > 0) from accumulate ( SimpleObject($valueLng : valueLong ) over window:time (10s) from entry-point "SimpleEP", average ( $valueLng ) )
> then
> System.out.println("avg: " + $avgVal);
> end
> ---------------------------------------
> import java.util.Date;
> public class SimpleObject {
>
> private long customTime;
> public long valueLong;
>
> public SimpleObject(Date customTime, long valueLong) {
> this.customTime = customTime.getTime();
> this.valueLong = valueLong;
> }
>
> public long getCustomTime() {
> return customTime;
> }
> public void setCustomTime(long customTime) {
> this.customTime = customTime;
> }
> public long getValueLong() {
> return valueLong;
> }
> public void setValueLong(long valueLong) {
> this.valueLong = valueLong;
> }
>
> }
> ------------ Trivial Spock/Groovy unit test ----------------
> @IgnoreRest
> def "should honour custom timestamp"() {
> when:
> use (TimeCategory) {
> def now = new Date()
> simpleEp.insert(new SimpleObject(now, 100))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(5.seconds.from.now, 90))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(10.seconds.from.now, 80))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(15.seconds.from.now, 70))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(20.seconds.from.now, 60))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> simpleEp.insert(new SimpleObject(25.seconds.from.now, 50))
> ksession.fireAllRules()
> clock.advanceTime( 5, TimeUnit.SECONDS );
> ksession.fireAllRules()
> }
> then:
> 1 == 1 // no assertions - we're examining the stdout.
> }
> ==================================
> OUTPUT (INCORRECT - all values are included for each evalutation):
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> Note that when commenting out the @timestamp tag the output changes to the following (correct) output:
> avg: 100.0
> avg: 95.0
> avg: 90.0
> avg: 85.0
> avg: 80.0
> avg: 75.0
> avg: 70.0
> avg: 65.0
> avg: 60.0
> avg: 55.0
> avg: 50.0
> Also note that when using the REALTIME clock with Thread.sleep the output is correct.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (JBRULES-3558) Odd rules execution for expired events
by Davide Sottara (JIRA)
[ https://issues.jboss.org/browse/JBRULES-3558?page=com.atlassian.jira.plug... ]
Davide Sottara updated JBRULES-3558:
------------------------------------
Priority: Blocker (was: Major)
> Odd rules execution for expired events
> --------------------------------------
>
> Key: JBRULES-3558
> URL: https://issues.jboss.org/browse/JBRULES-3558
> Project: JBRULES
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-core (fusion)
> Affects Versions: 5.4.0.Final
> Environment: Windows Vista 64, JRE6 (x86)
> Reporter: Karol Sobczak
> Assignee: Mark Proctor
> Priority: Blocker
> Attachments: expiredrules.zip
>
>
> I have declared two types:
> declare Motion
> @role( event )
> @expires( 5s )
> @timestamp( eventTime )
> eventTime : long
> end
> declare Recording
> end
> and following rules:
> rule "StartRecording"
> when
> Motion()
> not Recording()
> then
> insert(new Recording())
> end
> the problem is that when I put a lot of "Motions", sleep (so "Motions" become expired) and then do fireAllRules(), I got "StartRecording" executed multiple times (and not only once), event though "Recording" is inserted every time.
> Another issue would be when instead of "StartRecording" rule I would have "StopRecording" rule:
> rule "StopRecording"
> when
> $m : Motion()
> $r : Recording()
> then
> System.err.println("Recording: " + $r);
> retract($r);
> end
> then when there is a "Recording" fact inserted and multiple expired "Motions", the rule would be executed multiple times (when "Motions" expire) and $r would be null after the first "StopRecording" rule execution.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (WFLY-1292) Eclipse instructions in README.md are obsolete
by Stephen Coy (JIRA)
Stephen Coy created WFLY-1292:
---------------------------------
Summary: Eclipse instructions in README.md are obsolete
Key: WFLY-1292
URL: https://issues.jboss.org/browse/WFLY-1292
Project: WildFly
Issue Type: Patch
Components: Documentation
Affects Versions: 8.0.0.Alpha1
Environment: n/a
Reporter: Stephen Coy
Assignee: Tom Wells
Priority: Minor
The "Using Eclipse" instructions refer to the obsolete Sonatype m2Eclipse plugin, which has been replaced by the Eclipse m2e plugin.
Also, there's no way the WildFly project can be loaded in a 512m heap.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (DROOLS-121) Circular dependencies are not detected in declared types
by Davide Sottara (JIRA)
Davide Sottara created DROOLS-121:
-------------------------------------
Summary: Circular dependencies are not detected in declared types
Key: DROOLS-121
URL: https://issues.jboss.org/browse/DROOLS-121
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 5.5.0.Final
Reporter: Davide Sottara
Assignee: Mark Proctor
Priority: Critical
Fix For: 5.5.1.Final
The following declarations are not recognized as errors and cause a stack overflow exception:
declare Bean extends Bean end
declare Bean1 extends Bean2 end
declare Bean2 extends Bean1 end
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (JBRULES-2258) count in sliding time
by Davide Sottara (JIRA)
[ https://issues.jboss.org/browse/JBRULES-2258?page=com.atlassian.jira.plug... ]
Davide Sottara commented on JBRULES-2258:
-----------------------------------------
By assumption, in stream mode you should not assert "past" and "out-of-order" events.
The events will be expired as soon as you advance the pseudo-clock - even by zero -
but you will still get the initial activation.
> count in sliding time
> ---------------------
>
> Key: JBRULES-2258
> URL: https://issues.jboss.org/browse/JBRULES-2258
> Project: JBRULES
> Issue Type: CTS Challenge
> Security Level: Public(Everyone can see)
> Components: drools-core (fusion)
> Affects Versions: 5.0.1.FINAL
> Environment: Mac os 10.5, Eclipse Galileo, Jboss 5,
> Reporter: Francesco Chiarelli
> Assignee: Edson Tirelli
> Labels: fusion, sliding, stream, windows
> Fix For: 6.0.0.Alpha1
>
>
> I'm trying to use a sliding time fro count a facts with a condition.
> I'have set a stream mode.
> In test, with pseudo clock active, set this to current Time (it's
> correct?), declare a fact type in drl with
> declare MyFact (i've a javabean)
> @role(event)
> @timestamp(myTimestamp)
> end
> attribute type of myTimestamp must be long or Date? I've tried with both
> but nothing, engine count all fact
> ex: n fact in x days ago from now, the statement over window:time(1s)
> result always n fact. why?
> in when:
> // $o : Order(<condition>)
> $nRic : Number(intValue<maxRic) from accumulate($n: Order(this==$o)
> over window:time(1s),count($n))
> ps. if i set a real clock altough a pseudo, in runTime i've a ClassCastExc. to JdkTimerService
> There is a test suite about count?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[JBoss JIRA] (DROOLS-120) Add ability to trait a map
by Davide Sottara (JIRA)
[ https://issues.jboss.org/browse/DROOLS-120?page=com.atlassian.jira.plugin... ]
Davide Sottara moved JBRULES-3701 to DROOLS-120:
------------------------------------------------
Project: Drools (was: JBRULES)
Key: DROOLS-120 (was: JBRULES-3701)
Workflow: GIT Pull Request workflow (was: jira)
Affects Version/s: 5.5.0.Final
(was: 5.5.0.Final)
Component/s: (was: drools-core (expert))
> Add ability to trait a map
> --------------------------
>
> Key: DROOLS-120
> URL: https://issues.jboss.org/browse/DROOLS-120
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Affects Versions: 5.5.0.Final
> Reporter: Ming Fang
> Assignee: Davide Sottara
>
> Add ability to trait a Map as described by Mark Proctor here
> http://drools.46999.n3.nabble.com/rules-users-Maps-as-Object-in-Drools-td...
> <quote>
> //code below is illustrative of what is possible, if changes where mad for above idea.
> // Create interface
> Person
> @Trait
> String : name
> int : age
> end
> // Identify the Map instance, and wrap it with the Person interface.
> rule
> $m : Map[ this['name'] != null, this['age'] != null )
> then
> don( $m : Person.class );
> end
> // Now the map is identified in a type safe manner.
> rule
> Person( name == "darth", age == 150 )
> then
> ….
> end
> </quote>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months