Skip to content
Snippets Groups Projects
Commit d61eaa50 authored by Sami Evangelista's avatar Sami Evangelista
Browse files

parameter hash_dir for FileStorage

parent 76373965
No related branches found
No related tags found
No related merge requests found
......@@ -25,14 +25,12 @@ class FileStorage(Storage):
def _get_dir(self, run: 'Run') -> str:
sub_dirs = list(run.assign.values())
if not self.hash_dir:
result = os.path.join(*sub_dirs)
else:
if self.hash_dir:
hval = hashlib.sha256(
';'.join(sub_dirs).encode('utf-8')
).hexdigest()
result = os.path.join(hval[:2], hval[2:4], hval[4:])
return result
sub_dirs = [hval[:2], hval[2:4], hval[4:]]
return os.path.join(self.bench.get_dir(), 'runs', *sub_dirs)
def _get_mdata_file(self, run: 'Run') -> str:
return os.path.join(self._get_dir(run), '_mdata.json')
......
......@@ -39,7 +39,8 @@ def mk_test_ls_benchmark() -> Benchmark:
"recursive == 'recursive' => dir != 'tmp'"
],
"storage": {
"type": "file"
"type": "file",
"hash_dir": True
}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment