mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 23:10:24 +01:00
+19
-11
@@ -33,20 +33,28 @@ class CmdDataStatus(CmdBase):
|
||||
def __init__(self, settings):
|
||||
super(CmdDataStatus, self).__init__(settings)
|
||||
|
||||
def _show(self, status):
|
||||
for s in status:
|
||||
target, ret = s
|
||||
|
||||
if ret == cloud.STATUS_UNKNOWN or ret == cloud.STATUS_OK:
|
||||
continue
|
||||
|
||||
prefix_map = {
|
||||
cloud.STATUS_DELETED : 'deleted: ',
|
||||
cloud.STATUS_MODIFIED : 'modified:',
|
||||
cloud.STATUS_NEW : 'new file:',
|
||||
}
|
||||
|
||||
Logger.info('\t{}\t{}'.format(prefix_map[ret], target.resolved_cache.dvc))
|
||||
|
||||
def run(self):
|
||||
with DvcLock(self.is_locker, self.git):
|
||||
status = self.cloud.status(self.parsed_args.targets, self.parsed_args.jobs)
|
||||
|
||||
for s in status:
|
||||
target, ret = s
|
||||
if len(status) != len(self.parsed_args.targets):
|
||||
return 1
|
||||
|
||||
if ret == cloud.STATUS_UNKNOWN or ret == cloud.STATUS_OK:
|
||||
continue
|
||||
self._show(status)
|
||||
|
||||
prefix_map = {
|
||||
cloud.STATUS_DELETED : 'deleted: ',
|
||||
cloud.STATUS_MODIFIED : 'modified:',
|
||||
cloud.STATUS_NEW : 'new file:',
|
||||
}
|
||||
|
||||
Logger.info('\t{}\t{}'.format(prefix_map[ret], target.resolved_cache.dvc))
|
||||
return 0
|
||||
|
||||
+14
-3
@@ -6,6 +6,17 @@ import sys
|
||||
from dvc.settings import Settings
|
||||
|
||||
def main():
|
||||
settings = Settings(sys.argv[1:])
|
||||
instance = settings._parsed_args.func(settings)
|
||||
sys.exit(instance.run())
|
||||
try:
|
||||
settings = Settings(sys.argv[1:])
|
||||
instance = settings._parsed_args.func(settings)
|
||||
except Exception as e:
|
||||
Logger.error("Exception caught while parsing settings", exc_info=True)
|
||||
return 255
|
||||
|
||||
try:
|
||||
ret = instance.run()
|
||||
except Exception as e:
|
||||
Logger.error("Exception caught in " + instance.__class__.__name__, exc_info=True)
|
||||
return 254
|
||||
|
||||
return ret
|
||||
|
||||
@@ -66,6 +66,7 @@ def map_progress(func, targets, n_threads):
|
||||
"""
|
||||
progress.set_n_total(len(targets))
|
||||
p = ThreadPool(processes=n_threads)
|
||||
ret = []
|
||||
|
||||
try:
|
||||
ret = p.map(func, targets)
|
||||
|
||||
Reference in New Issue
Block a user