Example #1
0
    async def setUpAsync(self):
        await super().setUpAsync()

        async with self.app['engine'].acquire() as connection:
            self.consumer_ip = get_ip(self.app)
            self.consumer_port = '8000'
            await connection.execute(Consumer.insert().values(
                ip=self.consumer_ip,
                status='avaiable',
                port=self.consumer_port))

            self.job_id = str(uuid.uuid4())
            await connection.execute(Job.insert().values(
                id=self.job_id,
                query='AACAGCATGAGTGCGCTGGATGCTG',
                submitted=datetime.datetime.now(),
                status=JOB_STATUS_CHOICES.started))

            self.job_chunk_id = await connection.scalar(
                JobChunk.insert().values(
                    job_id=self.job_id,
                    database='mirbase',
                    submitted=datetime.datetime.now(),
                    status=JOB_CHUNK_STATUS_CHOICES.started,
                    consumer=self.consumer_ip))
    async def setUpAsync(self):
        await super().setUpAsync()

        consumer_ip = get_ip(self.app)

        async with self.app['engine'].acquire() as connection:
            await connection.execute(Job.insert().values(
                id=self.job_id,
                query='AACAGCATGAGTGCGCTGGATGCTG',
                description='CATE_ECOLI',
                submitted=datetime.datetime.now(),
                status=JOB_STATUS_CHOICES.started))

        async with self.app['engine'].acquire() as connection:
            await connection.execute(Consumer.insert().values(
                ip=consumer_ip, status='avaiable', port='8000'))
Example #3
0
    async def setUpAsync(self):
        await super().setUpAsync()

        self.consumer_ip = get_ip(self.app)

        async with self.app['engine'].acquire() as connection:
            await connection.execute(Job.insert().values(
                id=self.job_id,
                query=
                'AGUUACGGCCAUACCUCAGAGAAUAUACCGUAUCCCGUUCGAUCUGCGAAGUUAAGCUCUGAAGGGCGUCGUCAGUACUAUAGUGGGUGACCAUAUGGGAAUACGACGUGCUGUAGCUU',
                submitted=datetime.datetime.now(),
                status=JOB_STATUS_CHOICES.started))

        async with self.app['engine'].acquire() as connection:
            await connection.execute(InfernalJob.insert().values(
                job_id=self.job_id, ))
    async def test_set_consumer_to_infernal_job(self):
        await save_infernal_job(self.app['engine'],
                                self.job_id,
                                priority='low')
        consumer = get_ip(self.app)
        await set_consumer_to_infernal_job(self.app['engine'], self.job_id,
                                           consumer)

        async with self.app['engine'].acquire() as connection:
            query = sa.text('''
                SELECT consumer
                FROM infernal_job
                WHERE job_id=:job_id
            ''')

            async for row in await connection.execute(query,
                                                      job_id=self.job_id):
                assert row.consumer == consumer
                break
Example #5
0
    async def test_register_consumer_in_the_database(self):
        await register_consumer_in_the_database(self.app)
        consumer_ip = get_ip(self.app)

        consumer = await get_consumer_status(self.app['engine'], consumer_ip)
        assert consumer == CONSUMER_STATUS_CHOICES.available