Browse Source

Add --skip option to nilm-insert

tags/nilmtools-1.4.3^0
Jim Paris 8 years ago
parent
commit
a4d4bc22fc
2 changed files with 10 additions and 3 deletions
  1. +2
    -2
      Makefile
  2. +8
    -1
      nilmtools/insert.py

+ 2
- 2
Makefile View File

@@ -8,7 +8,7 @@ else
@echo "Try 'make install'"
endif

test: test_pipewatch
test: test_insert

test_pipewatch:
nilmtools/pipewatch.py -t 3 "seq 10 20" "seq 20 30"
@@ -27,7 +27,7 @@ test_cleanup:
nilmtools/cleanup.py extras/cleanup.cfg

test_insert:
nilmtools/insert.py --file --dry-run /test/foo </dev/null
nilmtools/insert.py --skip --file --dry-run /foo/bar ~/data/20130311T2100.prep1.gz ~/data/20130311T2100.prep1.gz ~/data/20130311T2200.prep1.gz

test_copy:
nilmtools/copy_wildcard.py -U "http://nilmdb.com/bucket/" -D /lees*


+ 8
- 1
nilmtools/insert.py View File

@@ -53,7 +53,8 @@ def parse_args(argv = None):
is stepped forward to match 'clock'.

- If 'data' is running ahead, there is overlap in the data, and an
error is raised.
error is raised. If '--ignore' is specified, the current file
is skipped instead of raising an error.
"""))
parser.add_argument("-u", "--url", action="store",
default="http://localhost/nilmdb/",
@@ -61,6 +62,8 @@ def parse_args(argv = None):
group = parser.add_argument_group("Misc options")
group.add_argument("-D", "--dry-run", action="store_true",
help="Parse files, but don't insert any data")
group.add_argument("-s", "--skip", action="store_true",
help="Skip files if the data would overlap")
group.add_argument("-m", "--max-gap", action="store", default=10.0,
metavar="SEC", type=float,
help="Max discrepency between clock and data "
@@ -235,6 +238,10 @@ def main(argv = None):
"is %s but clock time is only %s",
timestamp_to_human(data_ts),
timestamp_to_human(clock_ts))
if args.skip:
printf("%s\n", err)
printf("Skipping the remainder of this file\n")
break
raise ParseError(filename, err)

if (data_ts + max_gap) < clock_ts:


Loading…
Cancel
Save