Commit 08385b5a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

Merge branch 'more_info_from_caches' into '1.4.x'

Add more information to caches command output

See merge request !23
parents b0952911 a45c8106
Pipeline #20152 passed with stages
in 40 minutes and 41 seconds
......@@ -322,36 +322,49 @@ def caches(configuration, name, ls, delete, checksum):
scheduled = experiment.setup()
s = []
block_list = []
for key, value in scheduled.items():
block = {
'name': key,
'algorithm': value['configuration']['algorithm'],
'is_analyser': False,
'paths': []
}
if 'outputs' in value['configuration']: # normal block
for name, data in value['configuration']['outputs'].items():
s.append(data['path'])
block['paths'].append(data['path'])
else: # analyzer
s.append(value['configuration']['result']['path'])
block['is_analyser'] = True
block['paths'].append(value['configuration']['result']['path'])
# prefix cache path
s = [os.path.join(configuration.cache, k) for k in s]
block_list.append(block)
for k in s:
logger.info("output: `%s'", k)
for block in block_list:
block_type = 'analyzer' if block['is_analyser'] else 'algorithm'
logger.info("block: `%s'", block['name'])
logger.info(" %s: `%s'", block_type, block['algorithm'])
if ls:
for g in glob.glob(k + '.*'):
logger.info(g)
for path in block['paths']:
# prefix cache path
path = os.path.join(configuration.cache, path)
logger.info(" output: `%s'", path)
if delete:
if ls:
for file in glob.glob(path + '.*'):
logger.info(' %s' % file)
for g in glob.glob(k + '.*'):
logger.info("removing `%s'...", g)
os.unlink(g)
if delete:
for file in glob.glob(path + '.*'):
logger.info("removing `%s'...", file)
os.unlink(file)
common.recursive_rmdir_if_empty(
os.path.dirname(k), configuration.cache)
common.recursive_rmdir_if_empty(
os.path.dirname(path), configuration.cache)
if checksum:
assert load_data_index(configuration.cache, k + '.data')
logger.info("index for `%s' can be loaded and checksums", k)
if checksum:
assert load_data_index(configuration.cache, path + '.data')
logger.info("index for `%s' can be loaded and checksums", path)
return 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment