Changeset: 41de19d91d28 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41de19d91d28 Modified Files: Branch: sciql Log Message:
Merge with default branch. diffs (truncated from 1165 to 300 lines): diff --git a/clients/python/monetdb/mapi2.py b/clients/python/monetdb/mapi2.py --- a/clients/python/monetdb/mapi2.py +++ b/clients/python/monetdb/mapi2.py @@ -237,7 +237,7 @@ while count > 0: try: recv = self.socket.recv(bytes, flags) - logging.debug("II: package size: %i payload: %s" % (len(recv), recv)) + logger.debug("II: package size: %i payload: %s" % (len(recv), recv)) except socket.error, error: raise OperationalError(error[1]) count -= len(recv) diff --git a/clients/python/monetdb/mapi3.py b/clients/python/monetdb/mapi3.py --- a/clients/python/monetdb/mapi3.py +++ b/clients/python/monetdb/mapi3.py @@ -238,7 +238,7 @@ while count > 0: try: recv = self.socket.recv(bytes, flags) - logging.debug("II: package size: %i payload: %s" % (len(recv), recv)) + logger.debug("II: package size: %i payload: %s" % (len(recv), recv)) except socket.error as error: raise OperationalError(error[1]) count -= len(recv) diff --git a/sql/backends/monet5/datacell/50_datacell.sql b/sql/backends/monet5/datacell/50_datacell.sql --- a/sql/backends/monet5/datacell/50_datacell.sql +++ b/sql/backends/monet5/datacell/50_datacell.sql @@ -41,6 +41,9 @@ create procedure datacell.query(proc string, def string) external name datacell.query; +create procedure datacell.query(proc string) + external name datacell.query; + create procedure datacell.remove (obj string) external name datacell.remove; @@ -66,10 +69,14 @@ returns boolean external name datacell.threshold; -create function datacell.window(bskt string, size integer, slide integer) +create function datacell.window(bskt string, size integer, stride integer) returns boolean external name datacell.window; +create function datacell.window(bskt string, size interval second, stride interval second) +returns boolean + external name datacell.timewindow; + create function datacell.beat(bskt string, t integer) returns boolean external name datacell.beat; @@ -77,10 +84,14 @@ -- Inspection tables create function datacell.baskets() -returns table( nme string, threshold int, winsize int, winslide int, beat int, +returns table( nme string, threshold int, winsize int, winstride int, timeslice int, timestride int, beat int, seen timestamp, grabs int, events int) external name datacell.baskets; create function datacell.queries() returns table( nme string, status string, seen timestamp, cycles int, events int, time bigint, error string, def string) external name datacell.queries; + +create function datacell.errors() +returns table( nme string, error string) +external name datacell.errors; diff --git a/sql/backends/monet5/datacell/Tests/dctemper00.sql b/sql/backends/monet5/datacell/Tests/dctemper00.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/datacell/Tests/dctemper00.sql @@ -0,0 +1,45 @@ +-- Scenario to exercise the datacell implementation +-- using our temperature sensors. +-- they should sent their events to a particular port. +-- a warning is issued if the temperature in any of the +-- rooms fluctuates more then a predefined thresshold within a few minutes/ + +create schema datacell; +set optimizer='datacell_pipe'; + +create table datacell.temperature( + location string, + tag time with time zone, + tmp decimal(3,1) +); + +create table datacell.warnings (msg string, ts time with time zone, location string); +create table datacell.templog( ts timestamp with time zone, cnt integer); + +call datacell.receptor('datacell.temperature','localhost',50550); + +call datacell.emitter('datacell.warnings','localhost',50650); + +create procedure datacell.guardian() +begin + declare flg boolean; + set flg = datacell.window('datacell.temperature',interval '3' second, interval '1' second); + insert into datacell.warnings + select 'WARNING', now(), location from datacell.temperature group by location having avg(tmp) >3; + insert into datacell.templog values (now(), (select count(*) from datacell.temperature)); +end; +call datacell.query('datacell.guardian'); + +call datacell.resume(); +call datacell.dump(); + +-- externally, use the dctemp program +-- externally, use netcat to listen to warnings + + +-- wrapup +call datacell.postlude(); +drop table datacell.temperature; +drop table datacell.tempout; +drop table datacell.templog; + diff --git a/sql/backends/monet5/datacell/Tests/scenario01.sql b/sql/backends/monet5/datacell/Tests/scenario01.sql --- a/sql/backends/monet5/datacell/Tests/scenario01.sql +++ b/sql/backends/monet5/datacell/Tests/scenario01.sql @@ -18,7 +18,7 @@ call datacell.basket('datacell.bsktout'); -- initialize receptor -call datacell.receptor('datacell.bsktin','localhost',50500); +call datacell.receptor('datacell.bsktin','localhost',50501); call datacell.mode('datacell.bsktin','passive'); call datacell.protocol('datacell.bsktin','udp'); call datacell.resume('datacell.bsktin'); @@ -27,7 +27,7 @@ --sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 -- initialize emitter -call datacell.emitter('datacell.bsktout','localhost',50600); +call datacell.emitter('datacell.bsktout','localhost',50601); call datacell.mode('datacell.bsktout','active'); call datacell.protocol('datacell.bsktout','udp'); call datacell.resume('datacell.bsktout'); diff --git a/sql/backends/monet5/datacell/Tests/scenario02.sql b/sql/backends/monet5/datacell/Tests/scenario02.sql --- a/sql/backends/monet5/datacell/Tests/scenario02.sql +++ b/sql/backends/monet5/datacell/Tests/scenario02.sql @@ -12,9 +12,9 @@ ); create table datacell.potout( tag timestamp, cnt integer); -call datacell.receptor('datacell.potin','localhost',50500); +call datacell.receptor('datacell.potin','localhost',50502); -call datacell.emitter('datacell.potout','localhost',50600); +call datacell.emitter('datacell.potout','localhost',50602); call datacell.query('datacell.putter', 'insert into datacell.potout select now(), count(*) from datacell.potin;'); @@ -22,7 +22,7 @@ call datacell.dump(); -- externally, activate the sensor ---sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 +--sensor --host=localhost --port=50502 --events=100 --columns=3 --delay=1 -- externally, activate the actuator server to listen -- actuator diff --git a/sql/backends/monet5/datacell/Tests/scenario03.sql b/sql/backends/monet5/datacell/Tests/scenario03.sql --- a/sql/backends/monet5/datacell/Tests/scenario03.sql +++ b/sql/backends/monet5/datacell/Tests/scenario03.sql @@ -14,9 +14,9 @@ ); create table datacell.bakout( tag timestamp, cnt integer); -call datacell.receptor('datacell.bakin','localhost',50500); +call datacell.receptor('datacell.bakin','localhost',50503); -call datacell.emitter('datacell.bakout','localhost',50600); +call datacell.emitter('datacell.bakout','localhost',50603); call datacell.query('datacell.schep', 'insert into datacell.bakout select now(), count(*) from datacell.bakin where datacell.threshold(\'datacell.bakin\',15);'); @@ -24,7 +24,7 @@ call datacell.dump(); -- externally, activate the sensor ---sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 +--sensor --host=localhost --port=50503 --events=100 --columns=3 --delay=1 -- externally, activate the actuator server to listen -- actuator diff --git a/sql/backends/monet5/datacell/Tests/scenario04.sql b/sql/backends/monet5/datacell/Tests/scenario04.sql --- a/sql/backends/monet5/datacell/Tests/scenario04.sql +++ b/sql/backends/monet5/datacell/Tests/scenario04.sql @@ -13,9 +13,9 @@ ); create table datacell.winout( tag timestamp, mi integer, ma integer, su bigint); -call datacell.receptor('datacell.winin','localhost',50500); +call datacell.receptor('datacell.winin','localhost',50504); -call datacell.emitter('datacell.winout','localhost',50600); +call datacell.emitter('datacell.winout','localhost',50604); call datacell.query('datacell.mavg', 'insert into datacell.winout select now(), min(payload), max(payload), sum(payload) from datacell.winin where datacell.window(\'datacell.winin\',10,1);'); @@ -24,7 +24,7 @@ call datacell.dump(); -- externally, activate the sensor ---sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 +--sensor --host=localhost --port=504444--events=100 --columns=3 --delay=1 -- externally, activate the actuator server to listen -- actuator diff --git a/sql/backends/monet5/datacell/Tests/scenario05.sql b/sql/backends/monet5/datacell/Tests/scenario05.sql --- a/sql/backends/monet5/datacell/Tests/scenario05.sql +++ b/sql/backends/monet5/datacell/Tests/scenario05.sql @@ -13,9 +13,9 @@ ); create table datacell.beatout( tag timestamp, mi integer, ma integer, su bigint); -call datacell.receptor('datacell.beatin','localhost',50500); +call datacell.receptor('datacell.beatin','localhost',50505); -call datacell.emitter('datacell.beatout','localhost',50600); +call datacell.emitter('datacell.beatout','localhost',50605); call datacell.query('datacell.mavgbeat', 'insert into datacell.beatout select now(), min(payload), max(payload), sum(payload) from datacell.beatin where datacell.beat(\'datacell.beatin\',2000) and datacell.window(\'datacell.beatin\',10,1);'); @@ -27,7 +27,7 @@ select * from datacell.queries(); -- externally, activate the sensor ---sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1 +--sensor --host=localhost --port=50505 --events=100 --columns=3 --delay=1 -- externally, activate the actuator server to listen -- actuator diff --git a/sql/backends/monet5/datacell/Tests/scenario06.sql b/sql/backends/monet5/datacell/Tests/scenario06.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/datacell/Tests/scenario06.sql @@ -0,0 +1,41 @@ +-- Scenario to exercise the datacell implementation +-- using a single receptor and emitter +-- use a compound query to deliver the events to both emitter +-- and store aggregated information in a log + +create schema datacell; +set optimizer='datacell_pipe'; + +create table datacell.barrelin( + id integer, + tag timestamp, + payload integer +); +create table datacell.barrelout (like datacell.barrelin); +create table datacell.barrellog( ts timestamp, cnt integer); + +call datacell.receptor('datacell.barrelin','localhost',50506); + +call datacell.emitter('datacell.barrelout','localhost',50606); + +create procedure datacell.splitter() +begin + insert into datacell.barrelout select * from datacell.barrelin; + insert into datacell.barrellog values (now(), (select count(*) from datacell.barrelin)); +end; +call datacell.query('datacell.splitter'); + +call datacell.resume(); +call datacell.dump(); + +-- externally, activate the sensor +--sensor --host=localhost --port=50506 --events=100 --columns=3 --delay=1 +-- externally, activate the actuator server to listen +-- actuator + + +-- wrapup +call datacell.postlude(); +drop table datacell.barrelin; +drop table datacell.barrelout; + diff --git a/sql/backends/monet5/datacell/basket.mx b/sql/backends/monet5/datacell/basket.mx --- a/sql/backends/monet5/datacell/basket.mx +++ b/sql/backends/monet5/datacell/basket.mx @@ -64,6 +64,10 @@ address BSKTwindow comment "Use a window of N event and slide S afterwards"; +command timewindow{unsafe}(tbl:str, N:int, S:int):bit +address BSKTtimewindow +comment "Use a window of N milliseconds and slide S milliseconds afterwards"; + command beat(tbl:str,N:int):bit address BSKTbeat comment "Set an delay to N milliseconds"; @@ -76,6 +80,10 @@ address BSKTtable comment "Inspect the datacell baskets"; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list