How to use the cog.core.Store function in cog

To help you get started, weโ€™ve selected a few cog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arun1729 / cog / test / insert_bench.py View on Github external
def test_indexer(self):

        dictConfig(config.logging_config)
        logger = logging.getLogger()

        table = Table("perf_table","perf_ns","instance_1")

        store = Store(table,config,logger)
        indexer = Indexer(table,config,logger)

        max_range=1000000

        insert_perf=[]
        overall_start_time = timeit.default_timer()
        total_seconds=0.0
        for i in range(max_range):
            key= ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
            value= ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(100))
            expected_data = (key,value)

            start_time = timeit.default_timer()
            position=store.save(expected_data)
            indexer.put(expected_data[0],position,store)
            elapsed = timeit.default_timer() - start_time