service: add create update many #1590
Annotations
41 errors and 2 warnings
Tests (3.8, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:00.284736+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:44:50.360408+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.8, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:00.284736+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:01.550246+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.8, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.8, pypi, redis, postgresql14, opensearch2)
Process completed with exit code 1.
|
Tests (3.9, pypi, redis, postgresql13, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:00.618599+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:44:56.487005+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.9, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:00.618599+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:08.000347+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.9, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.9, pypi, redis, postgresql13, elasticsearch7)
The operation was canceled.
|
Tests (3.9, pypi, redis, postgresql14, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, postgresql14, elasticsearch7):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:02.642042+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:44:55.088083+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.9, pypi, redis, postgresql14, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:02.638042+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:06.374681+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.9, pypi, redis, postgresql14, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.9, pypi, redis, postgresql14, elasticsearch7)
The operation was canceled.
|
Tests (3.9, pypi, redis, postgresql13, opensearch2)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, postgresql14, opensearch2)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, postgresql13, opensearch2):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:02.646909+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:45:00.517532+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.9, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:02.669396+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:45:02.113917+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.9, pypi, redis, postgresql13, opensearch2):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:02.646909+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:12.253457+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.9, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:02.669396+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:13.450798+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.9, pypi, redis, postgresql13, opensearch2):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.9, pypi, redis, postgresql13, opensearch2)
The operation was canceled.
|
Tests (3.9, pypi, redis, postgresql14, opensearch2):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.9, pypi, redis, postgresql14, opensearch2)
The operation was canceled.
|
Tests (3.8, pypi, redis, postgresql13, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.8, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/uow.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:42:02.432331+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/uow.py 2024-07-16 07:45:02.869177+00:00
@@ -180,19 +180,19 @@
"""Run the operation."""
if self._indexer is not None:
arguments = {"refresh": True} if self._index_refresh else {}
self._indexer.index(self._record, arguments=arguments)
+
class RecordBulkCommitOp(Operation):
"""Record bulk commit operation with indexing."""
def __init__(self, records, indexer=None, index_refresh=False):
"""Initialize the bulk record commit operation."""
self._records = records
self._indexer = indexer
self._index_refresh = index_refresh
-
def on_register(self, uow):
"""Save objects to the session."""
for record in self._records:
json = record._validate()
@@ -203,10 +203,11 @@
def on_commit(self, uow):
"""Run the operation."""
if self._indexer is not None:
record_ids = [record.id for record in self._records]
self._indexer.bulk_index(record_ids)
+
class RecordIndexOp(RecordCommitOp):
"""Record indexing operation."""
def on_register(self, uow):
|
Tests (3.8, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
Black format check
--- /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:42:02.428331+00:00
+++ /home/runner/work/invenio-records-resources/invenio-records-resources/invenio_records_resources/services/records/service.py 2024-07-16 07:45:14.213482+00:00
@@ -580,13 +580,14 @@
)
self.reindex(identity, search_query=search_query)
return True
-
@unit_of_work()
- def create_update_many(self, identity, data, revision_id=None, uow=None, expand=False):
+ def create_update_many(
+ self, identity, data, revision_id=None, uow=None, expand=False
+ ):
"""Replace many records."""
records_to_update = []
records_to_create = []
errors = []
for record_id, record_data in data:
@@ -596,36 +597,38 @@
# Permissions
self.require_permission(identity, "update", record=record)
try:
record_data, _ = self.schema.load(
- record_data, context=dict(identity=identity, pid=record.pid, record=record)
+ record_data,
+ context=dict(identity=identity, pid=record.pid, record=record),
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
# Run components
- self.run_components("update", identity, data=record_data, record=record, uow=uow)
+ self.run_components(
+ "update", identity, data=record_data, record=record, uow=uow
+ )
# Update
-
+
records_to_update.append(record)
except NoResultFound:
try:
self.require_permission(identity, "create")
-
+
# Validate data and create record with pid
record_data, schema_errors = self.schema.load(
- record_data,
- context={"identity": identity}
+ record_data, context={"identity": identity}
)
except ValidationError as err:
errors.append(dict(record=record_data, errors=err.messages))
continue
# TODO add other error handling when adding tests
-
+
# It's the components who saves the actual data in the record.
record = self.record_cls.create({})
# Run components
self.run_components(
@@ -634,11 +637,11 @@
data=record_data,
record=record,
errors=schema_errors,
uow=uow,
)
-
+
records_to_create.append(record)
records = records_to_update + records_to_create
uow.register(RecordBulkCommitOp(records, self.indexer))
|
Tests (3.8, pypi, redis, postgresql13, elasticsearch7):
invenio_records_resources/services/records/service.py#L1
isort-check
from invenio_search.engine import dsl
from kombu import Queue
from marshmallow import ValidationError
+from sqlalchemy.orm.exc import NoResultFound
from werkzeug.local import LocalProxy
from invenio_records_resources.services.errors import (
from ..errors import RevisionIdMismatchError
from ..uow import RecordBulkCommitOp, RecordCommitOp, RecordDeleteOp, unit_of_work
from .schema import ServiceSchemaWrapper
-from sqlalchemy.orm.exc import NoResultFound
class RecordIndexerMixin:
|
Tests (3.8, pypi, redis, postgresql13, elasticsearch7)
The operation was canceled.
|
Tests (3.8, pypi, redis, mysql8, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.8, pypi, redis, mysql8, elasticsearch7)
The operation was canceled.
|
Tests (3.9, pypi, redis, mysql8, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, mysql8, elasticsearch7)
The operation was canceled.
|
Tests (3.8, pypi, redis, postgresql13, opensearch2)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.8, pypi, redis, postgresql13, opensearch2)
The operation was canceled.
|
Tests (3.8, pypi, redis, mysql8, opensearch2)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.8, pypi, redis, mysql8, opensearch2)
The operation was canceled.
|
Tests (3.8, pypi, redis, postgresql14, elasticsearch7)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.8, pypi, redis, postgresql14, elasticsearch7)
The operation was canceled.
|
Tests (3.9, pypi, redis, mysql8, opensearch2)
The job was canceled because "_3_8_pypi_redis_postgre_3" failed.
|
Tests (3.9, pypi, redis, mysql8, opensearch2)
The operation was canceled.
|
Tests (3.8, pypi, redis, postgresql14, opensearch2)
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions/setup-python@v2, actions/cache@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
Tests (3.8, pypi, redis, postgresql14, opensearch2)
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v2, actions/setup-python@v2, actions/cache@v2. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|