mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 23:09:21 +01:00
Merge pull request #202 from efiop/master
pull: create dirs before pulling
This commit is contained in:
+1
-2
@@ -148,7 +148,7 @@ class DataCloudBase(object):
|
||||
def pull(self, item):
|
||||
fname = item.resolved_cache.dvc
|
||||
key_name = self.cache_file_key(fname)
|
||||
|
||||
self.create_directory(item)
|
||||
return self._import(self.storage_bucket, key_name, fname, item)
|
||||
|
||||
def import_data(self, url, item):
|
||||
@@ -162,7 +162,6 @@ class DataCloudBase(object):
|
||||
if os.path.isfile(item.resolved_cache.dvc):
|
||||
return self.push(item)
|
||||
else:
|
||||
self.create_directory(item)
|
||||
return self.pull(item)
|
||||
|
||||
def create_directory(self, item):
|
||||
|
||||
@@ -9,8 +9,7 @@ dvc_create_repo
|
||||
mkdir data/tsv
|
||||
|
||||
dvc_info 'Convert Budget.xml to tsv'
|
||||
pip2 install xmltodict
|
||||
dvc run --code code/xmltotsv.py python2 code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv
|
||||
dvc run --code code/xmltotsv.py python code/xmltotsv.py --extract row/@Id,row/@UserId,row/@Name,row/@Class,row/@TagBased,row/@Date data/xml/Badges.xml data/tsv/Badges.tsv
|
||||
|
||||
dvc_info 'Modify code'
|
||||
echo " " >> code/xmltotsv.py
|
||||
|
||||
@@ -33,6 +33,15 @@ if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_SECURE_ENV_VARS" == "true" ]
|
||||
dvc_info "Checking status"
|
||||
dvc status data/xml
|
||||
|
||||
dvc_info "Removing all cache"
|
||||
rm -rf .cache/xml
|
||||
|
||||
dvc_info "Checking status"
|
||||
dvc status data/xml
|
||||
|
||||
dvc_info "Pulling data"
|
||||
dvc pull data/xml
|
||||
|
||||
dvc_clean_cloud_aws
|
||||
fi
|
||||
|
||||
|
||||
+13
-7
@@ -27,10 +27,14 @@ class TestWorkflow(TestCase):
|
||||
|
||||
self.assertEqual(len(wf._commits), 4)
|
||||
|
||||
self.assertEqual(wf._commits['1'].text, self._commit1._comment + '\n' + self._commit1.hash)
|
||||
self.assertEqual(wf._commits['2'].text, self._commit2._comment + '\n' + self._commit2.hash)
|
||||
self.assertEqual(wf._commits['3'].text, self._commit3._comment + '\n' + self._commit3.hash)
|
||||
self.assertEqual(wf._commits['4'].text, self._commit4._comment + '\n' + self._commit4.hash)
|
||||
self.assertEqual(wf._commits['1'].text,
|
||||
self._commit1._comment + '\n' + self._commit1._text_hash())
|
||||
self.assertEqual(wf._commits['2'].text,
|
||||
self._commit2._comment + '\n' + self._commit2._text_hash())
|
||||
self.assertEqual(wf._commits['3'].text,
|
||||
self._commit3._comment + '\n' + self._commit3._text_hash())
|
||||
self.assertEqual(wf._commits['4'].text,
|
||||
self._commit4._comment + '\n' + self._commit4._text_hash())
|
||||
pass
|
||||
|
||||
def collapse_test(self):
|
||||
@@ -43,7 +47,8 @@ class TestWorkflow(TestCase):
|
||||
wf.collapse_repro_commits()
|
||||
|
||||
self.assertEqual(len(wf._commits), 3)
|
||||
self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash)
|
||||
self.assertEqual(wf._commits[self._commit1.hash].text,
|
||||
self._commit1._comment + '\n' + self._commit1._text_hash())
|
||||
self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT)
|
||||
self.assertTrue('2' not in wf._commits)
|
||||
|
||||
@@ -61,7 +66,8 @@ class TestWorkflow(TestCase):
|
||||
wf.collapse_repro_commits()
|
||||
self.assertEqual(len(wf._commits), 2)
|
||||
|
||||
self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash)
|
||||
self.assertEqual(wf._commits[self._commit1.hash].text,
|
||||
self._commit1._comment + '\n' + self._commit1._text_hash())
|
||||
self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT)
|
||||
self.assertTrue('2' not in wf._commits)
|
||||
pass
|
||||
@@ -83,4 +89,4 @@ class TestWorkflow(TestCase):
|
||||
|
||||
self.assertEqual(wf._commits['3']._target_metric, value)
|
||||
self.assertEqual(wf._commits['3'].branch_tips, branches)
|
||||
pass
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user