Files
dvc/dvc/command/data_sync.py
T
Mr. Outis 4c420d5f4d logger [rfc]: Use a module instead of a class
- Remove deprecation warnings
- Format error output and remove duplicated info

Close #1086
2018-12-23 21:06:39 -06:00

67 lines
2.2 KiB
Python

from dvc.command.base import CmdBase
import dvc.logger as logger
class CmdDataBase(CmdBase):
def do_run(self, target):
pass
def run(self):
if not self.args.targets:
return self.do_run()
ret = 0
for target in self.args.targets:
if self.do_run(target):
ret = 1
return ret
class CmdDataPull(CmdDataBase):
def do_run(self, target=None):
try:
self.project.pull(target=target,
jobs=self.args.jobs,
remote=self.args.remote,
show_checksums=self.args.show_checksums,
all_branches=self.args.all_branches,
all_tags=self.args.all_tags,
with_deps=self.args.with_deps,
force=self.args.force)
except Exception:
logger.error('failed to pull data from the cloud')
return 1
return 0
class CmdDataPush(CmdDataBase):
def do_run(self, target=None):
try:
self.project.push(target=target,
jobs=self.args.jobs,
remote=self.args.remote,
show_checksums=self.args.show_checksums,
all_branches=self.args.all_branches,
all_tags=self.args.all_tags,
with_deps=self.args.with_deps)
except Exception:
logger.error('failed to push data to the cloud')
return 1
return 0
class CmdDataFetch(CmdDataBase):
def do_run(self, target=None):
try:
self.project.fetch(target=target,
jobs=self.args.jobs,
remote=self.args.remote,
show_checksums=self.args.show_checksums,
all_branches=self.args.all_branches,
all_tags=self.args.all_tags,
with_deps=self.args.with_deps)
except Exception:
logger.error('failed to fetch data from the cloud')
return 1
return 0