Commit 044a1df9 authored by hmueller's avatar hmueller
Browse files

Replace uuid in live results with tool name (resolves #20).

parent c5e97033
......@@ -34,7 +34,7 @@ process ${id} {
live_results_template = Template('''
process generate_${id}_live_results {
publishDir "${output}/live", mode: 'copy', pattern: '*????????-????-????-????-????????????.json'
publishDir "${output}/live", mode: 'copy', pattern: '*.*.json'
input:
file result from ${id}_json_live
......@@ -44,7 +44,7 @@ process generate_${id}_live_results {
script:
"""
split_json_into_separate_files.py --json $$result --output . --uuid
split_json_into_separate_files.py --json $$result --output . --tool ${id}
"""
}
''')
......
......@@ -4,11 +4,10 @@ import json
import argparse
import os
import os.path
from uuid import uuid4
parser = argparse.ArgumentParser(description='Split a json file with multiple documents into single files per document')
parser.add_argument('--json', '-j', required=True, help='json documents')
parser.add_argument('--uuid', '-u', action='store_true', help='Include a uuid in the filename.')
parser.add_argument('--tool', '-t', help='The name of the tool with which the results were generated')
parser.add_argument('--output', '-o', required=True, help='The name of the output directory')
args = parser.parse_args()
......@@ -24,8 +23,8 @@ file = args.json
with open(file) as f:
doc = json.load(f)
for k in doc:
if args.uuid:
output_filename = k + "_" + str(uuid4()) + '.json'
if args.tool:
output_filename = k + "." + args.tool + '.json'
else:
output_filename = k + '.json'
with open(output_dir + '/' + output_filename, 'w') as o:
......
Markdown is supported
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