예제 #1
0
def launch(bii):
    disk = bii.hive_disk_image
    migration_store = MigrationStore(disk.hivedb)
    manager = MigrationManager(migration_store, get_client_migrations(),
                               bii.user_io.out)

    # Pass in kwargs all variables migrations can need
    manager.migrate(bii)
예제 #2
0
    def test_migration_not_found(self):
        """Last Migration not found in local migrations,
        incompatible hive<=>biicode version """
        self.store.read_last_migrated.return_value = self.mig3
        # Now mig3 does not exist!
        self.migration_manager = MigrationManager(self.store,
                                                  [self.mig1, self.mig2],
                                                  Mock())

        self.assertRaises(BiiException, self.migration_manager.migrate)
예제 #3
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.mig1 = TMigration1()
        self.mig2 = TMigration2()
        self.mig3 = TMigration3()

        self.store = Mock()
        self.store.store_executed_migration = Mock()
        self.migration_manager = MigrationManager(self.store,
                                                  [self.mig1, self.mig2, self.mig3],
                                                  Mock())
예제 #4
0
def launch():
    # Default MongoClient params are:
    # w=1  perform a write acknowledgement only in primary
    # j=False the driver does not add j to the getlasterror command
    # fsync=False the server does not add Sync to disk. to the getlasterror command
    mongo_connection = MongoClient(BII_MONGO_URI, max_pool_size=BII_MAX_MONGO_POOL_SIZE)
    migration_store = MigrationStore(mongo_connection)
    server_store = MongoServerStore(mongo_connection)
    biiout = OutputStream()
    manager = MigrationManager(migration_store, SERVER_MIGRATIONS, biiout)

    # Pass in kwargs all variables migrations can need
    n1 = time.time()
    manager.migrate(server_store=server_store)
    n2 = time.time()
    biiout.info('All took %s seconds' % str(n2 - n1))

    # DO NOT REMOVE THIS PRINT NOR REPLACE WITH LOGGER, ITS A CONSOLE SCRIPT
    # INVOKED IN DEPLOYMENT PROCESS AND ITS NECESSARY IT PRINTS TO OUTPUT
    print biiout