mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: move CmdDataStatus to a separate file
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+2
-1
@@ -10,7 +10,8 @@ from dvc.command.init import CmdInit
|
||||
from dvc.command.remove import CmdRemove
|
||||
from dvc.command.run import CmdRun
|
||||
from dvc.command.repro import CmdRepro
|
||||
from dvc.command.data_sync import CmdDataPush, CmdDataPull, CmdDataStatus, CmdDataFetch
|
||||
from dvc.command.data_sync import CmdDataPush, CmdDataPull, CmdDataFetch
|
||||
from dvc.command.status import CmdDataStatus
|
||||
from dvc.command.gc import CmdGC
|
||||
from dvc.command.add import CmdAdd
|
||||
from dvc.command.config import CmdConfig
|
||||
|
||||
@@ -48,31 +48,3 @@ class CmdDataFetch(CmdDataBase):
|
||||
self.project.logger.error('Failed to fetch data from the cloud', exc)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
class CmdDataStatus(CmdDataBase):
|
||||
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:',
|
||||
}
|
||||
|
||||
path = os.path.relpath(target, self.project.cache.cache_dir)
|
||||
|
||||
self.project.logger.info('\t{}\t{}'.format(prefix_map[ret], path))
|
||||
|
||||
def do_run(self, target=None):
|
||||
try:
|
||||
status = self.project.status(target=target, jobs=self.args.jobs)
|
||||
self._show(status)
|
||||
except Exception as exc:
|
||||
self.project.logger.error('Failed to obtain data status', exc)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
|
||||
import dvc.cloud.base as cloud
|
||||
|
||||
from dvc.command.data_sync import CmdDataBase
|
||||
|
||||
|
||||
class CmdDataStatus(CmdDataBase):
|
||||
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:',
|
||||
}
|
||||
|
||||
path = os.path.relpath(target, self.project.cache.cache_dir)
|
||||
|
||||
self.project.logger.info('\t{}\t{}'.format(prefix_map[ret], path))
|
||||
|
||||
def do_run(self, target=None):
|
||||
try:
|
||||
status = self.project.status(target=target, jobs=self.args.jobs)
|
||||
self._show(status)
|
||||
except Exception as exc:
|
||||
self.project.logger.error('Failed to obtain data status', exc)
|
||||
return 1
|
||||
return 0
|
||||
+2
-1
@@ -3,7 +3,8 @@ import os
|
||||
from dvc.cli import parse_args
|
||||
from dvc.command.init import CmdInit
|
||||
from dvc.command.run import CmdRun
|
||||
from dvc.command.data_sync import CmdDataPull, CmdDataPush, CmdDataStatus
|
||||
from dvc.command.data_sync import CmdDataPull, CmdDataPush
|
||||
from dvc.command.status import CmdDataStatus
|
||||
from dvc.command.repro import CmdRepro
|
||||
from dvc.command.add import CmdAdd
|
||||
from dvc.command.remove import CmdRemove
|
||||
|
||||
Reference in New Issue
Block a user