Skip to content

Commit

Permalink
Fix passing of tub metadata (#1017)
Browse files Browse the repository at this point in the history
* According to the docopt string, the complete template should allow to a read tub metadata as --meta=foo:bar --meta=baz:44, but it doesn't. This change fixes it.

* Bump version

* Move tub metadata parsing into Manifest and allow merging of metadata between command line and config METADATA
  • Loading branch information
DocGarbanzo authored Jun 23, 2022
1 parent 9ac86d4 commit 5143794
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions donkeycar/parts/datastore_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
import mmap
import os
import time
import logging
from pathlib import Path

logger = logging.getLogger(__name__)


NEWLINE = '\n'
NEWLINE_STRIP = '\r\n'
Expand Down Expand Up @@ -317,8 +320,13 @@ def _add_catalog(self):

def _read_metadata(self, metadata=[]):
self.metadata = dict()
for (key, value) in metadata:
self.metadata[key] = value
for kv in metadata:
kvs = kv.split(":")
if len(kvs) == 2:
self.metadata[kvs[0]] = kvs[1]
else:
logger.error(f'Metadata item needs to be a key value pair of '
f'format key:value, ignore entry {kv}')

def _read_contents(self):
self.seekeable.seek_line_start(1)
Expand Down
1 change: 1 addition & 0 deletions donkeycar/templates/complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ def run(self, mode, recording):
# do we want to store new records into own dir or append to existing
tub_path = TubHandler(path=cfg.DATA_PATH).create_tub_path() if \
cfg.AUTO_CREATE_NEW_TUB else cfg.DATA_PATH
meta += getattr(cfg, 'METADATA', [])
tub_writer = TubWriter(tub_path, inputs=inputs, types=types, metadata=meta)
V.add(tub_writer, inputs=inputs, outputs=["tub/num_records"], run_condition='recording')

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def package_files(directory, strip_leading):
long_description = fh.read()

setup(name='donkeycar',
version="4.3.17",
version="4.3.18",
long_description=long_description,
description='Self driving library for python.',
url='https://github.com/autorope/donkeycar',
Expand Down

0 comments on commit 5143794

Please sign in to comment.