armi.migration.base module

Base migration classes.

A classic migration takes a file name, read the files, migrates the data, and re-writes the file. Some migrations need to happen live on a stream. For example, if an old/invalid input file is being read in from an old database. The migration class defined here chooses this behavior based on whether the stream or path variables are given in the constructor.

class armi.migration.base.Migration(stream=None, path=None)[source]

Bases: ABC

Generic migration.

To implement a concrete Migration, you must implement the _applyToStream method. You must also define the abstract properties fromVersion and toVersion. These are the ARMI versions you are migrating from and to. The toVersion must be higher than the fromVersion.

abstract property fromVersion

ARMI version string, must be smaller than toVersion.

abstract property toVersion

ARMI version string, must be larger than fromVersion.

apply(version: str = None)[source]

Apply migration.

This is generally called from a subclass.

Parameters:

version (str) – Optional DB version string, for example: 1.2.3

class armi.migration.base.BlueprintsMigration(stream=None, path=None)[source]

Bases: Migration

Migration for blueprints input.

class armi.migration.base.SettingsMigration(stream=None, path=None)[source]

Bases: Migration

Migration for settings input.

class armi.migration.base.DatabaseMigration(stream=None, path=None)[source]

Bases: Migration

Migration for db output.