Compare commits
3 Commits
nilmtools-
...
nilmtools-
Author | SHA1 | Date | |
---|---|---|---|
fd1b33401f | |||
4c748ec00c | |||
b72d6b6908 |
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ test: test_cleanup
|
||||
|
||||
test_cleanup:
|
||||
src/cleanup.py -e extras/cleanup.cfg
|
||||
src/cleanup.py -D extras/cleanup.cfg
|
||||
src/cleanup.py extras/cleanup.cfg
|
||||
|
||||
test_insert:
|
||||
@make install >/dev/null
|
||||
|
@@ -19,7 +19,7 @@ def warn(msg, *args):
|
||||
fprintf(sys.stderr, "warning: " + msg + "\n", *args)
|
||||
|
||||
class TimePeriod(object):
|
||||
_units = { 'h': ('hour', 60*60*24),
|
||||
_units = { 'h': ('hour', 60*60),
|
||||
'd': ('day', 60*60*24),
|
||||
'w': ('week', 60*60*24*7),
|
||||
'm': ('month', 60*60*24*30),
|
||||
@@ -96,9 +96,9 @@ def main(argv = None):
|
||||
parser.add_argument("-u", "--url", action="store",
|
||||
default="http://localhost/nilmdb/",
|
||||
help="NilmDB server URL (default: %(default)s)")
|
||||
parser.add_argument("-D", "--dry-run", action="store_true",
|
||||
parser.add_argument("-y", "--yes", action="store_true",
|
||||
default = False,
|
||||
help="Don't actually remove any data")
|
||||
help="Actually remove the data (default: no)")
|
||||
parser.add_argument("-e", "--estimate", action="store_true",
|
||||
default = False,
|
||||
help="Estimate how much disk space will be used")
|
||||
@@ -228,7 +228,7 @@ def main(argv = None):
|
||||
keep = seconds_to_timestamp(streams[path].keep.seconds())
|
||||
for i in intervals:
|
||||
total += i.end - i.start
|
||||
if total < keep:
|
||||
if total <= keep:
|
||||
continue
|
||||
remove_before = i.start + (total - keep)
|
||||
break
|
||||
@@ -238,14 +238,16 @@ def main(argv = None):
|
||||
timestamp_to_seconds(total)))
|
||||
continue
|
||||
printf(" removing data before %s\n", timestamp_to_human(remove_before))
|
||||
if not args.dry_run:
|
||||
if args.yes:
|
||||
client.stream_remove(path, None, remove_before)
|
||||
for ap in streams[path].also_clean_paths:
|
||||
printf(" also removing from %s\n", ap)
|
||||
if not args.dry_run:
|
||||
if args.yes:
|
||||
client.stream_remove(ap, None, remove_before)
|
||||
|
||||
# All done
|
||||
if not args.yes:
|
||||
printf("Note: specify --yes to actually perform removals\n")
|
||||
return
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@@ -46,6 +46,10 @@ def main(argv = None):
|
||||
print " nilmtool -u %s create %s %s" % (e.dest.url, e.dest.path, rec)
|
||||
raise SystemExit(1)
|
||||
|
||||
if f.dest.layout_count != args.nharm * 2:
|
||||
print "error: need", args.nharm*2, "columns in destination stream"
|
||||
raise SystemExit(1)
|
||||
|
||||
# Check arguments
|
||||
if args.column is None or args.column < 1:
|
||||
parser.error("need a column number >= 1")
|
||||
|
Reference in New Issue
Block a user