simple_dvc.registery module

The port of the DVC regsitery from geowatch.

CommandLine

sdvc registery list --hardware=ssd --tags=phase2_data
sdvc registery list --hardware=hdd --tags=phase2_data
sdvc registery list --hardware=auto --tags=phase2_data
class simple_dvc.registery.DataRegistry(registry_fpath=None)[source]

Bases: object

Provide a quick way of storing and querying for machine specific paths

Example

>>> from simple_dvc.registery import *  # NOQA
>>> self = DataRegistry()
>>> self.read()
>>> test_dpath = ub.Path.appdir('sdvc/tests/dvc_registry').ensuredir()
>>> repo1 = (test_dpath / 'repo1').ensuredir()
>>> repo2 = (test_dpath / 'repo2').ensuredir()
>>> repo_hdd2 = (test_dpath / 'repo2-hdd').ensuredir()
>>> repo_ssd2 = (test_dpath / 'repo2-ssd').ensuredir()
>>> repo_ffs2 = (test_dpath / 'repo2-ffs').ensuredir()
>>> #
>>> self.add('repo1', path=repo1, tags='data_phase1')
>>> self.add('repo2', path=repo2, tags='expt_phase1')
>>> self.add('repo_hdd2', path=repo_hdd2, hardware='hdd', tags='expt_phase1')
>>> self.add('repo_ffs2', path=repo_ffs2, hardware='ffs', tags='expt_phase1', priority=10)
>>> self.add('repo_ssd2', path=repo_ssd2, hardware='ssd', tags='expt_phase1')
>>> print(self.pandas())
>>> print(ub.urepr(self.read()))
>>> self.query(tags='expt_phase1')
>>> self.query()
pandas(**kwargs)[source]
list(**kwargs)[source]
_open()[source]
add(name, path, **kwargs)[source]
set(name, path=None, **kwargs)[source]

Set an attribute of a row

remove(name)[source]
read()[source]
query(must_exist=False, **kwargs)[source]
find(on_error='raise', envvar=None, **kwargs)[source]
simple_dvc.registery.find_dvc_dpath(name=NoParam, on_error='raise', **kwargs)[source]

Return the location of the GEOWATCH DVC Data path if it exists and is in a “standard” location.

NOTE: other team members can add their “standard” locations if they want.

SeeAlso:

sdvc WATCH_DATA_DPATH=$(geowatch_dvc)

python -m watch.cli.find_dvc –hardware=hdd python -m watch.cli.find_dvc –hardware=ssd

class simple_dvc.registery.CommonRegistryConfig(*args, **kwargs)[source]

Bases: DataConfig

Common CLI arguments for dvc registery.

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

default = {'hardware': <Value(None)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}
class simple_dvc.registery.DVC_RegisteryCLI(description='', sub_clis=None, version=None)[source]

Bases: ModalCLI

Command line helper to find the path to the watch DVC repo

CommandLine

# List currently known directories
sdvc registery list

# Add a new path (with optional hardware and tags)
mkdir -p $HOME/tmp/datadir
sdvc registery add --name=testdir --path=$HOME/tmp/datadir --hardware=hdd --tags=mytag

# Lookup the newly registered path
sdvc registery find --tags mytag

# Remove the test entry
sdvc registery remove testdir

Example

class Add(*args, **kwargs)[source]

Bases: CommonRegistryConfig

Register a new path (or overwrite / update an existing one)

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

classmethod main(cmdline=1, **kwargs)[source]
default = {'hardware': <Value(None)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}
class List(*args, **kwargs)[source]

Bases: CommonRegistryConfig

List registered paths

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

classmethod main(cmdline=1, **kwargs)[source]
default = {'hardware': <Value(None)>, 'must_exist': <Value(False)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}
class Remove(*args, **kwargs)[source]

Bases: CommonRegistryConfig

Remove a registered path

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

classmethod main(cmdline=1, **kwargs)[source]
default = {'hardware': <Value(None)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}
class Set(*args, **kwargs)[source]

Bases: CommonRegistryConfig

Set properties of a registered path

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

classmethod main(cmdline=1, **kwargs)[source]
default = {'hardware': <Value(None)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}
class Find(*args, **kwargs)[source]

Bases: CommonRegistryConfig

Search for a path registered via sdvc registry add

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

classmethod main(cmdline=1, **kwargs)[source]
default = {'hardware': <Value(None)>, 'must_exist': <Value(True)>, 'name': <Value(None)>, 'path': <Value(None)>, 'priority': <Value(None)>, 'tags': <Value(None)>}