diff --git a/aiida/backends/djsite/db/migrations/0043_default_link_label.py b/aiida/backends/djsite/db/migrations/0043_default_link_label.py new file mode 100644 index 0000000000..b3af227040 --- /dev/null +++ b/aiida/backends/djsite/db/migrations/0043_default_link_label.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +########################################################################### +# Copyright (c), The AiiDA team. All rights reserved. # +# This file is part of the AiiDA code. # +# # +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # +# For further information on the license, see the LICENSE.txt file # +# For further information please visit http://www.aiida.net # +########################################################################### +# pylint: disable=invalid-name,too-few-public-methods +"""Update all link labels with the value `_return` which is the legacy default single link label. + +The old process functions used to use `_return` as the default link label, however, since labels that start or end with +and underscore are illegal because they are used for namespacing. +""" +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import absolute_import + +# Remove when https://github.com/PyCQA/pylint/issues/1931 is fixed +# pylint: disable=no-name-in-module,import-error +from django.db import migrations +from aiida.backends.djsite.db.migrations import upgrade_schema_version + +REVISION = '1.0.43' +DOWN_REVISION = '1.0.42' + + +class Migration(migrations.Migration): + """Migrate.""" + + dependencies = [ + ('db', '0042_prepare_schema_reset'), + ] + + operations = [ + migrations.RunSQL( + sql=r""" + UPDATE db_dblink SET label='result' WHERE label = '_return'; + """, + reverse_sql='' + ), + upgrade_schema_version(REVISION, DOWN_REVISION) + ] diff --git a/aiida/backends/djsite/db/migrations/__init__.py b/aiida/backends/djsite/db/migrations/__init__.py index 3e9bf2cabd..fe8cf402d5 100644 --- a/aiida/backends/djsite/db/migrations/__init__.py +++ b/aiida/backends/djsite/db/migrations/__init__.py @@ -23,7 +23,7 @@ class DeserializationException(AiidaException): pass -LATEST_MIGRATION = '0042_prepare_schema_reset' +LATEST_MIGRATION = '0043_default_link_label' def _update_schema_version(version, apps, schema_editor): diff --git a/aiida/backends/djsite/db/subtests/migrations/test_migrations_0043_default_link_label.py b/aiida/backends/djsite/db/subtests/migrations/test_migrations_0043_default_link_label.py new file mode 100644 index 0000000000..0e388ffbf9 --- /dev/null +++ b/aiida/backends/djsite/db/subtests/migrations/test_migrations_0043_default_link_label.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +########################################################################### +# Copyright (c), The AiiDA team. All rights reserved. # +# This file is part of the AiiDA code. # +# # +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # +# For further information on the license, see the LICENSE.txt file # +# For further information please visit http://www.aiida.net # +########################################################################### +# pylint: disable=import-error,no-name-in-module,invalid-name +"""Tests for the migrations of legacy process attributes.""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from aiida.backends.djsite.db.subtests.migrations.test_migrations_common import TestMigrations + + +class TestSealUnsealedProcessesMigration(TestMigrations): + """Test the migration that performs a data migration of legacy `JobCalcState`.""" + + migrate_from = '0042_prepare_schema_reset' + migrate_to = '0043_default_link_label' + + def setUpBeforeMigration(self): + node_process = self.DbNode( + node_type='process.calculation.calcjob.CalcJobNode.', + user_id=self.default_user.id, + ) + node_process.save() + self.node_process_id = node_process.id + + node_data = self.DbNode( + node_type='data.dict.Dict.', + user_id=self.default_user.id, + ) + node_data.save() + self.node_data_id = node_data.id + + link = self.DbLink(input=node_data, output=node_process, type='input', label='_return') + link.save() + + def test_data_migrated(self): + """Verify that the link label has been renamed.""" + node = self.load_node(self.node_data_id) + link = self.DbLink.objects.get(input=node) + self.assertEqual(link.label, 'result') diff --git a/aiida/backends/djsite/db/subtests/migrations/test_migrations_common.py b/aiida/backends/djsite/db/subtests/migrations/test_migrations_common.py index 4fb749e538..dfe72abdb3 100644 --- a/aiida/backends/djsite/db/subtests/migrations/test_migrations_common.py +++ b/aiida/backends/djsite/db/subtests/migrations/test_migrations_common.py @@ -60,6 +60,7 @@ def setUp(self): # Reset session after the migration sa.get_scoped_session().close() + self.DbLink = self.apps.get_model('db', 'DbLink') self.DbNode = self.apps.get_model('db', 'DbNode') self.DbUser = self.apps.get_model('db', 'DbUser') self.DbUser.objects.all().delete() diff --git a/aiida/backends/sqlalchemy/migrations/versions/118349c10896_default_link_label.py b/aiida/backends/sqlalchemy/migrations/versions/118349c10896_default_link_label.py new file mode 100644 index 0000000000..42b9538e56 --- /dev/null +++ b/aiida/backends/sqlalchemy/migrations/versions/118349c10896_default_link_label.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +########################################################################### +# Copyright (c), The AiiDA team. All rights reserved. # +# This file is part of the AiiDA code. # +# # +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # +# For further information on the license, see the LICENSE.txt file # +# For further information please visit http://www.aiida.net # +########################################################################### +# pylint: disable=invalid-name +"""Update all link labels with the value `_return` which is the legacy default single link label. + +The old process functions used to use `_return` as the default link label, however, since labels that start or end with +and underscore are illegal because they are used for namespacing. + +Revision ID: 118349c10896 +Revises: 91b573400be5 +Create Date: 2019-11-21 09:43:45.006053 + +""" +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import + +# pylint: disable=no-member,no-name-in-module,import-error +from alembic import op +from sqlalchemy.sql import text + +# revision identifiers, used by Alembic. +revision = '118349c10896' +down_revision = '91b573400be5' +branch_labels = None +depends_on = None + + +def upgrade(): + """Migrations for the upgrade.""" + conn = op.get_bind() + + # The old process functions used to use `_return` as the default link label, however, since labels that start or end + # with and underscore are illegal. + statement = text(""" + UPDATE db_dblink SET label='result' WHERE label = '_return'; + """) + conn.execute(statement) + + +def downgrade(): + """Migrations for the downgrade.""" diff --git a/aiida/backends/sqlalchemy/tests/test_migrations.py b/aiida/backends/sqlalchemy/tests/test_migrations.py index 8c22809cc4..a26cc78029 100644 --- a/aiida/backends/sqlalchemy/tests/test_migrations.py +++ b/aiida/backends/sqlalchemy/tests/test_migrations.py @@ -1610,3 +1610,58 @@ def test_data_migrated(self): finally: session.close() + + +class TestDefaultLinkLabelMigration(TestMigrationsSQLA): + """Test the migration that performs a data migration of legacy default link labels.""" + + migrate_from = '91b573400be5' + migrate_to = '118349c10896' + + def setUpBeforeMigration(self): + from sqlalchemy.orm import Session # pylint: disable=import-error,no-name-in-module + + DbLink = self.get_auto_base().classes.db_dblink # pylint: disable=invalid-name + DbNode = self.get_auto_base().classes.db_dbnode # pylint: disable=invalid-name + DbUser = self.get_auto_base().classes.db_dbuser # pylint: disable=invalid-name + + with sa.ENGINE.begin() as connection: + try: + session = Session(connection.engine) + + user = DbUser(email='{}@aiida.net'.format(self.id())) + session.add(user) + session.commit() + + node_process = DbNode(node_type='process.calculation.calcjob.CalcJobNode.', user_id=user.id) + node_data = DbNode(node_type='data.dict.Dict.', user_id=user.id) + link = DbLink(input_id=node_data.id, output_id=node_process.id, type='input', label='_return') + + session.add(node_process) + session.add(node_data) + session.add(link) + session.commit() + + self.node_process_id = node_process.id + self.node_data_id = node_data.id + self.link_id = link.id + except Exception: + session.rollback() + raise + finally: + session.close() + + def test_data_migrated(self): + """Verify that the attributes for process node have been deleted and `_sealed` has been changed to `sealed`.""" + from sqlalchemy.orm import Session # pylint: disable=import-error,no-name-in-module + + DbLink = self.get_auto_base().classes.db_dblink # pylint: disable=invalid-name + + with sa.ENGINE.begin() as connection: + try: + session = Session(connection.engine) + link = session.query(DbLink).filter(DbLink.id == self.link_id).one() + self.assertEqual(link.label, 'result') + + finally: + session.close() diff --git a/aiida/backends/tests/__init__.py b/aiida/backends/tests/__init__.py index bbe7ced09b..edafb350bd 100644 --- a/aiida/backends/tests/__init__.py +++ b/aiida/backends/tests/__init__.py @@ -27,6 +27,7 @@ 'aiida.backends.djsite.db.subtests.migrations.test_migrations_0038_data_migration_legacy_job_calculations', 'aiida.backends.djsite.db.subtests.migrations.test_migrations_0040_data_migration_legacy_process_attributes', 'aiida.backends.djsite.db.subtests.migrations.test_migrations_0041_seal_unsealed_processes', + 'aiida.backends.djsite.db.subtests.migrations.test_migrations_0043_default_link_label', ], }, BACKEND_SQLA: { @@ -162,6 +163,7 @@ 'tools.importexport.migration.v04_to_v05': ['aiida.backends.tests.tools.importexport.migration.test_v04_to_v05'], 'tools.importexport.migration.v05_to_v06': ['aiida.backends.tests.tools.importexport.migration.test_v05_to_v06'], 'tools.importexport.migration.v06_to_v07': ['aiida.backends.tests.tools.importexport.migration.test_v06_to_v07'], + 'tools.importexport.migration.v07_to_v08': ['aiida.backends.tests.tools.importexport.migration.test_v07_to_v08'], 'tools.importexport.orm.attributes': ['aiida.backends.tests.tools.importexport.orm.test_attributes'], 'tools.importexport.orm.calculations': ['aiida.backends.tests.tools.importexport.orm.test_calculations'], 'tools.importexport.orm.codes': ['aiida.backends.tests.tools.importexport.orm.test_codes'], diff --git a/aiida/backends/tests/fixtures/calcjob/arithmetic.add.aiida b/aiida/backends/tests/fixtures/calcjob/arithmetic.add.aiida index 573c7da523..4c0de43491 100644 Binary files a/aiida/backends/tests/fixtures/calcjob/arithmetic.add.aiida and b/aiida/backends/tests/fixtures/calcjob/arithmetic.add.aiida differ diff --git a/aiida/backends/tests/fixtures/calcjob/arithmetic.add_old.aiida b/aiida/backends/tests/fixtures/calcjob/arithmetic.add_old.aiida index 649e43e7c8..17357815a0 100644 Binary files a/aiida/backends/tests/fixtures/calcjob/arithmetic.add_old.aiida and b/aiida/backends/tests/fixtures/calcjob/arithmetic.add_old.aiida differ diff --git a/aiida/backends/tests/fixtures/export/compare/django.aiida b/aiida/backends/tests/fixtures/export/compare/django.aiida index ba9c7483da..633c58159e 100644 Binary files a/aiida/backends/tests/fixtures/export/compare/django.aiida and b/aiida/backends/tests/fixtures/export/compare/django.aiida differ diff --git a/aiida/backends/tests/fixtures/export/compare/sqlalchemy.aiida b/aiida/backends/tests/fixtures/export/compare/sqlalchemy.aiida index 420e8171d8..bd3ae08f44 100644 Binary files a/aiida/backends/tests/fixtures/export/compare/sqlalchemy.aiida and b/aiida/backends/tests/fixtures/export/compare/sqlalchemy.aiida differ diff --git a/aiida/backends/tests/fixtures/export/migrate/export_v0.8_simple.aiida b/aiida/backends/tests/fixtures/export/migrate/export_v0.8_simple.aiida new file mode 100644 index 0000000000..250876da28 Binary files /dev/null and b/aiida/backends/tests/fixtures/export/migrate/export_v0.8_simple.aiida differ diff --git a/aiida/backends/tests/tools/importexport/migration/test_migration.py b/aiida/backends/tests/tools/importexport/migration/test_migration.py index 5f4b35ba14..8e01ec89e2 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_migration.py +++ b/aiida/backends/tests/tools/importexport/migration/test_migration.py @@ -479,3 +479,58 @@ def test_v06_to_newest(self, temp_dir): builder.append(orm.CalculationNode, tag='parent') builder.append(orm.RemoteData, with_incoming='parent') self.assertGreater(len(builder.all()), 0) + + @with_temp_dir + def test_v07_to_newest(self, temp_dir): + """Test migration of exported files from v0.7 to newest export version""" + input_file = get_archive_file('export_v0.7_manual.aiida', **self.external_archive) + output_file = os.path.join(temp_dir, 'output_file.aiida') + + # Perform the migration + migrate_archive(input_file, output_file) + metadata, _ = get_json_files(output_file) + verify_metadata_version(metadata, version=newest_version) + + # Load the migrated file + import_data(output_file, silent=True) + + # Do the necessary checks + self.assertEqual(orm.QueryBuilder().append(orm.Node).count(), self.node_count + 2) + + # Verify that CalculationNodes have non-empty attribute dictionaries + builder = orm.QueryBuilder().append(orm.CalculationNode) + for [calculation] in builder.iterall(): + self.assertIsInstance(calculation.attributes, dict) + self.assertNotEqual(len(calculation.attributes), 0) + + # Verify that the StructureData nodes maintained their (same) label, cell, and kinds + builder = orm.QueryBuilder().append(orm.StructureData) + self.assertEqual( + builder.count(), + self.struct_count, + msg='There should be {} StructureData, instead {} were/was found'.format( + self.struct_count, builder.count() + ) + ) + for structures in builder.all(): + structure = structures[0] + self.assertEqual(structure.label, self.known_struct_label) + self.assertEqual(structure.cell, self.known_cell) + + builder = orm.QueryBuilder().append(orm.StructureData, project=['attributes.kinds']) + for [kinds] in builder.iterall(): + self.assertEqual(len(kinds), len(self.known_kinds)) + for kind in kinds: + self.assertIn(kind, self.known_kinds, msg="Kind '{}' not found in: {}".format(kind, self.known_kinds)) + + # Check that there is a StructureData that is an input of a CalculationNode + builder = orm.QueryBuilder() + builder.append(orm.StructureData, tag='structure') + builder.append(orm.CalculationNode, with_incoming='structure') + self.assertGreater(len(builder.all()), 0) + + # Check that there is a RemoteData that is the output of a CalculationNode + builder = orm.QueryBuilder() + builder.append(orm.CalculationNode, tag='parent') + builder.append(orm.RemoteData, with_incoming='parent') + self.assertGreater(len(builder.all()), 0) diff --git a/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py b/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py new file mode 100644 index 0000000000..7f48f32090 --- /dev/null +++ b/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +########################################################################### +# Copyright (c), The AiiDA team. All rights reserved. # +# This file is part of the AiiDA code. # +# # +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # +# For further information on the license, see the LICENSE.txt file # +# For further information please visit http://www.aiida.net # +########################################################################### +"""Test export file migration from export version 0.7 to 0.8""" +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import + +from aiida.backends.testbase import AiidaTestCase +from aiida.backends.tests.utils.archives import get_json_files +from aiida.tools.importexport.migration.utils import verify_metadata_version +from aiida.tools.importexport.migration.v07_to_v08 import (migrate_v7_to_v8, migration_default_link_label) + + +class TestMigrateV07toV08(AiidaTestCase): + """Test migration of export files from export version 0.7 to 0.8""" + + @classmethod + def setUpClass(cls, *args, **kwargs): + super(TestMigrateV07toV08, cls).setUpClass(*args, **kwargs) + + # Utility helpers + cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} + cls.core_archive = {'filepath': 'export/migrate'} + + def test_migrate_v7_to_v8(self): + """Test migration for file containing complete v0.7 era possibilities""" + from aiida import get_version + + # Get metadata.json and data.json as dicts from v0.7 file archive + metadata_v7, data_v7 = get_json_files('export_v0.7_simple.aiida', **self.core_archive) + verify_metadata_version(metadata_v7, version='0.7') + + # Get metadata.json and data.json as dicts from v0.8 file archive + metadata_v8, data_v8 = get_json_files('export_v0.8_simple.aiida', **self.core_archive) + verify_metadata_version(metadata_v8, version='0.8') + + # Migrate to v0.8 + migrate_v7_to_v8(metadata_v7, data_v7) + verify_metadata_version(metadata_v7, version='0.8') + + # Remove AiiDA version, since this may change irregardless of the migration function + metadata_v7.pop('aiida_version') + metadata_v8.pop('aiida_version') + + # Assert conversion message in `metadata.json` is correct and then remove it for later assertions + self.maxDiff = None # pylint: disable=invalid-name + conversion_message = 'Converted from version 0.7 to 0.8 with AiiDA v{}'.format(get_version()) + self.assertEqual( + metadata_v7.pop('conversion_info')[-1], + conversion_message, + msg='The conversion message after migration is wrong' + ) + metadata_v8.pop('conversion_info') + + # Assert changes were performed correctly + self.assertDictEqual( + metadata_v7, + metadata_v8, + msg='After migration, metadata.json should equal intended metadata.json from archives' + ) + self.assertDictEqual( + data_v7, data_v8, msg='After migration, data.json should equal intended data.json from archives' + ) + + def test_migrate_v7_to_v8_complete(self): + """Test migration for file containing complete v0.7 era possibilities""" + # Get metadata.json and data.json as dicts from v0.7 file archive + metadata, data = get_json_files('export_v0.7_manual.aiida', **self.external_archive) + verify_metadata_version(metadata, version='0.7') + + # Migrate to v0.8 + migrate_v7_to_v8(metadata, data) + verify_metadata_version(metadata, version='0.8') + + self.maxDiff = None # pylint: disable=invalid-name + # Check that no links have the label '_return', since it should now be 'result' + illegal_label = '_return' + for link in data.get('links_uuid'): + self.assertFalse( + link['label'] == illegal_label, + msg='The illegal link label {} was not expected to be present - ' + "it should now be 'result'".format(illegal_label) + ) + + def test_migration_0043_default_link_label(self): + """Check CorruptArchive is raised for different cases during migration 0040""" + # data has one "valid" link, in the form of . + # data also has one "invalid" link, in form of . + # After the migration, the "invalid" link should have been updated to the "valid" link + data = { + 'links_uuid': [{ + 'input': 'some-random-uuid', + 'output': 'some-other-random-uuid', + 'label': '_return', + 'type': 'return' + }, { + 'input': 'some-random-uuid', + 'output': 'some-other-random-uuid', + 'label': 'a_good_label', + 'type': 'return' + }] + } + + migration_default_link_label(data) + + self.assertEqual( + data, { + 'links_uuid': [{ + 'input': 'some-random-uuid', + 'output': 'some-other-random-uuid', + 'label': 'result', + 'type': 'return' + }, { + 'input': 'some-random-uuid', + 'output': 'some-other-random-uuid', + 'label': 'a_good_label', + 'type': 'return' + }] + } + ) diff --git a/aiida/tools/importexport/common/config.py b/aiida/tools/importexport/common/config.py index 05052375be..d89c5ffca3 100644 --- a/aiida/tools/importexport/common/config.py +++ b/aiida/tools/importexport/common/config.py @@ -18,7 +18,7 @@ __all__ = ('EXPORT_VERSION',) # Current export version -EXPORT_VERSION = '0.7' +EXPORT_VERSION = '0.8' IMPORTGROUP_TYPE = GroupTypeString.IMPORTGROUP_TYPE.value DUPL_SUFFIX = ' (Imported #{})' diff --git a/aiida/tools/importexport/migration/__init__.py b/aiida/tools/importexport/migration/__init__.py index c3da12209c..cd5bfbd260 100644 --- a/aiida/tools/importexport/migration/__init__.py +++ b/aiida/tools/importexport/migration/__init__.py @@ -15,13 +15,14 @@ from aiida.cmdline.utils import echo from aiida.tools.importexport.common.exceptions import DanglingLinkError -from .utils import verify_metadata_version, update_metadata +from .utils import verify_metadata_version from .v01_to_v02 import migrate_v1_to_v2 from .v02_to_v03 import migrate_v2_to_v3 from .v03_to_v04 import migrate_v3_to_v4 from .v04_to_v05 import migrate_v4_to_v5 from .v05_to_v06 import migrate_v5_to_v6 from .v06_to_v07 import migrate_v6_to_v7 +from .v07_to_v08 import migrate_v7_to_v8 __all__ = ('migrate_recursively', 'verify_metadata_version') @@ -31,7 +32,8 @@ '0.3': migrate_v3_to_v4, '0.4': migrate_v4_to_v5, '0.5': migrate_v5_to_v6, - '0.6': migrate_v6_to_v7 + '0.6': migrate_v6_to_v7, + '0.7': migrate_v7_to_v8, } diff --git a/aiida/tools/importexport/migration/utils.py b/aiida/tools/importexport/migration/utils.py index c57299aa7a..96db4cce86 100644 --- a/aiida/tools/importexport/migration/utils.py +++ b/aiida/tools/importexport/migration/utils.py @@ -16,10 +16,9 @@ def verify_metadata_version(metadata, version=None): - """ - Utility function to verify that the metadata has the correct version number. - If no version number is passed, it will just extract the version number - and return it. + """Utility function to verify that the metadata has the correct version number. + + If no version number is passed, it will just extract the version number and return it. :param metadata: the content of an export archive metadata.json file :param version: string version number that the metadata is expected to have @@ -41,9 +40,7 @@ def verify_metadata_version(metadata, version=None): def update_metadata(metadata, version): - """ - Update the metadata with a new version number and a notification of the - conversion that was executed + """Update the metadata with a new version number and a notification of the conversion that was executed. :param metadata: the content of an export archive metadata.json file :param version: string version number that the updated metadata should get @@ -62,8 +59,7 @@ def update_metadata(metadata, version): def remove_fields(metadata, data, entities, fields): - """ - Remove fields under entities from data.json and metadata.json + """Remove fields under entities from data.json and metadata.json. :param metadata: the content of an export archive metadata.json file :param data: the content of an export archive data.json file diff --git a/aiida/tools/importexport/migration/v07_to_v08.py b/aiida/tools/importexport/migration/v07_to_v08.py new file mode 100644 index 0000000000..3e588b811c --- /dev/null +++ b/aiida/tools/importexport/migration/v07_to_v08.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +########################################################################### +# Copyright (c), The AiiDA team. All rights reserved. # +# This file is part of the AiiDA code. # +# # +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # +# For further information on the license, see the LICENSE.txt file # +# For further information please visit http://www.aiida.net # +########################################################################### +"""Migration from v0.7 to v0.8, used by `verdi export migrate` command. + +The migration steps are named similarly to the database migrations for Django and SQLAlchemy. +In the description of each migration, a revision number is given, which refers to the Django migrations. +The individual Django database migrations may be found at: + + `aiida.backends.djsite.db.migrations.00XX_.py` + +Where XX are the numbers in the migrations' documentation: REV. 1.0.XX +And migration-name is the name of the particular migration. +The individual SQLAlchemy database migrations may be found at: + + `aiida.backends.sqlalchemy.migrations.versions._.py` + +Where id is a SQLA id and migration-name is the name of the particular migration. +""" +# pylint: disable=invalid-name +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import + +from aiida.tools.importexport.migration.utils import verify_metadata_version, update_metadata + + +def migration_default_link_label(data): + """Apply migration 0043 - REV. 1.0.43 + + Rename all link labels `_return` to `result`. + """ + for link in data.get('links_uuid', []): + if link['label'] == '_return': + link['label'] = 'result' + + +def migrate_v7_to_v8(metadata, data, *args): # pylint: disable=unused-argument + """Migration of export files from v0.7 to v0.8.""" + old_version = '0.7' + new_version = '0.8' + + verify_metadata_version(metadata, old_version) + update_metadata(metadata, new_version) + + # Apply migrations + migration_default_link_label(data) diff --git a/docs/requirements_for_rtd.txt b/docs/requirements_for_rtd.txt index f044af5df6..1e36e7b3d6 100644 --- a/docs/requirements_for_rtd.txt +++ b/docs/requirements_for_rtd.txt @@ -1,6 +1,6 @@ PyCifRW==4.2.1; python_version < '3' PyCifRW==4.4.1; python_version >= '3' -aiida-export-migration-tests==0.7.0 +aiida-export-migration-tests==0.8.0 aldjemy==0.9.1 alembic==1.2.1 ase==3.17.0 diff --git a/setup.json b/setup.json index f0d3b9bad6..986dd99a68 100644 --- a/setup.json +++ b/setup.json @@ -105,7 +105,7 @@ "notebook<6" ], "testing": [ - "aiida-export-migration-tests==0.7.0", + "aiida-export-migration-tests==0.8.0", "codecov==2.0.15", "coverage==4.5.4", "futures==3.3.0; python_version=='2.7'",