oarepo-runtime 1.4.19__py3-none-any.whl → 1.4.21__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ from typing import Any, Dict, List, Union
4
4
  import celery
5
5
  from celery.canvas import Signature as CelerySignature
6
6
  from celery.canvas import chain
7
+ from celery.result import allow_join_result
7
8
  from flask_principal import (
8
9
  ActionNeed,
9
10
  Identity,
@@ -196,13 +197,18 @@ def datastreams_call_callback(
196
197
 
197
198
  @celery.shared_task
198
199
  def datastreams_error_callback(
199
- batch: Dict, *, identity=None, callback, callback_name, **kwargs
200
+ parent_task_id, *, identity=None, callback, callback_name, **kwargs
200
201
  ):
201
- callback = CelerySignature(callback)
202
- callback.apply(
203
- kwargs=dict(batch=batch, identity=identity, callback=callback_name, **kwargs)
204
- )
205
- return batch
202
+ with allow_join_result():
203
+ from celery import current_app
204
+ result = current_app.AsyncResult(parent_task_id)
205
+ result.get(propagate=False)
206
+
207
+ callback = CelerySignature(callback)
208
+ callback.apply(
209
+ kwargs=dict(batch={}, identity=identity, callback=callback_name,
210
+ result=result.result, traceback=result.traceback, **kwargs)
211
+ )
206
212
 
207
213
 
208
214
  def _serialize_identity(identity):
@@ -1 +1,11 @@
1
+ from typing import Type
1
2
 
3
+ from invenio_records_resources.records import Record
4
+
5
+
6
+ def select_record_for_update(record_cls: Type[Record], persistent_identifier):
7
+ """Select a record for update."""
8
+ resolved_record = record_cls.pid.resolve(persistent_identifier)
9
+ model_id = resolved_record.model.id
10
+ obj = record_cls.model_cls.query.filter_by(id=model_id).with_for_update().one()
11
+ return record_cls(obj.data, model=obj)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.4.19
3
+ Version: 1.4.21
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -19,7 +19,7 @@ oarepo_runtime/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
19
19
  oarepo_runtime/config/permissions_presets.py,sha256=zApeA-2DYAlD--SzVz3vq_OFjq48Ko0pe08e4o2vxr4,6114
20
20
  oarepo_runtime/config/service.py,sha256=IDDEQJ3LWYBLTFhE_8jPXiinIDNDY52fI0zigDJ_usQ,1095
21
21
  oarepo_runtime/datastreams/__init__.py,sha256=AfkyZSbYjPntHbkH5lhZM-rPpayaiTDK3_b14VE9F4A,837
22
- oarepo_runtime/datastreams/asynchronous.py,sha256=F0rSXVVeqZXXVrh8KznKJMA_5Gaas3tNP2POfx4SL-g,6992
22
+ oarepo_runtime/datastreams/asynchronous.py,sha256=LXGIPQ_2puicY1mWAq52vtLxd8rByqm2202_g1qBfUI,7272
23
23
  oarepo_runtime/datastreams/catalogue.py,sha256=D6leq-FPT3RP3SniEAXPm66v3q8ZdQnaUYJ5XM0dIFY,5021
24
24
  oarepo_runtime/datastreams/datastreams.py,sha256=qO98D3H9W903kgyNoo6FUKZYykbJ78AcdDe42jsPbbo,4140
25
25
  oarepo_runtime/datastreams/errors.py,sha256=WyZLU53EdFJTLv6K2ooM_M6ISjLS-U1dDw6B7guOLSc,1540
@@ -62,7 +62,7 @@ oarepo_runtime/i18n/dumper.py,sha256=PbNFCLsiH4XV3E1v8xga_fzlcEImHy8OXn_UKh_8VBU
62
62
  oarepo_runtime/i18n/schema.py,sha256=wJLyE4Ew4mqEGoMpM6JOsyyqGCV_R4YgWQUm45AHVPU,1184
63
63
  oarepo_runtime/i18n/ui_schema.py,sha256=9r2j9zCG60yVEhcEFaz8TvmNGMAkzaOJFfKri3rtVck,1854
64
64
  oarepo_runtime/i18n/validation.py,sha256=fyMTi2Rw-KiHv7c7HN61zGxRVa9sAjAEEkAL5wUyKNo,236
65
- oarepo_runtime/records/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
65
+ oarepo_runtime/records/__init__.py,sha256=Bxm2XNtB9j6iOAKGSVsjXTKIZS-iXKPzakCqyNkEix8,432
66
66
  oarepo_runtime/records/dumpers/__init__.py,sha256=OmzNhLdMNKibmCksnj9eTX9xPBG30dziiK3j3bAAp3k,233
67
67
  oarepo_runtime/records/dumpers/edtf_interval.py,sha256=YCShZAoqBQYaxVilEVotS-jXZsxxoXO67yu2urhkaMA,1198
68
68
  oarepo_runtime/records/systemfields/__init__.py,sha256=JpDSVry8TWvUNGlR7AXd_D9NDLiVN2xg9qxjNit96Sw,257
@@ -97,9 +97,9 @@ oarepo_runtime/ui/marshmallow.py,sha256=ov96Ooo9n9lFPcUGm8aWzTR5d7LbgCQss1iOAy3z
97
97
  oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
98
  oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
99
99
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
- oarepo_runtime-1.4.19.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
101
- oarepo_runtime-1.4.19.dist-info/METADATA,sha256=L6XjJK304fBXsQoZR76ED0f0wiaQfCHc0RiBXo6XoIQ,4288
102
- oarepo_runtime-1.4.19.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
103
- oarepo_runtime-1.4.19.dist-info/entry_points.txt,sha256=DaNLz4CZpasjXP0PPfPEhVd8Q72_8YBf34st6PHeQn0,238
104
- oarepo_runtime-1.4.19.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
105
- oarepo_runtime-1.4.19.dist-info/RECORD,,
100
+ oarepo_runtime-1.4.21.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
101
+ oarepo_runtime-1.4.21.dist-info/METADATA,sha256=a85YOB_gmWwPZjwmPvJqkbDDPB4eAyglmnn9ruVMdSA,4288
102
+ oarepo_runtime-1.4.21.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
103
+ oarepo_runtime-1.4.21.dist-info/entry_points.txt,sha256=DaNLz4CZpasjXP0PPfPEhVd8Q72_8YBf34st6PHeQn0,238
104
+ oarepo_runtime-1.4.21.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
105
+ oarepo_runtime-1.4.21.dist-info/RECORD,,