oarepo-runtime 1.3.12__tar.gz → 1.3.13__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. {oarepo-runtime-1.3.12/oarepo_runtime.egg-info → oarepo-runtime-1.3.13}/PKG-INFO +1 -1
  2. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/index.py +4 -0
  3. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/cli.py +3 -2
  4. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/datastreams.py +3 -0
  5. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/fixtures.py +11 -10
  6. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/service.py +7 -0
  7. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13/oarepo_runtime.egg-info}/PKG-INFO +1 -1
  8. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/setup.cfg +1 -1
  9. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/LICENSE +0 -0
  10. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/MANIFEST.in +0 -0
  11. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/README.md +0 -0
  12. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/__init__.py +0 -0
  13. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/__init__.py +0 -0
  14. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/cli.py +0 -0
  15. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cf/mappings.py +0 -0
  16. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/__init__.py +0 -0
  17. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/assets.py +0 -0
  18. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/base.py +0 -0
  19. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/check.py +0 -0
  20. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/cli/validate.py +0 -0
  21. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/config/__init__.py +0 -0
  22. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/config/permissions_presets.py +0 -0
  23. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/config/service.py +0 -0
  24. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/__init__.py +0 -0
  25. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/batch.py +0 -0
  26. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/catalogue.py +0 -0
  27. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/config.py +0 -0
  28. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/errors.py +0 -0
  29. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
  30. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/excel.py +0 -0
  31. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/json.py +0 -0
  32. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/service.py +0 -0
  33. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
  34. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/transformers.py +0 -0
  35. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
  36. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
  37. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/__init__.py +0 -0
  38. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/expandable_fields.py +0 -0
  39. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/expansions/service.py +0 -0
  40. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/ext.py +0 -0
  41. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/ext_config.py +0 -0
  42. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/__init__.py +0 -0
  43. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/base.py +0 -0
  44. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/date.py +0 -0
  45. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/enum.py +0 -0
  46. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/max_facet.py +0 -0
  47. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/nested_facet.py +0 -0
  48. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/facets/params.py +0 -0
  49. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/__init__.py +0 -0
  50. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/default_translations.py +0 -0
  51. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/dumper.py +0 -0
  52. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/schema.py +0 -0
  53. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/ui_schema.py +0 -0
  54. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/i18n/validation.py +0 -0
  55. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/marshmallow.py +0 -0
  56. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/polymorphic.py +0 -0
  57. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/__init__.py +0 -0
  58. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/base.py +0 -0
  59. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/components.py +0 -0
  60. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/internal.py +0 -0
  61. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/lookup.py +0 -0
  62. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/mapping.py +0 -0
  63. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/pid_relation.py +0 -0
  64. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/relations/uow.py +0 -0
  65. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/resolvers/__init__.py +0 -0
  66. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/resolvers/proxies.py +0 -0
  67. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/tasks/__init__.py +0 -0
  68. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/tasks/datastreams.py +0 -0
  69. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
  70. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
  71. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
  72. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/translations/messages.pot +0 -0
  73. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/ui/__init__.py +0 -0
  74. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/ui/marshmallow.py +0 -0
  75. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/utils/__init__.py +0 -0
  76. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/utils/path.py +0 -0
  77. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/validation/__init__.py +0 -0
  78. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime/validation/dates.py +0 -0
  79. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/SOURCES.txt +0 -0
  80. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
  81. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/entry_points.txt +0 -0
  82. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/requires.txt +0 -0
  83. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/oarepo_runtime.egg-info/top_level.txt +0 -0
  84. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/pyproject.toml +0 -0
  85. {oarepo-runtime-1.3.12 → oarepo-runtime-1.3.13}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.3.12
3
+ Version: 1.3.13
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  Provides-Extra: devs
@@ -76,6 +76,10 @@ def reindex(model):
76
76
 
77
77
  service = current_service_registry.get(service_id)
78
78
  record_class = service.config.record_cls
79
+
80
+ if not hasattr(service, 'indexer'):
81
+ continue
82
+
79
83
  try:
80
84
  id_generator = (
81
85
  x[0]
@@ -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
- for r in reversed(
59
- sorted(pkg_resources.iter_entry_points("oarepo.fixtures"), key=lambda r: r.name)
60
- ):
61
- pkg = r.load()
62
- pkg_fixture_dir = Path(pkg.__file__)
63
- if pkg_fixture_dir.is_file():
64
- pkg_fixture_dir = pkg_fixture_dir.parent
65
- catalogue = DataStreamCatalogue(pkg_fixture_dir / "catalogue.yaml")
66
- _load_fixtures_from_catalogue(catalogue, fixtures, include, exclude, result)
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 = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.3.12
3
+ Version: 1.3.13
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  Provides-Extra: devs
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = oarepo-runtime
3
- version = 1.3.12
3
+ version = 1.3.13
4
4
  description = A set of runtime extensions of Invenio repository
5
5
  authors = Alzbeta Pokorna
6
6
  readme = README.md
File without changes