示例#1
0
    def test_batch_size(self):
        expected = 10000
        rv = get_query_batch_size('blastp')
        self.assertEqual(rv, expected)

        rv = get_query_batch_size('BLASTP')
        self.assertEqual(rv, expected)
示例#2
0
    def test_batch_size_invalid_input(self):
        expected = -1
        rv = get_query_batch_size('junk')
        self.assertEqual(rv, expected)

        rv = get_query_batch_size(12334)
        self.assertEqual(rv, expected)
示例#3
0
def test_get_batch_length():
    """Test computing batch length"""
    PROGRAM = 'blastp'
    NUM_CPUS = 16
    assert get_batch_length(program='blastp',
                            mt_mode=MTMode.ZERO,
                            num_cpus=NUM_CPUS) == get_query_batch_size(PROGRAM)

    assert get_batch_length(
        program='blastp', mt_mode=MTMode.ONE,
        num_cpus=NUM_CPUS) == get_query_batch_size(PROGRAM) * NUM_CPUS
示例#4
0
def test_blastconfig():
    """Test BlastConfig defaults"""
    PROGRAM = 'blastn'
    DB = 'test-db'
    QUERIES = 'test-queries'

    cloud_provider = GCPConfig(project='test-project',
                               region='test-region',
                               zone='test-zone')
    machine_type = 'n1-standard-32'

    cfg = BlastConfig(program=PROGRAM,
                      db=DB,
                      queries_arg=QUERIES,
                      cloud_provider=cloud_provider,
                      machine_type=machine_type)

    assert cfg.program == PROGRAM
    assert cfg.db == DB
    assert cfg.queries_arg == QUERIES
    assert cfg.db_source.name == cloud_provider.cloud.name
    assert cfg.batch_len == get_query_batch_size(cfg.program)
    assert not cfg.queries
    assert cfg.options == f'-outfmt {ELB_DFLT_OUTFMT}'
    assert cfg.mem_request
    assert cfg.mem_limit
    assert not cfg.taxidlist
    assert cfg.db_mem_margin == ELB_BLASTDB_MEMORY_MARGIN
示例#5
0
    def test_batch_size_env_var(self):
        expected = 10

        original = os.getenv('ELB_BATCH_LEN')
        try:
            os.environ['ELB_BATCH_LEN'] = str(expected)

            rv = get_query_batch_size('blastn')
            self.assertEqual(rv, expected)
        finally:
            del os.environ['ELB_BATCH_LEN']
            if original is not None:
                os.environ['ELB_BATCH_LEN'] = original