Esempio n. 1
0
def test_get_cleaner_ArgumentParser():
    # raise error for requesting unknown function
    nt.assert_raises(AssertionError, utils.get_cleaner_ArgumentParser, 'blah')

    # test getting each type of argparser
    # wrapper
    a = utils.get_cleaner_ArgumentParser('wrapper')
    work_dir = '/foo/bar'
    args = [work_dir]
    parsed_args = a.parse_args(args)
    nt.assert_equal(work_dir, parsed_args.directory)

    # output
    a = utils.get_cleaner_ArgumentParser('output')
    parsed_args = a.parse_args(args)
    nt.assert_equal(work_dir, parsed_args.directory)

    # logs
    a = utils.get_cleaner_ArgumentParser('logs')
    output_file = "mf.log"
    args = [work_dir, '-o', output_file]
    parsed_args = a.parse_args(args)
    nt.assert_equal(work_dir, parsed_args.directory)
    nt.assert_equal(output_file, parsed_args.output)
    nt.assert_false(parsed_args.overwrite)
    nt.assert_true(parsed_args.remove_original)
    nt.assert_false(parsed_args.zip)

    return
Esempio n. 2
0
#!/usr/bin/env python2.7
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 The HERA Collaboration

from __future__ import print_function, division, absolute_import
import os
from hera_opm import mf_tools as mt
from hera_opm import utils

a = utils.get_cleaner_ArgumentParser('output')
args = a.parse_args()
work_dir = args.directory

print("Cleaning output files in {}".format(work_dir))
mt.clean_output_files(work_dir)
#!/usr/bin/env python2.7
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 The HERA Collaboration

from __future__ import print_function, division, absolute_import
import os
from hera_opm import mf_tools as mt
from hera_opm import utils

a = utils.get_cleaner_ArgumentParser('wrapper')
args = a.parse_args()
work_dir = args.directory

print("Cleaning wrapper scripts in {}".format(work_dir))
mt.clean_wrapper_scripts(work_dir)
Esempio n. 4
0
#!/usr/bin/env python2.7
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 The HERA Collaboration

from __future__ import print_function, division, absolute_import
import os
from hera_opm import mf_tools as mt
from hera_opm import utils

a = utils.get_cleaner_ArgumentParser('logs')
args = a.parse_args()
work_dir = args.directory
output = args.output
overwrite = args.overwrite
remove_original = args.remove_original
zip_output = args.zip

print("Consolidating log files in {}".format(work_dir))
mt.consolidate_logs(work_dir, output, overwrite, remove_original, zip_output)