コード例 #1
0
 def test_make_bench_suite_parameters_single(self):
     """Correctly generates the benchmark suite for a single parameter"""
     cmd = "parallel_pick_otus_uclust_ref.py -r ref_file.fna -i input.fna"
     params = {"jobs_to_start": ["8", "16", "32"]}
     out_opt = "-o"
     obs = make_bench_suite_parameters(cmd, params, out_opt)
     self.assertEqual(obs, exp_bench_suite_parameters_single)
コード例 #2
0
    def run(self, **kwargs):
        result = {}

        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        if parameters:
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt)
        elif bench_files:
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError(
                    "The length of bench_files and in_opts must "
                    "be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt)
        else:
            raise CommandError("Must specify parameters or bench_files.")

        result['bench_suite'] = bench_str

        return result
コード例 #3
0
 def test_make_bench_suite_parameters_single(self):
     """Correctly generates the benchmark suite for a single parameter"""
     cmd = "parallel_pick_otus_uclust_ref.py -r ref_file.fna -i input.fna"
     params = {"jobs_to_start": ["8", "16", "32"]}
     out_opt = "-o"
     obs = make_bench_suite_parameters(cmd, params, out_opt)
     self.assertEqual(obs, exp_bench_suite_parameters_single)
コード例 #4
0
 def test_make_bench_suite_parameters_pbs(self):
     """Correctly genreates the benchmark suite for a pbs environment"""
     cmd = "parallel_pick_otus_uclust_ref.py -r ref_file.fna -i input.fna"
     params = {"jobs_to_start": ["8", "16", "32"],
               "similarity": ["0.94", "0.97", "0.99"]}
     out_opt = "-o"
     pbs = True
     job_prefix = "test"
     queue = "friendlyq"
     pbs_extra_args = "-m abe"
     obs = make_bench_suite_parameters(cmd, params, out_opt, pbs,
                                       job_prefix, queue, pbs_extra_args)
     self.assertEqual(obs, exp_bench_suite_parameters_pbs)
コード例 #5
0
 def test_make_bench_suite_parameters_pbs(self):
     """Correctly genreates the benchmark suite for a pbs environment"""
     cmd = "parallel_pick_otus_uclust_ref.py -r ref_file.fna -i input.fna"
     params = {
         "jobs_to_start": ["8", "16", "32"],
         "similarity": ["0.94", "0.97", "0.99"]
     }
     out_opt = "-o"
     pbs = True
     job_prefix = "test"
     queue = "friendlyq"
     pbs_extra_args = "-m abe"
     obs = make_bench_suite_parameters(cmd, params, out_opt, pbs,
                                       job_prefix, queue, pbs_extra_args)
     self.assertEqual(obs, exp_bench_suite_parameters_pbs)
コード例 #6
0
    def run(self, **kwargs):
        # Get command parameters
        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        pbs = kwargs['pbs']
        job_prefix = kwargs['job_prefix']
        queue = kwargs['queue']
        pbs_extra_args = kwargs['pbs_extra_args']

        # Check which type of bench suite are we generating
        if parameters:
            # We are generating a benchmark suite based on different parameter
            # values. In such case, the user should not provide any bench file
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt, pbs, job_prefix,
                                                    queue, pbs_extra_args)
        elif bench_files:
            # We are generating a benchmark suite based on input files,
            # Check that the number of benchmark files for test case match
            # the number of options to provide the input files
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError("The length of bench_files and in_opts "
                                   "must be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt, pbs, job_prefix, queue,
                                               pbs_extra_args)
        else:
            # Not enough parameters!
            raise CommandError("Must specify parameters or bench_files.")

        return {'bench_suite': bench_str}
コード例 #7
0
    def run(self, **kwargs):
        # Get command parameters
        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        pbs = kwargs['pbs']
        job_prefix = kwargs['job_prefix']
        queue = kwargs['queue']
        pbs_extra_args = kwargs['pbs_extra_args']

        # Check which type of bench suite are we generating
        if parameters:
            # We are generating a benchmark suite based on different parameter
            # values. In such case, the user should not provide any bench file
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt, pbs, job_prefix,
                                                    queue, pbs_extra_args)
        elif bench_files:
            # We are generating a benchmark suite based on input files,
            # Check that the number of benchmark files for test case match
            # the number of options to provide the input files
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError("The length of bench_files and in_opts "
                                   "must be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt, pbs, job_prefix, queue,
                                               pbs_extra_args)
        else:
            # Not enough parameters!
            raise CommandError("Must specify parameters or bench_files.")

        return {'bench_suite': bench_str}