mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 23:10:15 +01:00
Merge pull request #379 from dataversioncontrol/after_redisign_misc_3
After redesign misc 3
This commit is contained in:
+19
-6
@@ -8,6 +8,7 @@ from dvc.data_cloud import file_md5
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.executor import Executor
|
||||
|
||||
|
||||
class OutputError(DvcException):
|
||||
def __init__(self, path, msg):
|
||||
super(OutputError, self).__init__('Output file \'{}\' error: {}'.format(path, msg))
|
||||
@@ -177,6 +178,16 @@ class Output(object):
|
||||
return stage
|
||||
return None
|
||||
|
||||
def remove(self):
|
||||
if not os.path.exists(self.path):
|
||||
return
|
||||
|
||||
self.project.logger.debug("Removing '{}'".format(self.path))
|
||||
os.chmod(self.path, stat.S_IWUSR)
|
||||
os.unlink(self.path)
|
||||
if os.path.exists(self.cache):
|
||||
os.chmod(self.cache, stat.S_IREAD)
|
||||
|
||||
|
||||
class Dependency(Output):
|
||||
pass
|
||||
@@ -200,6 +211,10 @@ class Stage(object):
|
||||
self.deps = deps
|
||||
self.locked = locked
|
||||
|
||||
@property
|
||||
def relpath(self):
|
||||
return os.path.relpath(self.path, '.')
|
||||
|
||||
@staticmethod
|
||||
def is_stage_file(path):
|
||||
if not os.path.isfile(path):
|
||||
@@ -219,11 +234,7 @@ class Stage(object):
|
||||
|
||||
def remove_outs(self):
|
||||
for out in self.outs:
|
||||
if os.path.exists(out.path):
|
||||
self.project.logger.debug("Removing '{}'".format(out.path))
|
||||
os.chmod(out.path, stat.S_IWUSR)
|
||||
os.unlink(out.path)
|
||||
os.chmod(out.cache, stat.S_IREAD)
|
||||
out.remove()
|
||||
|
||||
def remove(self):
|
||||
self.remove_outs()
|
||||
@@ -236,8 +247,10 @@ class Stage(object):
|
||||
if self.cmd:
|
||||
# Removing outputs only if we actually have command to reproduce
|
||||
self.remove_outs()
|
||||
|
||||
self.project.logger.info("Reproducing {}:\n\t{}".format(self.relpath, self.cmd))
|
||||
self.run()
|
||||
self.project.logger.debug("{} reproduced".format(self.path))
|
||||
self.project.logger.debug("{} was reproduced".format(self.relpath))
|
||||
|
||||
@staticmethod
|
||||
def loadd(project, d, path):
|
||||
|
||||
Reference in New Issue
Block a user