dvc: fix misc dvc stuff

Please don't merge pull requests that don't pass our checks.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-11-26 13:42:47 +02:00
parent 10c9449d32
commit be159e7798
4 changed files with 23 additions and 27 deletions
+6 -7
View File
@@ -1,6 +1,6 @@
import os
from dvc.command.base import CmdBase, DvcLock
from dvc.command.common.base import CmdBase
from dvc.logger import Logger
from dvc.state_file import StateFile
from dvc.command.run import CommandFile
@@ -49,9 +49,8 @@ class CmdAdd(CmdBase):
Logger.debug('State file "{}" was created'.format(data_item.state.relative))
def run(self):
with DvcLock(self.is_locker, self.git):
targets = self.collect_targets(self.parsed_args.input)
self.add_files(targets)
self.create_state_files(targets)
msg = 'DVC add: {}'.format(str(self.parsed_args.input))
self.commit_if_needed(msg)
targets = self.collect_targets(self.parsed_args.input)
self.add_files(targets)
self.create_state_files(targets)
msg = 'DVC add: {}'.format(str(self.parsed_args.input))
self.commit_if_needed(msg)
-1
View File
@@ -1,7 +1,6 @@
import os
import copy
from dvc.command.base import DvcLock
from dvc.command.run import CmdRun, CommandFile
from dvc.logger import Logger
from dvc.exceptions import DvcException
+8 -10
View File
@@ -70,17 +70,15 @@ class CmdRun(CmdBase):
super(CmdRun, self).__init__(settings)
def run(self):
with DvcLock(self.is_locker, self.git):
cmd = ' '.join(self.parsed_args.command)
try:
command = CommandFile.load(cmd)
#FIXME OLOLO don't forget to overwrite with cmdline args
except Exception as exc:
Logger.debug("Failed to load {}: {}".format(cmd, str(exc)))
command = CommandFile(cmd, self.parsed_args.out, self.parsed_args.deps, self.parsed_args.lock, None)
cmd = ' '.join(self.parsed_args.command)
try:
command = CommandFile.load(cmd)
except Exception as exc:
Logger.debug("Failed to load {}: {}".format(cmd, str(exc)))
command = CommandFile(cmd, self.parsed_args.out, self.parsed_args.deps, self.parsed_args.lock, None)
self.run_command(self.settings, command)
return self.commit_if_needed('DVC run: {}'.format(command.cmd))
self.run_command(self.settings, command)
return self.commit_if_needed('DVC run: {}'.format(command.cmd))
@staticmethod
def run_command(settings, command):
+9 -9
View File
@@ -35,15 +35,15 @@ class ConfigI(object):
self._cloud = cloud
self._conf_parser = conf_parser
# @classmethod
# def CACHE_DIR(self):
# """ Directory with cached data files """
# return os.path.join(self.CONFIG_DIR, self.CACHE_DIR_NAME)
#
# @classmethod
# def STATE_DIR(self):
# """ Directory with state files """
# return os.path.join(self.CONFIG_DIR, self.STATE_DIR_NAME)
@property
def cache_dir(self):
""" Directory with cached data files """
return self.CACHE_DIR
@property
def state_dir(self):
""" Directory with state files """
return self.STATE_DIR
@property
def cloud(self):