Skip to content

Commit

Permalink
Update export schema version and temporarily disable export (#2341)
Browse files Browse the repository at this point in the history
The migration after the provenance redesign has been merged into
`provenance_redesign`. To avoid people from importing "dirty" export
files into a cleanly migrated database, the export schema version is
upped. Additionally, creating new export archives with the latest
version is disabled, until the export procedure has been verified to
abide by the new rules in place after the provenance redesign.
  • Loading branch information
sphuber authored Dec 12, 2018
1 parent 42bc788 commit 1673ec2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions aiida/backends/tests/cmdline/commands/test_calcjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import unittest

from click.testing import CliRunner

from aiida.backends.testbase import AiidaTestCase
Expand All @@ -24,6 +27,7 @@ def get_result_lines(result):
return [e for e in result.output.split('\n') if e]


@unittest.skip('reenable when issue #2342 is addressed')
class TestVerdiCalculation(AiidaTestCase):
"""Tests for `verdi calcjob`."""

Expand Down
4 changes: 4 additions & 0 deletions aiida/backends/tests/cmdline/commands/test_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import unittest

from click.testing import CliRunner

from aiida.backends.testbase import AiidaTestCase
Expand All @@ -25,6 +28,7 @@ def get_result_lines(result):
return [e for e in result.output.split('\n') if e]


@unittest.skip('reenable when issue #2342 is addressed')
class TestVerdiCalculation(AiidaTestCase):
"""Tests for `verdi calculation`."""

Expand Down
6 changes: 6 additions & 0 deletions aiida/backends/tests/cmdline/commands/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import tempfile
import tarfile
import traceback
import unittest
import zipfile

from click.testing import CliRunner
Expand Down Expand Up @@ -88,13 +89,15 @@ def tearDownClass(cls, *args, **kwargs):
def setUp(self):
self.cli_runner = CliRunner()

@unittest.skip('reenable when issue #2342 is addressed')
def test_create_file_already_exists(self):
"""Test that using a file that already exists, which is the case when using NamedTemporaryFile, will raise."""
with tempfile.NamedTemporaryFile() as handle:
options = [handle.name]
result = self.cli_runner.invoke(cmd_export.create, options)
self.assertIsNotNone(result.exception)

@unittest.skip('reenable when issue #2342 is addressed')
def test_create_force(self):
"""
Test that using a file that already exists, which is the case when using NamedTemporaryFile, will work
Expand All @@ -109,6 +112,7 @@ def test_create_force(self):
result = self.cli_runner.invoke(cmd_export.create, options)
self.assertIsNone(result.exception, result.output)

@unittest.skip('reenable when issue #2342 is addressed')
def test_create_zip(self):
"""Test that creating an archive for a set of various ORM entities works with the zip format."""
filename = next(tempfile._get_candidate_names()) # pylint: disable=protected-access
Expand All @@ -124,6 +128,7 @@ def test_create_zip(self):
finally:
delete_temporary_file(filename)

@unittest.skip('reenable when issue #2342 is addressed')
def test_create_zip_uncompressed(self):
"""Test that creating an archive for a set of various ORM entities works with the zip-uncompressed format."""
filename = next(tempfile._get_candidate_names()) # pylint: disable=protected-access
Expand All @@ -139,6 +144,7 @@ def test_create_zip_uncompressed(self):
finally:
delete_temporary_file(filename)

@unittest.skip('reenable when issue #2342 is addressed')
def test_create_tar_gz(self):
"""Test that creating an archive for a set of various ORM entities works with the tar.gz format."""
filename = next(tempfile._get_candidate_names()) # pylint: disable=protected-access
Expand Down
2 changes: 2 additions & 0 deletions aiida/backends/tests/export_and_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io
import six
from six.moves import range, zip
import unittest

from aiida.backends.testbase import AiidaTestCase
from aiida.orm.importexport import import_data
Expand Down Expand Up @@ -1557,6 +1558,7 @@ def test_correct_import_of_computer_json_params(self):
shutil.rmtree(export_file_tmp_folder, ignore_errors=True)
shutil.rmtree(unpack_tmp_folder, ignore_errors=True)

@unittest.skip('reenable when issue #2342 is addressed')
def test_import_of_django_sqla_export_file(self):
"""
Check why sqla import manages to import the django export file correctly
Expand Down
2 changes: 2 additions & 0 deletions aiida/cmdline/commands/cmd_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def create(output_file, codes, computers, groups, nodes, input_forward, create_r
"""
from aiida.orm.importexport import export, export_zip

echo.echo_critical('the export functionality is currently disabled until issue #2342 is addressed')

entities = []

if codes:
Expand Down
6 changes: 3 additions & 3 deletions aiida/orm/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def import_data_dj(in_path, ignore_unknown_nodes=False,
import aiida.utils.json as json

# This is the export version expected by this function
expected_export_version = '0.3'
expected_export_version = '0.4'

# The name of the subfolder in which the node files are stored
nodes_export_subfolder = 'nodes'
Expand Down Expand Up @@ -885,7 +885,7 @@ def import_data_sqla(in_path, ignore_unknown_nodes=False, silent=False):
import aiida.utils.json as json

# This is the export version expected by this function
expected_export_version = '0.3'
expected_export_version = '0.4'

# The name of the subfolder in which the node files are stored
nodes_export_subfolder = 'nodes'
Expand Down Expand Up @@ -1727,7 +1727,7 @@ def export_tree(what, folder,allowed_licenses=None, forbidden_licenses=None,
if not silent:
print("STARTING EXPORT...")

EXPORT_VERSION = '0.3'
EXPORT_VERSION = '0.4'

all_fields_info, unique_identifiers = get_all_fields_info()

Expand Down

0 comments on commit 1673ec2

Please sign in to comment.