コード例 #1
0
    async def migrate_all(self, arguments):
        search = get_utility(ICatalogUtility)
        change_transaction_strategy('none')
        await asyncio.sleep(1)  # since something initialize custom types...
        async for _, tm, container in get_containers(self.request):
            try:
                self.migrator = Migrator(
                    search,
                    container,
                    response=printer(),
                    full=arguments.full,
                    force=arguments.force,
                    log_details=arguments.log_details,
                    memory_tracking=arguments.memory_tracking,
                    reindex_security=arguments.reindex_security,
                    mapping_only=arguments.mapping_only,
                    cache=False)
                await self.migrator.run_migration()
                seconds = int(time.time() - self.migrator.start_time)
                logger.warning(f'''Finished migration:
Total Seconds: {seconds}
Processed: {self.migrator.processed}
Indexed: {self.migrator.indexed}
Objects missing: {len(self.migrator.missing)}
Objects orphaned: {len(self.migrator.orphaned)}
Mapping Diff: {self.migrator.mapping_diff}
''')
            finally:
                await tm.commit(self.request)
コード例 #2
0
 async def run(self, arguments, settings, app):
     change_transaction_strategy('none')
     self.request._db_write_enabled = True
     self.request._message.headers['Host'] = 'localhost'
     await asyncio.gather(
         self.do_check(arguments, 'check_missing'),
         self.do_check(arguments, 'check_orphans'))
コード例 #3
0
 def run(self, arguments, settings, app):
     request = get_mocked_request()
     login()
     task_vars.request.set(request)
     change_transaction_strategy("none")
     loop = self.get_loop()
     loop.run_until_complete(self.reindex_all(arguments))
コード例 #4
0
 async def run(self, arguments, settings, app):
     request = get_mocked_request()
     login()
     task_vars.request.set(request)
     change_transaction_strategy("none")
     await asyncio.gather(
         self.do_check(arguments, "check_missing"),
         self.do_check(arguments, "check_orphans"),
     )
コード例 #5
0
 def run(self, arguments, settings, app):
     change_transaction_strategy('none')
     loop = self.get_loop()
     loop.run_until_complete(self.reindex_all(arguments))