Commit Graph

497 Commits

Author SHA1 Message Date
b4a0288a39 work on command line
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10673 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-04-03 18:01:56 +00:00
e63ab23d20 stream_insert puts data into the database now. Fill out tests to
cover overlapping data, missing data, etc.

Consolidate nilmdb.client.MyCurl.getjson() and putjson().

Add __str__ for more compact representation of IntervalSet

Make stream_id not NULL in SQL database.

Format NilmDBError with name of exception for more clarity

Work around CherryPy issue 1138 by removing HTML escaping before
returning JSON error responses from the server.

Reached 100% test coverage again (woohoo)



git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10665 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-31 04:15:29 +00:00
776279a4e6 Go back to generic parsing for most stuff now. Need to rework what's
most efficient here.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10664 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-30 22:15:04 +00:00
7a9012c3e9 work on improving layout parsing
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10663 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-30 21:29:22 +00:00
8c619cfde5 Minor cleanups
Remove nilmdb.layout.filltable


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10662 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-29 21:44:57 +00:00
cc4e3bdb76 Rename some nilmdb methods to be private
More work with nilmdb.stream_insert.  Checks for overlap between
parser output and database intervals, and actually inserts the
data into pytables.  Need to benchmark/figure out whether we can
use table.append rather than the row.append() nonsense -- it could
simplify things quite a bit.

Improve layout class and add tests to get more coverage.  Better
error handling on invalid inputs (reports the reason for the error)

Replace layout.fillrow with layout.filltable, but turns out that we
can probably just remove it anyway.

Add nilmdb.Timer for simple timing tests

Move some duplicated test suite helper functions into a new file,
test_helper.py

Add class to test_interval.py to match the others


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10661 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-29 21:43:05 +00:00
3dfd187710 Use instantiated classes for layouts.
Change expected_daily_rows into rate_hz just for simplicity

nilmdb.layout.Parser now validates that timestamps are monotonically
increasing, and remembers the min and max seen.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10660 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-29 16:46:34 +00:00
cf66eca42c Spent time trying to get Intervals and IntervalSets to handle a gap
tolerance in equality comparisions, but it's a real pain to get all
the edge cases right, and it's not clear we actually need that
functionality at the moment.  Skip it for now.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10659 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-28 19:25:02 +00:00
1046d0c47b more tests
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10657 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-28 00:22:44 +00:00
d940aabf66 Incomplete, need to finish interval/intervalset tests
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10656 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-27 23:19:08 +00:00
e1bf680d13 pass data to server
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10655 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 22:28:33 +00:00
18720db594 Remove outdated chunk tests. Again, serves as a good example if we
need chunked streaming uploads in the future, but probably not
necessary right now.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10654 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:36:27 +00:00
19c70bf887 Remove the cherrypy ChunkedRFile fixup, and the disable_prb tool that
disables process_request_body.  They'll be necessary if we want to
support streaming chunked uploads, but at this point it doesn't seem
like that's going to be necessary.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10653 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:35:33 +00:00
a672119dd0 Minor cleanups for test passage
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10652 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:31:37 +00:00
f721e41f2b Minor cleanups for test passage
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10651 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:31:35 +00:00
853639f390 better error code for curl-generated problems
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10650 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:29:04 +00:00
ba11e4467f Parsing happens before serialization on server... now need to put in database
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10649 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 21:23:58 +00:00
17073905f7 Working on data parsing...
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10648 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 19:54:04 +00:00
3b696e2a03 rework errors
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10647 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 18:06:15 +00:00
dd5658f987 Better handling on server side -- insert now reads the body.
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10646 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-26 16:47:11 +00:00
54847b0710 Upload the data in the POST. Client side should be mostly good, for now
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10645 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-25 19:12:49 +00:00
b72e276eb8 More timestamper tests.
Add "end" parameter to TimestamperRate, to force the file to end
before a specific time.  Will be good for loading in old files and
knowing that things don't overlap.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10644 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-24 21:15:24 +00:00
0808ed5bd8 Add datetime_tz module from python-datetime-tz repository. This could
go away if it gets packaged in Debian etc.

Add nilmdb.timestamper classes

Start test_timestamper (needs work)

Number the functions in test_client so they run in the right order to
leave the database in a good state.

Fix some brokenness with module importing and namespaces



git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10643 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-24 17:32:11 +00:00
ec25eac697 Misc cleanups, fix some pylint issues
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10642 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-23 15:50:33 +00:00
09340d543d Add some test prep data
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10641 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-23 14:56:52 +00:00
913883be3a Fix slow database stuff in testing by setting PRAGMA synchronous=OFF. Default is still FULL for production use, though
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10639 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-22 22:06:08 +00:00
8cc1dff0b8 Cleanup
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10637 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-22 21:00:01 +00:00
5b2d52b8bc Big rework of how errors are handled and propagated to the HTTP
response.  Now everything (status code, message, possibly tracebacks)
are passed to the client as JSON, so the client can display correct errors.
Nice!


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10630 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-22 00:14:13 +00:00
22ef82b59c More work on client tests
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10625 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-21 16:28:51 +00:00
a235c94c02 More work towards filling out the client...
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10624 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 22:21:16 +00:00
795d2ac7cf ignore
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10623 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 21:46:37 +00:00
1c4efb92c6 rename command line client nilmdb.py to nilmtool.py
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10622 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 21:46:18 +00:00
56a1770f45 client tests
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10611 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 14:26:29 +00:00
b766aef257 new client py
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10610 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 14:22:02 +00:00
3e5d0ef87d rename
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10609 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 14:21:55 +00:00
a26468c059 Rename client -> cmdline
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10608 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 14:19:45 +00:00
0099a41fd8 Work on a client implementation that can survive testing
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10604 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-20 01:18:30 +00:00
b1baacf272 cleanup
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10600 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-19 21:36:24 +00:00
8afaf8f329 Improve insert strutcure
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10562 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-14 20:29:30 +00:00
610860c379 Update
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10556 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-13 22:12:30 +00:00
c076af64af for reference
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10548 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-12 20:19:32 +00:00
d0435cbf91 for reference
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10547 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-12 20:19:29 +00:00
ace199ffa8 Working client-side pycurl code to send a streaming chunked PUT.
Working server-side cherrypy code to receive a streaming chunked PUT.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10546 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-03-12 20:09:17 +00:00
5b89fa7ccf Fix style
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10446 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-21 21:30:53 +00:00
d8929467eb Cleanup
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10445 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-20 06:13:54 +00:00
ba66668fff playing with coverage a bit
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10444 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-20 06:09:42 +00:00
1e1c7fa9c4 Create StreamException class in NilmDB, which can get caught and
handled by the HTTP server.

Add /stream/get_metadata HTTP request.

Fill out test_stream_metadata

Add runserver.py script to just run the server from the command line,
outside of the testing environment.  Add necessary hooks within
nilmdb/server.py to allow this to happen.

Metadata operations get stream_id first and report error on missing
stream, instead of returning an empty dict.


git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10443 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-20 05:52:33 +00:00
9b64a18daf Remove nilmdbsql; move functions into nilmdb.py instead
TODO                |    2 
 nilmdb/__init__.py  |    1 
 nilmdb/nilmdb.py    |  113 +++++++++++++++++++++++++++++++++++++++++-----
 nilmdb/nilmdbsql.py |  126 ----------------------------------------------------
 4 files changed, 102 insertions(+), 140 deletions(-)



git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10428 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-17 20:42:08 +00:00
398d382dac Stuff goes into the SQL database now.
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10427 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-17 00:32:36 +00:00
53e3c44186 Move schema updates to a dict
git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10421 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2012-02-15 23:11:37 +00:00