pyetp 0.0.33__py3-none-any.whl → 0.0.34__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.
pyetp/client.py CHANGED
@@ -25,7 +25,7 @@ from pyetp.config import SETTINGS
25
25
  from pyetp.types import *
26
26
  from pyetp.uri import DataObjectURI, DataspaceURI
27
27
  from pyetp.utils import short_id, batched
28
- from asyncio import timeout
28
+ #from asyncio import timeout
29
29
 
30
30
  try:
31
31
  # for py >3.11, we can raise grouped exceptions
@@ -34,18 +34,18 @@ except ImportError:
34
34
  def ExceptionGroup(msg, errors):
35
35
  return errors[0]
36
36
 
37
- # try:
38
- # from asyncio import timeout
39
- # except ImportError:
40
- # import async_timeout
41
-
42
- # @asynccontextmanager
43
- # async def timeout(delay: T.Optional[float]) -> T.Any:
44
- # try:
45
- # async with async_timeout.timeout(delay):
46
- # yield None
47
- # except asyncio.CancelledError as e:
48
- # raise asyncio.TimeoutError(f'Timeout ({delay}s)') from e
37
+ try:
38
+ from asyncio import timeout
39
+ except ImportError:
40
+ import async_timeout
41
+ from contextlib import asynccontextmanager
42
+ @asynccontextmanager
43
+ async def timeout(delay: T.Optional[float]) -> T.Any:
44
+ try:
45
+ async with async_timeout.timeout(delay):
46
+ yield None
47
+ except asyncio.CancelledError as e:
48
+ raise asyncio.TimeoutError(f'Timeout ({delay}s)') from e
49
49
 
50
50
 
51
51
  logger = logging.getLogger(__name__)
@@ -502,11 +502,15 @@ class ETPClient(ETPConnection):
502
502
  )
503
503
  async def start_transaction(self, dataspace_uri: DataspaceURI, readOnly :bool= True) -> uuid.UUID:
504
504
  trans_id = await self.send(StartTransaction(readOnly=readOnly, dataspaceUris=[dataspace_uri.raw_uri]))
505
+ if trans_id.successful is False:
506
+ raise Exception(f"Failed starting transaction {dataspace_uri.raw_uri}")
505
507
  return uuid.UUID(bytes=trans_id.transaction_uuid)
506
508
 
507
509
  async def commit_transaction(self, transaction_id: uuid.UUID):
508
- trans_id = await self.send(CommitTransaction(transaction_uuid=transaction_id))
509
- return trans_id
510
+ r = await self.send(CommitTransaction(transaction_uuid=transaction_id))
511
+ if r.successful is False:
512
+ raise Exception(r.failure_reason)
513
+ return r
510
514
 
511
515
  async def rollback_transaction(self, transaction_id: uuid.UUID):
512
516
  return await self.send(RollbackTransaction(transactionUuid=transaction_id))
@@ -1001,6 +1005,7 @@ class ETPClient(ETPConnection):
1001
1005
  buffer[slices] = array
1002
1006
  return
1003
1007
  coro = [populate(starts, counts) for starts, counts in self._get_chunk_sizes(buffer_shape, dtype, offset)]
1008
+ logger.debug(f"Concurrent request: {self.max_concurrent_requests}")
1004
1009
  for i in batched(coro, self.max_concurrent_requests):
1005
1010
  await asyncio.gather(*i)
1006
1011
  # r = await asyncio.gather(*[
@@ -1020,6 +1025,7 @@ class ETPClient(ETPConnection):
1020
1025
  params.append([starts, counts])
1021
1026
  #await self.put_subarray(uid, data, starts, counts)
1022
1027
  coro.append(self.put_subarray(uid, data, starts, counts))
1028
+ logger.debug(f"Concurrent request: {self.max_concurrent_requests}")
1023
1029
  for i in batched(coro, self.max_concurrent_requests):
1024
1030
  await asyncio.gather(*i)
1025
1031
  #r = await asyncio.gather(*coro)
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyetp
3
- Version: 0.0.33
3
+ Version: 0.0.34
4
4
  Summary: Interface with OSDU RDDMS using ETP protocol
5
5
  Author: Adam Cheng
6
6
  Author-email: 52572642+adamchengtkc@users.noreply.github.com
7
- Requires-Python: >=3.11,<3.13
7
+ Requires-Python: >=3.10,<3.13
8
8
  Classifier: Development Status :: 3 - Alpha
9
9
  Classifier: License :: OSI Approved :: Apache Software License
10
10
  Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
11
12
  Classifier: Programming Language :: Python :: 3.11
12
13
  Classifier: Programming Language :: Python :: 3.12
13
14
  Requires-Dist: async-lru (>=2.0.4,<3.0.0)
@@ -1,5 +1,5 @@
1
1
  pyetp/__init__.py,sha256=FSlPJ3AXoMe3vDQ0z8k417aKJWwt7sxbNPsLgdc21tI,123
2
- pyetp/client.py,sha256=71DV3WPXpOX4fL119aR_5z09L3NDsS5zMP1mSMHGr9s,46154
2
+ pyetp/client.py,sha256=u3Uwu5KkHgFA66HlQFxa5I9ExLS-R2zjOFE4yx6kNW8,46522
3
3
  pyetp/config.py,sha256=BmCWo09GXO9CoAwtmmmAflNeRHF-5d14JFwsBBrKnQA,865
4
4
  pyetp/resqml_objects/__init__.py,sha256=Sr_1bktzS8JMmE9oi6pcW6BuERm7gH0u50rBs58zI7Q,50492
5
5
  pyetp/resqml_objects/generated.py,sha256=P-hfL8btOE6uAmtaGXbSdWMl8Z9iJx-r6FRzSvmzHvU,783914
@@ -8,7 +8,7 @@ pyetp/uri.py,sha256=6NE_-QvtaL_z5NCUbxehc28ul-70DgXpMiEGaIJPqNc,2996
8
8
  pyetp/utils.py,sha256=4U_9ndZGzN3B0xMoeSglmxdg7jgfYP5v_mE6tF2Lqmc,518
9
9
  pyetp/utils_arrays.py,sha256=HHhw23La4SG7UJyd5Q_OJ5WlMq98QpwHBk553YyyYOk,4331
10
10
  pyetp/utils_xml.py,sha256=VLTelVsUZrUDZEGES4xMU8MA9zSW-C83IDiHD_B8wT0,33861
11
- pyetp-0.0.33.dist-info/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- pyetp-0.0.33.dist-info/METADATA,sha256=38-PLw8E-sAbkpTIdZqzyviKXEXlIPvO9m7adac2NHw,2293
13
- pyetp-0.0.33.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
- pyetp-0.0.33.dist-info/RECORD,,
11
+ pyetp-0.0.34.dist-info/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ pyetp-0.0.34.dist-info/METADATA,sha256=VotCsnjZDnEZzQ0PD6zmqxT7qnfSvBLoXplV-Gf48JU,2344
13
+ pyetp-0.0.34.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
+ pyetp-0.0.34.dist-info/RECORD,,
File without changes