Exemple #1
0
class TestTxtDevApp(pbcommand.testkit.PbTestApp):
    DRIVER_BASE = "python -m pbcommand.cli.examples.dev_txt_app "
    # XXX using default args, so the emit/resolve drivers are automatic
    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    TASK_OPTIONS = {"pbcommand.task_options.dev_max_nlines": 27}
    RESOLVED_TASK_OPTIONS = {"pbcommand.task_options.dev_max_nlines": 27}
Exemple #2
0
 def test_sanity(self):
     d = get_temp_dir("resolved-tool-contract")
     tc = load_tool_contract_from(get_data_file(self.FILE_NAME))
     rtc = resolve_gather_tool_contract(tc, self.INPUT_FILES, d, d, self.MAX_NPROC, self.TOOL_OPTIONS, self.CHUNK_KEY)
     self.assertIsInstance(rtc, ResolvedToolContract)
     self.assertIsInstance(rtc.task, ResolvedGatherToolContractTask)
     self.assertEqual(rtc.task.chunk_key, self.CHUNK_KEY)
Exemple #3
0
class TestQuickCustomTxtCustomOuts(pbcommand.testkit.PbTestApp):
    """Runs dev_qhello_world """
    DRIVER_EMIT = "python -m pbcommand.cli.examples.dev_quick_hello_world  emit-tool-contract pbcommand.tasks.dev_txt_custom_outs "
    DRIVER_RESOLVE = "python -m pbcommand.cli.examples.dev_quick_hello_world  run-rtc "

    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    def test_01(self):
        file_name = "resolved_tool_contract_dev_app.json"
        rtc = load_resolved_tool_contract_from(get_data_file(file_name))
        self.assertIsInstance(rtc, ResolvedToolContract)

        d = get_temp_dir("rtc-app")
        f = get_temp_file("-resolved-tool-contract.avro", d)
        write_resolved_tool_contract_avro(rtc, f)
Exemple #5
0
 def test_sanity(self):
     d = get_temp_dir("resolved-tool-contract")
     tc = load_tool_contract_from(get_data_file(self.FILE_NAME))
     rtc = resolve_scatter_tool_contract(tc, self.INPUT_FILES, d, d, self.MAX_NPROC, self.TOOL_OPTIONS, self.MAX_NCHUNKS, self.CHUNK_KEYS, False)
     self.assertIsInstance(rtc, ResolvedToolContract)
     self.assertIsInstance(rtc.task, ResolvedScatteredToolContractTask)
     self.assertEqual(rtc.task.max_nchunks, 7)
     self.assertEqual(rtc.task.is_distributed, False)
Exemple #6
0
    def test_01(self):
        file_name = "resolved_tool_contract_dev_app.json"
        rtc = load_resolved_tool_contract_from(get_data_file(file_name))
        self.assertIsInstance(rtc, ResolvedToolContract)

        d = get_temp_dir("rtc-app")
        f = get_temp_file("-resolved-tool-contract.avro", d)
        write_resolved_tool_contract_avro(rtc, f)
Exemple #7
0
 def test_sanity(self):
     d = get_temp_dir("resolved-tool-contract")
     tc = load_tool_contract_from(get_data_file(self.FILE_NAME))
     rtc = resolve_gather_tool_contract(tc, self.INPUT_FILES, d, d,
                                        self.MAX_NPROC, self.TOOL_OPTIONS,
                                        self.CHUNK_KEY)
     self.assertIsInstance(rtc, ResolvedToolContract)
     self.assertIsInstance(rtc.task, ResolvedGatherToolContractTask)
     self.assertEqual(rtc.task.chunk_key, self.CHUNK_KEY)
Exemple #8
0
class TestOptionTypes(pbcommand.testkit.PbTestApp):
    DRIVER_BASE = "python -m pbcommand.cli.examples.dev_mixed_app"
    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    TASK_OPTIONS = {
        "pbcommand.task_options.alpha": 50,
        "pbcommand.task_options.beta": 9.876,
        "pbcommand.task_options.gamma": False
    }
Exemple #9
0
class TestQuickTxt(pbcommand.testkit.PbTestApp):
    """Runs dev_qhello_world """
    DRIVER_EMIT = "python -m pbcommand.cli.examples.dev_quick_hello_world  emit-tool-contract pbcommand.tasks.dev_txt_hello "
    DRIVER_RESOLVE = "python -m pbcommand.cli.examples.dev_quick_hello_world  run-rtc "

    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    IS_DISTRIBUTED = True
    RESOLVED_IS_DISTRIBUTED = False # XXX is_distributed=False in task TC!
class TestQuickDevHelloWorld(PbTestApp):
    """Runs dev_qhello_world """
    DRIVER_EMIT = "python -m pbcommand.cli.examples.dev_quick_hello_world  emit-tool-contract pbcommand.tasks.dev_qhello_world "
    DRIVER_RESOLVE = "python -m pbcommand.cli.examples.dev_quick_hello_world  run-rtc "

    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    IS_DISTRIBUTED = True
    RESOLVED_IS_DISTRIBUTED = True
Exemple #11
0
    def test_tc_no_inputs(self):
        file_name = "dev_example_tool_contract.json"
        path = get_data_file(file_name)
        tc = load_tool_contract_from(path)
        tc.task.input_file_types = []

        def _run():
            return tc.to_dict()

        self.assertRaises(MalformedToolContractError, _run)
    def test_tc_no_inputs(self):
        file_name = "dev_example_tool_contract.json"
        path = get_data_file(file_name)
        tc = load_tool_contract_from(path)
        tc.task.input_file_types = []

        def _run():
            return tc.to_dict()

        self.assertRaises(MalformedToolContractError, _run)
Exemple #13
0
 def test_sanity(self):
     d = get_temp_dir("resolved-tool-contract")
     tc = load_tool_contract_from(get_data_file(self.FILE_NAME))
     rtc = resolve_scatter_tool_contract(tc, self.INPUT_FILES, d, d,
                                         self.MAX_NPROC, self.TOOL_OPTIONS,
                                         self.MAX_NCHUNKS, self.CHUNK_KEYS,
                                         False)
     self.assertIsInstance(rtc, ResolvedToolContract)
     self.assertIsInstance(rtc.task, ResolvedScatteredToolContractTask)
     self.assertEqual(rtc.task.max_nchunks, 7)
     self.assertEqual(rtc.task.is_distributed, False)
 def test_01(self):
     name = "dev_example_tool_contract.json"
     p = get_data_file(name)
     tc = load_tool_contract_from(p)
     input_files = ["/tmp/file.txt"]
     root_output_dir = "/tmp"
     root_tmp_dir = root_output_dir
     max_nproc = 2
     rtc = resolve_tool_contract(tc, input_files, root_output_dir, root_tmp_dir, max_nproc, {})
     log.info(pprint.pformat(rtc))
     self.assertIsNotNone(rtc)
     self.assertEqual(os.path.basename(rtc.task.output_files[0]),
         "output.txt")
Exemple #15
0
 def test_01(self):
     name = "dev_example_tool_contract.json"
     p = get_data_file(name)
     tc = load_tool_contract_from(p)
     input_files = ["/tmp/file.txt"]
     root_output_dir = "/tmp"
     root_tmp_dir = root_output_dir
     max_nproc = 2
     rtc = resolve_tool_contract(tc, input_files, root_output_dir,
                                 root_tmp_dir, max_nproc, {})
     log.info(pprint.pformat(rtc))
     self.assertIsNotNone(rtc)
     self.assertEqual(os.path.basename(rtc.task.output_files[0]),
                      "output.txt")
class TestQuickOptionTypes(PbTestApp):
    DRIVER_EMIT = "python -m pbcommand.cli.examples.dev_quick_hello_world  emit-tool-contract pbcommand.tasks.dev_test_options"
    DRIVER_RESOLVE = "python -m pbcommand.cli.examples.dev_quick_hello_world run-rtc "
    INPUT_FILES = [get_data_file("example.txt")]
    TASK_OPTIONS = {
        "pbcommand.task_options.alpha": 50,
        "pbcommand.task_options.beta": 9.876,
        "pbcommand.task_options.gamma": False,
        "pbcommand.task_options.ploidy": "diploid"
    }
    RESOLVED_TASK_OPTIONS = {
        "pbcommand.task_options.alpha": 50,
        "pbcommand.task_options.beta": 9.876,
        "pbcommand.task_options.gamma": False,
        "pbcommand.task_options.ploidy": "diploid",
        "pbcommand.task_options.delta": 1,
        "pbcommand.task_options.epsilon": 0.01
    }
class TestOptionTypes(PbTestApp):
    DRIVER_BASE = "python -m pbcommand.cli.examples.dev_mixed_app"
    REQUIRES_PBCORE = False
    INPUT_FILES = [get_data_file("example.txt")]
    TASK_OPTIONS = {
        "pbcommand.task_options.alpha": 50,
        "pbcommand.task_options.beta": 9.876,
        "pbcommand.task_options.gamma": False,
        "pbcommand.task_options.ploidy": "diploid"
    }
    RESOLVED_TASK_OPTIONS = {
        "pbcommand.task_options.alpha": 50,
        "pbcommand.task_options.beta": 9.876,
        "pbcommand.task_options.gamma": False,
        "pbcommand.task_options.ploidy": "diploid",
        "pbcommand.task_options.delta": 1,
        "pbcommand.task_options.epsilon": 0.1
    }
 def test_01(self):
     name = "dev_example_dev_txt_app_tool_contract.json"
     p = get_data_file(name)
     tc = load_tool_contract_from(p)
     input_files = ["/tmp/file.txt"]
     root_output_dir = "/tmp"
     root_tmp_dir = root_output_dir
     tmp_file = tempfile.NamedTemporaryFile().name
     max_nproc = 2
     tool_options = {}
     rtc = resolve_tool_contract(tc, input_files, root_output_dir, root_tmp_dir, max_nproc, tool_options, False)
     log.info(pprint.pformat(rtc))
     self.assertIsNotNone(rtc)
     self.assertEqual(os.path.basename(rtc.task.output_files[0]),
         "output.txt")
     # Validate Resolved Resource Types
     log.debug("Resources {t}".format(t=rtc.task.resources))
     self.assertEqual(len(rtc.task.tmpdir_resources), 1)
     self.assertEqual(len(rtc.task.tmpfile_resources), 2)
Exemple #19
0
 def test_01(self):
     file_name = "dev_example_tool_contract.json"
     path = get_data_file(file_name)
     tc = load_tool_contract_from(path)
     self.assertIsInstance(tc, ToolContract)
 def test_01(self):
     path = get_data_file("dev_example_resolved_tool_contract.json")
     rtc = load_resolved_tool_contract_from(path)
     log.info(rtc)
     self.assertIsNotNone(rtc)
Exemple #21
0
class TestRunDevApp(pbcommand.testkit.PbTestApp):
    DRIVER_BASE = "python -m pbcommand.cli.examples.dev_app "
    REQUIRES_PBCORE = True
    INPUT_FILES = [get_data_file("example.fasta")]
    TASK_OPTIONS = {"pbcommand.task_options.dev_read_length": 27}
 def test_sanity(self):
     path = get_data_file(self.FILE_NAME)
     tool_contract = self._to_object(path)
     self.assertIsNotNone(tool_contract)
 def test_01(self):
     file_name = "dev_example_tool_contract.json"
     path = get_data_file(file_name)
     tc = load_tool_contract_from(path)
     self.assertIsInstance(tc, ToolContract)