oarepo-runtime 1.3.12__py3-none-any.whl → 1.3.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oarepo_runtime/cli/index.py +4 -0
- oarepo_runtime/datastreams/cli.py +3 -2
- oarepo_runtime/datastreams/datastreams.py +3 -0
- oarepo_runtime/datastreams/fixtures.py +11 -10
- oarepo_runtime/datastreams/writers/service.py +7 -0
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/RECORD +11 -11
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/LICENSE +0 -0
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.3.12.dist-info → oarepo_runtime-1.3.13.dist-info}/top_level.txt +0 -0
oarepo_runtime/cli/index.py
CHANGED
@@ -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
|
|
@@ -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 = {}
|
@@ -10,7 +10,7 @@ oarepo_runtime/cli/__init__.py,sha256=VIbVNJh_r856s4sA4-7hZpmyuQtxPIOGRp1YXjXHsj
|
|
10
10
|
oarepo_runtime/cli/assets.py,sha256=yFpHMAI0fvJBy4wUz1GcNjmfzN_9KegqCj9NgGDfZ9g,1444
|
11
11
|
oarepo_runtime/cli/base.py,sha256=xZMsR2rati5Mz0DZzmnlhVI7E6ePCfnOiTayrxT9cWU,259
|
12
12
|
oarepo_runtime/cli/check.py,sha256=5_dpCDcnVqsjzxDpgDlU5WPRDOpAfiKLrfdBoj0KEgs,2340
|
13
|
-
oarepo_runtime/cli/index.py,sha256=
|
13
|
+
oarepo_runtime/cli/index.py,sha256=bT28rqf_EyuH1MiiFr3WovW6MapG61IGwSfVD_kbtUs,3212
|
14
14
|
oarepo_runtime/cli/validate.py,sha256=hw4aW-DPaZFgvrmeRaIbyKck7w_KypU_6nrnzE8_ibY,1460
|
15
15
|
oarepo_runtime/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
oarepo_runtime/config/permissions_presets.py,sha256=rQcvTsxyPOGtgjWUunE4oSzIwfm4W6VAOOvnYJSJosY,5766
|
@@ -18,11 +18,11 @@ oarepo_runtime/config/service.py,sha256=Js5Dyklqt8diul2HdqoAMxy5Jl6jk2moznHLUDPf
|
|
18
18
|
oarepo_runtime/datastreams/__init__.py,sha256=bscO2zTYf1eEppYx74b54-fcb2wz7YUDjGupqafuFc0,724
|
19
19
|
oarepo_runtime/datastreams/batch.py,sha256=Xe0kXZigDeHU6Sjvo7w4_zjas8lShc2aTJpaAAQ3Iq0,551
|
20
20
|
oarepo_runtime/datastreams/catalogue.py,sha256=QaHLGTzQk76B9q_6vFx1I3fBSGL8SrHni4zA0v2572s,4975
|
21
|
-
oarepo_runtime/datastreams/cli.py,sha256=
|
21
|
+
oarepo_runtime/datastreams/cli.py,sha256=irtL-1ZKlLapiD_Cevh9rcuPg96Rj4PKZgAe_l5XZBs,2075
|
22
22
|
oarepo_runtime/datastreams/config.py,sha256=ALq7otBFMHjT3GV59KpkEV-8ZborWrYLXyB3v5-nFGE,1083
|
23
|
-
oarepo_runtime/datastreams/datastreams.py,sha256=
|
23
|
+
oarepo_runtime/datastreams/datastreams.py,sha256=slEM2GSM4g1WQ-6VwbwkO6GRjMfOp4rON9N2U2YjR4E,6512
|
24
24
|
oarepo_runtime/datastreams/errors.py,sha256=KxtFD2jX8pIoCNYFvh937otySVYjTVCrPSS13AZnVus,690
|
25
|
-
oarepo_runtime/datastreams/fixtures.py,sha256=
|
25
|
+
oarepo_runtime/datastreams/fixtures.py,sha256=hkgu2oy6gZN40CrgiGZKoNghMX1znSxvVMrKSPvB-Ds,5426
|
26
26
|
oarepo_runtime/datastreams/transformers.py,sha256=4COh2cza_n2GKnTM2yJkj9-8KkPK2E1fcyRoUH4S2OY,1204
|
27
27
|
oarepo_runtime/datastreams/readers/__init__.py,sha256=UyKJbymJyfk7rdAAyNI-t2fDKQNz69_5B7KI8RJ2cWE,858
|
28
28
|
oarepo_runtime/datastreams/readers/excel.py,sha256=QP_1a75jlW1udNgBx8FIdWkaoWiTrQ2ysjbi8H1wPmw,3287
|
@@ -30,7 +30,7 @@ oarepo_runtime/datastreams/readers/json.py,sha256=ZZfD71ymnoaAYgsQ67wLdtWUx7rpDE
|
|
30
30
|
oarepo_runtime/datastreams/readers/service.py,sha256=NrlUqjGCtqYekEYVGauYgcNyidorSgX6O6jt3gnWcfs,947
|
31
31
|
oarepo_runtime/datastreams/readers/yaml.py,sha256=15P4faTmtBBpzg8RBJ42pQOP4iWdrrvyZNsEtdQc1UY,332
|
32
32
|
oarepo_runtime/datastreams/writers/__init__.py,sha256=8HIRwHxacUxvluqKxog8pUE1iKMwSqeI9wtlSyfx00E,1366
|
33
|
-
oarepo_runtime/datastreams/writers/service.py,sha256=
|
33
|
+
oarepo_runtime/datastreams/writers/service.py,sha256=r9ybLer6sHVH5M0wlSPzP9Bpw6QhTiZBjRiKEECwel8,2930
|
34
34
|
oarepo_runtime/datastreams/writers/yaml.py,sha256=B4lv-85UYB9K-3B35O1_vsRhH8AdhYfL8IgB3SS1LFw,1312
|
35
35
|
oarepo_runtime/expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
oarepo_runtime/expansions/expandable_fields.py,sha256=7DWKFL6ml8J7zGI6wm9LO7Xd6R0LSylsuq4lyRumNHQ,745
|
@@ -70,9 +70,9 @@ oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
70
70
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
71
71
|
oarepo_runtime/validation/__init__.py,sha256=lU7DgZq8pGD5Pa-QqL9gvLsib3IYtM-Y56k-NwHrPG0,166
|
72
72
|
oarepo_runtime/validation/dates.py,sha256=fahqKGDdIYWux5ZeoljrEe8VD2fDZR9VpfvYmTYAmpw,1050
|
73
|
-
oarepo_runtime-1.3.
|
74
|
-
oarepo_runtime-1.3.
|
75
|
-
oarepo_runtime-1.3.
|
76
|
-
oarepo_runtime-1.3.
|
77
|
-
oarepo_runtime-1.3.
|
78
|
-
oarepo_runtime-1.3.
|
73
|
+
oarepo_runtime-1.3.13.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
74
|
+
oarepo_runtime-1.3.13.dist-info/METADATA,sha256=lPPpdGdmHUNNJjHa0mjEDKPZG3cr-B6Zl9kLbnkgCAw,2552
|
75
|
+
oarepo_runtime-1.3.13.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
76
|
+
oarepo_runtime-1.3.13.dist-info/entry_points.txt,sha256=C32W4eT-8OypMCfwOO5WREioVKSneDfY51D78Uvdbp0,231
|
77
|
+
oarepo_runtime-1.3.13.dist-info/top_level.txt,sha256=Vdo5ohKvEHniyXfcy3hv92nVSYIngDYGQtinWviujlw,15
|
78
|
+
oarepo_runtime-1.3.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|