Browse Source

Allow binary extract

tags/nilmdb-1.6.0
Jim Paris 10 years ago
parent
commit
6d14e0b8aa
2 changed files with 26 additions and 1 deletions
  1. +17
    -0
      docs/design.md
  2. +9
    -1
      nilmdb/cmdline/extract.py

+ 17
- 0
docs/design.md View File

@@ -421,3 +421,20 @@ and has all of the same functions. It adds three new functions:
It is significantly faster! It is about 20 times faster to decimate a
stream with `nilm-decimate` when the filter code is using the new
binary/numpy interface.


WSGI interface & chunked requests
---------------------------------

mod_wsgi requires "WSGIChunkedRequest On" to handle
"Transfer-encoding: Chunked" requests. However, `/stream/insert`
doesn't handle this correctly right now, because:

- The `cherrpy.request.body.read()` call needs to be fixed for chunked requests

- We don't want to just buffer endlessly in the server, and it will
require some thought on how to handle data in chunks (what to do about
interval endpoints).

It is probably better to just keep the endpoint management on the client
side, so leave "WSGIChunkedRequest off" for now.

+ 9
- 1
nilmdb/cmdline/extract.py View File

@@ -24,6 +24,8 @@ def setup(self, sub):
).completer = self.complete.time

group = cmd.add_argument_group("Output format")
group.add_argument("-B", "--binary", action="store_true",
help="Raw binary output")
group.add_argument("-b", "--bare", action="store_true",
help="Exclude timestamps from output lines")
group.add_argument("-a", "--annotate", action="store_true",
@@ -42,6 +44,11 @@ def cmd_extract_verify(self):
if self.args.start > self.args.end:
self.parser.error("start is after end")

if self.args.binary:
if (self.args.bare or self.args.annotate or self.args.markup or
self.args.timestamp_raw or self.args.count):
self.parser.error("--binary cannot be combined with other options")

def cmd_extract(self):
streams = self.client.stream_list(self.args.path)
if len(streams) != 1:
@@ -64,7 +71,8 @@ def cmd_extract(self):
self.args.start,
self.args.end,
self.args.count,
self.args.markup):
self.args.markup,
self.args.binary):
if self.args.bare and not self.args.count:
# Strip timestamp (first element). Doesn't make sense
# if we are only returning a count.


Loading…
Cancel
Save