oarepo-runtime 1.3.10__tar.gz → 1.3.13__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {oarepo-runtime-1.3.10/oarepo_runtime.egg-info → oarepo-runtime-1.3.13}/PKG-INFO +1 -1
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/check.py +28 -18
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/index.py +4 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/cli.py +3 -2
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/datastreams.py +3 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/fixtures.py +11 -10
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/service.py +7 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13/oarepo_runtime.egg-info}/PKG-INFO +1 -1
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/setup.cfg +1 -1
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/LICENSE +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/MANIFEST.in +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/README.md +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/cli.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/mappings.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/assets.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/base.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/validate.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/config/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/config/permissions_presets.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/config/service.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/batch.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/catalogue.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/config.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/errors.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/excel.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/json.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/service.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/transformers.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/expandable_fields.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/service.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/ext.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/ext_config.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/base.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/date.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/enum.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/max_facet.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/nested_facet.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/params.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/default_translations.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/dumper.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/schema.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/ui_schema.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/validation.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/marshmallow.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/polymorphic.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/base.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/components.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/internal.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/lookup.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/mapping.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/pid_relation.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/uow.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/resolvers/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/resolvers/proxies.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/tasks/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/tasks/datastreams.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/messages.pot +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/ui/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/ui/marshmallow.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/utils/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/utils/path.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/validation/__init__.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/validation/dates.py +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/SOURCES.txt +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/entry_points.txt +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/requires.txt +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/top_level.txt +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/pyproject.toml +0 -0
- {oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/setup.py +0 -0
@@ -6,6 +6,7 @@ from flask import current_app
|
|
6
6
|
from flask.cli import with_appcontext
|
7
7
|
from invenio_files_rest.models import Location
|
8
8
|
from invenio_pidstore.models import PersistentIdentifier
|
9
|
+
from invenio_db import db
|
9
10
|
from invenio_records_resources.proxies import current_service_registry
|
10
11
|
from opensearchpy import TransportError
|
11
12
|
|
@@ -32,18 +33,21 @@ def check(output_file):
|
|
32
33
|
|
33
34
|
def check_database():
|
34
35
|
try:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
36
|
+
db.session.begin()
|
37
|
+
try:
|
38
|
+
PersistentIdentifier.query.all()[:1]
|
39
|
+
except:
|
40
|
+
return 'not_initialized'
|
41
|
+
alembic = current_app.extensions['invenio-db'].alembic
|
42
|
+
context = alembic.migration_context
|
43
|
+
db_heads = set(context.get_current_heads())
|
44
|
+
source_heads = [x.revision for x in alembic.current()]
|
45
|
+
for h in source_heads:
|
46
|
+
if h not in db_heads:
|
47
|
+
return 'migration_pending'
|
48
|
+
return 'ok'
|
49
|
+
finally:
|
50
|
+
db.session.rollback()
|
47
51
|
|
48
52
|
def check_opensearch():
|
49
53
|
services = current_service_registry._services.keys()
|
@@ -63,9 +67,15 @@ def check_opensearch():
|
|
63
67
|
|
64
68
|
|
65
69
|
def check_files():
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
try:
|
71
|
+
db.session.begin()
|
72
|
+
# check that there is the default location and that is readable
|
73
|
+
default_location = Location.get_default()
|
74
|
+
if default_location:
|
75
|
+
return 'ok'
|
76
|
+
else:
|
77
|
+
return 'default-location-missing'
|
78
|
+
except:
|
79
|
+
return 'db-error'
|
80
|
+
finally:
|
81
|
+
db.session.rollback()
|
@@ -19,12 +19,13 @@ def fixtures():
|
|
19
19
|
@click.argument("fixture_dir", required=False)
|
20
20
|
@click.option("--include", multiple=True)
|
21
21
|
@click.option("--exclude", multiple=True)
|
22
|
+
@click.option("--system-fixtures/--no-system-fixtures", default=True, is_flag=True)
|
22
23
|
@with_appcontext
|
23
|
-
def load(fixture_dir=None, include=None, exclude=None):
|
24
|
+
def load(fixture_dir=None, include=None, exclude=None, system_fixtures=None):
|
24
25
|
"""Loads fixtures"""
|
25
26
|
with current_app.wsgi_app.mounts["/api"].app_context():
|
26
27
|
results: FixturesResult = load_fixtures(
|
27
|
-
fixture_dir, _make_list(include), _make_list(exclude)
|
28
|
+
fixture_dir, _make_list(include), _make_list(exclude), system_fixtures=system_fixtures
|
28
29
|
)
|
29
30
|
_show_stats(results, "Load fixtures")
|
30
31
|
|
@@ -182,6 +182,9 @@ class DataStream(AbstractDataStream):
|
|
182
182
|
try:
|
183
183
|
writer.write(stream_entry)
|
184
184
|
except WriterError as err:
|
185
|
+
log.error(
|
186
|
+
"Error in writer: %s: %s", err, repr(stream_entry.entry)
|
187
|
+
)
|
185
188
|
stream_entry.errors.append(StreamEntryError.from_exception(err))
|
186
189
|
except Exception as err:
|
187
190
|
log.error(
|
@@ -33,7 +33,7 @@ class FixturesResult:
|
|
33
33
|
self.results[fixture_name] = result
|
34
34
|
|
35
35
|
|
36
|
-
def load_fixtures(fixture_dir=None, include=None, exclude=None) -> FixturesResult:
|
36
|
+
def load_fixtures(fixture_dir=None, include=None, exclude=None, system_fixtures=True) -> FixturesResult:
|
37
37
|
"""
|
38
38
|
Loads fixtures. If fixture dir is set, fixtures are loaded from that directory first.
|
39
39
|
The directory must contain a catalogue.yaml file containing datastreams to load the
|
@@ -55,15 +55,16 @@ def load_fixtures(fixture_dir=None, include=None, exclude=None) -> FixturesResul
|
|
55
55
|
if fixture_dir:
|
56
56
|
catalogue = DataStreamCatalogue(Path(fixture_dir) / "catalogue.yaml")
|
57
57
|
_load_fixtures_from_catalogue(catalogue, fixtures, include, exclude, result)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
if system_fixtures:
|
59
|
+
for r in reversed(
|
60
|
+
sorted(pkg_resources.iter_entry_points("oarepo.fixtures"), key=lambda r: r.name)
|
61
|
+
):
|
62
|
+
pkg = r.load()
|
63
|
+
pkg_fixture_dir = Path(pkg.__file__)
|
64
|
+
if pkg_fixture_dir.is_file():
|
65
|
+
pkg_fixture_dir = pkg_fixture_dir.parent
|
66
|
+
catalogue = DataStreamCatalogue(pkg_fixture_dir / "catalogue.yaml")
|
67
|
+
_load_fixtures_from_catalogue(catalogue, fixtures, include, exclude, result)
|
67
68
|
return result
|
68
69
|
|
69
70
|
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/service.py
RENAMED
@@ -1,3 +1,5 @@
|
|
1
|
+
import traceback
|
2
|
+
|
1
3
|
from invenio_access.permissions import system_identity
|
2
4
|
from invenio_pidstore.errors import PIDAlreadyExists
|
3
5
|
from invenio_records.systemfields.relations.errors import InvalidRelationValue
|
@@ -42,10 +44,12 @@ class ServiceWriter(BaseWriter):
|
|
42
44
|
service_kwargs["uow"] = uow
|
43
45
|
try:
|
44
46
|
try:
|
47
|
+
print("Calling service create")
|
45
48
|
entry = self._service.create(self._identity, entry, **service_kwargs)
|
46
49
|
except PIDAlreadyExists:
|
47
50
|
if not self._update:
|
48
51
|
raise WriterError([f"Entry already exists: {entry}"])
|
52
|
+
print("Calling service update")
|
49
53
|
entry_id = self._entry_id(entry)
|
50
54
|
current = self._resolve(entry_id)
|
51
55
|
updated = dict(current.to_dict(), **entry)
|
@@ -60,6 +64,9 @@ class ServiceWriter(BaseWriter):
|
|
60
64
|
except InvalidRelationValue as err:
|
61
65
|
# TODO: Check if we can get the error message easier
|
62
66
|
raise WriterError([{"InvalidRelationValue": err.args[0]}])
|
67
|
+
except Exception as err:
|
68
|
+
traceback.print_exc()
|
69
|
+
raise WriterError([{"Unknown error": str(err)}])
|
63
70
|
|
64
71
|
def delete(self, stream_entry: StreamEntry, uow=None):
|
65
72
|
service_kwargs = {}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/config/permissions_presets.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/expandable_fields.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.3.10 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|