rucio-clients 32.8.6__py3-none-any.whl → 35.8.0__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.

Potentially problematic release.


This version of rucio-clients might be problematic. Click here for more details.

Files changed (92) hide show
  1. rucio/__init__.py +0 -1
  2. rucio/alembicrevision.py +1 -2
  3. rucio/client/__init__.py +0 -1
  4. rucio/client/accountclient.py +45 -25
  5. rucio/client/accountlimitclient.py +37 -9
  6. rucio/client/baseclient.py +199 -154
  7. rucio/client/client.py +2 -3
  8. rucio/client/configclient.py +19 -6
  9. rucio/client/credentialclient.py +9 -4
  10. rucio/client/didclient.py +238 -63
  11. rucio/client/diracclient.py +13 -5
  12. rucio/client/downloadclient.py +162 -51
  13. rucio/client/exportclient.py +4 -4
  14. rucio/client/fileclient.py +3 -4
  15. rucio/client/importclient.py +4 -4
  16. rucio/client/lifetimeclient.py +21 -5
  17. rucio/client/lockclient.py +18 -8
  18. rucio/client/{metaclient.py → metaconventionsclient.py} +18 -15
  19. rucio/client/pingclient.py +0 -1
  20. rucio/client/replicaclient.py +15 -5
  21. rucio/client/requestclient.py +35 -19
  22. rucio/client/rseclient.py +133 -51
  23. rucio/client/ruleclient.py +29 -22
  24. rucio/client/scopeclient.py +8 -6
  25. rucio/client/subscriptionclient.py +47 -35
  26. rucio/client/touchclient.py +8 -4
  27. rucio/client/uploadclient.py +166 -82
  28. rucio/common/__init__.py +0 -1
  29. rucio/common/cache.py +4 -4
  30. rucio/common/config.py +52 -47
  31. rucio/common/constants.py +69 -2
  32. rucio/common/constraints.py +0 -1
  33. rucio/common/didtype.py +24 -22
  34. rucio/common/exception.py +281 -222
  35. rucio/common/extra.py +0 -1
  36. rucio/common/logging.py +54 -38
  37. rucio/common/pcache.py +122 -101
  38. rucio/common/plugins.py +153 -0
  39. rucio/common/policy.py +4 -4
  40. rucio/common/schema/__init__.py +17 -10
  41. rucio/common/schema/atlas.py +7 -5
  42. rucio/common/schema/belleii.py +7 -5
  43. rucio/common/schema/domatpc.py +7 -5
  44. rucio/common/schema/escape.py +7 -5
  45. rucio/common/schema/generic.py +8 -6
  46. rucio/common/schema/generic_multi_vo.py +7 -5
  47. rucio/common/schema/icecube.py +7 -5
  48. rucio/common/stomp_utils.py +0 -1
  49. rucio/common/stopwatch.py +0 -1
  50. rucio/common/test_rucio_server.py +2 -2
  51. rucio/common/types.py +262 -17
  52. rucio/common/utils.py +743 -451
  53. rucio/rse/__init__.py +3 -4
  54. rucio/rse/protocols/__init__.py +0 -1
  55. rucio/rse/protocols/bittorrent.py +184 -0
  56. rucio/rse/protocols/cache.py +1 -2
  57. rucio/rse/protocols/dummy.py +1 -2
  58. rucio/rse/protocols/gfal.py +12 -10
  59. rucio/rse/protocols/globus.py +7 -7
  60. rucio/rse/protocols/gsiftp.py +2 -3
  61. rucio/rse/protocols/http_cache.py +1 -2
  62. rucio/rse/protocols/mock.py +1 -2
  63. rucio/rse/protocols/ngarc.py +1 -2
  64. rucio/rse/protocols/posix.py +12 -13
  65. rucio/rse/protocols/protocol.py +116 -52
  66. rucio/rse/protocols/rclone.py +6 -7
  67. rucio/rse/protocols/rfio.py +4 -5
  68. rucio/rse/protocols/srm.py +9 -10
  69. rucio/rse/protocols/ssh.py +8 -9
  70. rucio/rse/protocols/storm.py +2 -3
  71. rucio/rse/protocols/webdav.py +17 -14
  72. rucio/rse/protocols/xrootd.py +23 -17
  73. rucio/rse/rsemanager.py +19 -7
  74. rucio/vcsversion.py +4 -4
  75. rucio/version.py +5 -13
  76. rucio_clients-35.8.0.data/data/requirements.client.txt +15 -0
  77. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/rucio_client/merge_rucio_configs.py +2 -5
  78. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio +87 -85
  79. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio-admin +45 -32
  80. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/METADATA +13 -13
  81. rucio_clients-35.8.0.dist-info/RECORD +88 -0
  82. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/WHEEL +1 -1
  83. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/AUTHORS.rst +3 -0
  84. rucio/common/schema/cms.py +0 -478
  85. rucio/common/schema/lsst.py +0 -423
  86. rucio_clients-32.8.6.data/data/requirements.txt +0 -55
  87. rucio_clients-32.8.6.dist-info/RECORD +0 -88
  88. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rse-accounts.cfg.template +0 -0
  89. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.atlas.client.template +0 -0
  90. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.template +0 -0
  91. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/LICENSE +0 -0
  92. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +13,19 @@
14
13
  # limitations under the License.
15
14
 
16
15
  from json import loads
16
+ from typing import TYPE_CHECKING, Any, Optional
17
17
 
18
18
  from requests.status_codes import codes
19
19
 
20
- from rucio.client.baseclient import BaseClient
21
- from rucio.client.baseclient import choice
20
+ from rucio.client.baseclient import BaseClient, choice
22
21
  from rucio.common.utils import build_url, render_json
23
22
 
23
+ if TYPE_CHECKING:
24
+ from collections.abc import Iterator, Sequence
25
+ from datetime import datetime
26
+
27
+ from rucio.db.sqla.constants import LifetimeExceptionsState
28
+
24
29
 
25
30
  class LifetimeClient(BaseClient):
26
31
 
@@ -28,7 +33,11 @@ class LifetimeClient(BaseClient):
28
33
 
29
34
  LIFETIME_BASEURL = 'lifetime_exceptions'
30
35
 
31
- def list_exceptions(self, exception_id=None, states=None):
36
+ def list_exceptions(
37
+ self,
38
+ exception_id: Optional[str] = None,
39
+ states: Optional['Sequence[LifetimeExceptionsState]'] = None
40
+ ) -> 'Iterator[dict[str, Any]]':
32
41
  """
33
42
  List exceptions to Lifetime Model.
34
43
 
@@ -52,7 +61,14 @@ class LifetimeClient(BaseClient):
52
61
  exc_cls, exc_msg = self._get_exception(headers=result.headers, status_code=result.status_code)
53
62
  raise exc_cls(exc_msg)
54
63
 
55
- def add_exception(self, dids, account, pattern, comments, expires_at):
64
+ def add_exception(
65
+ self,
66
+ dids: list[dict[str, Any]],
67
+ account: str,
68
+ pattern: str,
69
+ comments: str,
70
+ expires_at: 'datetime'
71
+ ) -> dict[str, Any]:
56
72
  """
57
73
  Add exceptions to Lifetime Model.
58
74
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,14 +12,17 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+ from typing import TYPE_CHECKING, Any
16
16
  from urllib.parse import quote_plus
17
17
 
18
18
  from requests.status_codes import codes
19
19
 
20
- from rucio.client.baseclient import BaseClient
21
- from rucio.client.baseclient import choice
20
+ from rucio.client.baseclient import BaseClient, choice
22
21
  from rucio.common.utils import build_url, render_json
23
22
 
23
+ if TYPE_CHECKING:
24
+ from collections.abc import Iterator, Mapping
25
+
24
26
 
25
27
  class LockClient(BaseClient):
26
28
 
@@ -28,7 +30,11 @@ class LockClient(BaseClient):
28
30
 
29
31
  LOCKS_BASEURL = 'locks'
30
32
 
31
- def get_dataset_locks(self, scope, name):
33
+ def get_dataset_locks(
34
+ self,
35
+ scope: str,
36
+ name: str
37
+ ) -> "Iterator[dict[str, Any]]":
32
38
  """
33
39
  Get a dataset locks of the specified dataset.
34
40
 
@@ -48,7 +54,11 @@ class LockClient(BaseClient):
48
54
  status_code=result.status_code)
49
55
  raise exc_cls(exc_msg)
50
56
 
51
- def get_locks_for_dids(self, dids, **filter_args):
57
+ def get_locks_for_dids(
58
+ self,
59
+ dids: list["Mapping[str, Any]"],
60
+ **filter_args: dict[str, Any]
61
+ ) -> list[dict[str, Any]]:
52
62
  """
53
63
  Get list of locks for for all the files found, recursively, in the listed datasets or containers.
54
64
 
@@ -59,8 +69,8 @@ class LockClient(BaseClient):
59
69
  """
60
70
 
61
71
  # convert did list to list of dictionaries
62
-
63
- assert all(did.get("type", "dataset") in ("dataset", "container") for did in dids), "did type can be either 'container' or 'dataset'"
72
+ if not all(did.get("type", "dataset") in ("dataset", "container") for did in dids):
73
+ raise ValueError("DID type can be either 'container' or 'dataset'")
64
74
 
65
75
  path = '/'.join([self.LOCKS_BASEURL, "bulk_locks_for_dids"])
66
76
  url = build_url(choice(self.list_hosts), path=path)
@@ -78,7 +88,7 @@ class LockClient(BaseClient):
78
88
  status_code=result.status_code)
79
89
  raise exc_cls(exc_msg)
80
90
 
81
- def get_dataset_locks_by_rse(self, rse):
91
+ def get_dataset_locks_by_rse(self, rse: str) -> "Iterator[dict[str, Any]]":
82
92
  """
83
93
  Get all dataset locks of the specified rse.
84
94
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,24 +13,27 @@
14
13
  # limitations under the License.
15
14
 
16
15
  from json import dumps, loads
16
+ from typing import TYPE_CHECKING, Optional, Union
17
17
  from urllib.parse import quote_plus
18
18
 
19
19
  from requests.status_codes import codes
20
20
 
21
- from rucio.client.baseclient import BaseClient
22
- from rucio.client.baseclient import choice
21
+ from rucio.client.baseclient import BaseClient, choice
23
22
  from rucio.common.utils import build_url
24
23
 
24
+ if TYPE_CHECKING:
25
+ from rucio.db.sqla.constants import KeyType
25
26
 
26
- class MetaClient(BaseClient):
27
27
 
28
- """Meta client class for working with data identifier attributes"""
28
+ class MetaConventionClient(BaseClient):
29
29
 
30
- META_BASEURL = 'meta'
30
+ """Metadata client class for working with data identifier attributes"""
31
31
 
32
- def add_key(self, key, key_type, value_type=None, value_regexp=None):
32
+ META_BASEURL = 'meta_conventions'
33
+
34
+ def add_key(self, key: str, key_type: Union['KeyType', str], value_type: Optional[str] = None, value_regexp: Optional[str] = None) -> Optional[bool]:
33
35
  """
34
- Sends the request to add a new key.
36
+ Sends the request to add an allowed key for DID metadata (update the DID Metadata Conventions table with a new key).
35
37
 
36
38
  :param key: the name for the new key.
37
39
  :param key_type: the type of the key: all(container, dataset, file), collection(dataset or container), file, derived(compute from file for collection).
@@ -56,9 +58,9 @@ class MetaClient(BaseClient):
56
58
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
57
59
  raise exc_cls(exc_msg)
58
60
 
59
- def list_keys(self):
61
+ def list_keys(self) -> Optional[list[str]]:
60
62
  """
61
- Sends the request to list all keys.
63
+ Sends the request to list all keys for DID Metadata Conventions.
62
64
 
63
65
  :return: a list containing the names of all keys.
64
66
  """
@@ -72,9 +74,10 @@ class MetaClient(BaseClient):
72
74
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
73
75
  raise exc_cls(exc_msg)
74
76
 
75
- def list_values(self, key):
77
+ def list_values(self, key: str) -> Optional[list[str]]:
76
78
  """
77
- Sends the request to list all values for a key.
79
+ Sends the request to lists all allowed values for a DID key (all values for a key in DID Metadata Conventions).
80
+ .
78
81
 
79
82
  :return: a list containing the names of all values for a key.
80
83
  """
@@ -88,9 +91,9 @@ class MetaClient(BaseClient):
88
91
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
89
92
  raise exc_cls(exc_msg)
90
93
 
91
- def add_value(self, key, value):
94
+ def add_value(self, key: str, value: str) -> Optional[bool]:
92
95
  """
93
- Sends the request to add a value to a key.
96
+ Sends the request to add a value for a key in DID Metadata Convention.
94
97
 
95
98
  :param key: the name for key.
96
99
  :param value: the value.
@@ -111,7 +114,7 @@ class MetaClient(BaseClient):
111
114
 
112
115
  def del_value(self, key, value):
113
116
  """
114
- Delete a value for a key.
117
+ Delete a key in the DID Metadata Conventions table.
115
118
 
116
119
  :param key: the name for key.
117
120
  :param value: the value.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,13 +14,13 @@
15
14
 
16
15
  from datetime import datetime
17
16
  from json import dumps, loads
17
+ from typing import Any, Optional
18
18
  from urllib.parse import quote_plus
19
19
 
20
20
  from requests.status_codes import codes
21
21
 
22
- from rucio.client.baseclient import BaseClient
23
- from rucio.client.baseclient import choice
24
- from rucio.common.utils import build_url, render_json, chunks
22
+ from rucio.client.baseclient import BaseClient, choice
23
+ from rucio.common.utils import build_url, chunks, render_json
25
24
 
26
25
 
27
26
  class ReplicaClient(BaseClient):
@@ -235,7 +234,17 @@ class ReplicaClient(BaseClient):
235
234
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
236
235
  raise exc_cls(exc_msg)
237
236
 
238
- def add_replica(self, rse, scope, name, bytes_, adler32, pfn=None, md5=None, meta={}):
237
+ def add_replica(
238
+ self,
239
+ rse: str,
240
+ scope: str,
241
+ name: str,
242
+ bytes_: int,
243
+ adler32: str,
244
+ pfn: Optional[str] = None,
245
+ md5: Optional[str] = None,
246
+ meta: Optional[dict[str, Any]] = None
247
+ ) -> bool:
239
248
  """
240
249
  Add file replicas to a RSE.
241
250
 
@@ -251,6 +260,7 @@ class ReplicaClient(BaseClient):
251
260
  :return: True if files were created successfully.
252
261
 
253
262
  """
263
+ meta = meta or {}
254
264
  dict_ = {'scope': scope, 'name': name, 'bytes': bytes_, 'meta': meta, 'adler32': adler32}
255
265
  if md5:
256
266
  dict_['md5'] = md5
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,24 +12,31 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+ from typing import TYPE_CHECKING, Any, Optional
16
16
  from urllib.parse import quote_plus
17
17
 
18
18
  from requests.status_codes import codes
19
19
 
20
- from rucio.client.baseclient import BaseClient
21
- from rucio.client.baseclient import choice
20
+ from rucio.client.baseclient import BaseClient, choice
22
21
  from rucio.common.utils import build_url
23
22
 
23
+ if TYPE_CHECKING:
24
+ from collections.abc import Iterator, Sequence
25
+
24
26
 
25
27
  class RequestClient(BaseClient):
26
28
 
27
29
  REQUEST_BASEURL = 'requests'
28
30
 
29
- def list_requests(self, src_rse, dst_rse, request_states):
31
+ def list_requests(
32
+ self,
33
+ src_rse: str,
34
+ dst_rse: str,
35
+ request_states: 'Sequence[str]'
36
+ ) -> 'Iterator[dict[str, Any]]':
30
37
  """Return latest request details
31
38
 
32
39
  :return: request information
33
- :rtype: dict
34
40
  """
35
41
  path = '/'.join([self.REQUEST_BASEURL, 'list']) + '?' + '&'.join(['src_rse={}'.format(src_rse), 'dst_rse={}'.format(
36
42
  dst_rse), 'request_states={}'.format(request_states)])
@@ -43,11 +49,17 @@ class RequestClient(BaseClient):
43
49
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
44
50
  raise exc_cls(exc_msg)
45
51
 
46
- def list_requests_history(self, src_rse, dst_rse, request_states, offset=0, limit=100):
52
+ def list_requests_history(
53
+ self,
54
+ src_rse: str,
55
+ dst_rse: str,
56
+ request_states: 'Sequence[str]',
57
+ offset: int = 0,
58
+ limit: int = 100
59
+ ) -> 'Iterator[dict[str, Any]]':
47
60
  """Return historical request details
48
61
 
49
62
  :return: request information
50
- :rtype: dict
51
63
  """
52
64
  path = '/'.join([self.REQUEST_BASEURL, 'history', 'list']) + '?' + '&'.join(['src_rse={}'.format(src_rse), 'dst_rse={}'.format(
53
65
  dst_rse), 'request_states={}'.format(request_states), 'offset={}'.format(offset), 'limit={}'.format(limit)])
@@ -60,21 +72,23 @@ class RequestClient(BaseClient):
60
72
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
61
73
  raise exc_cls(exc_msg)
62
74
 
63
- def list_request_by_did(self, name, rse, scope=None):
75
+ def list_request_by_did(
76
+ self,
77
+ name: str,
78
+ rse: str,
79
+ scope: Optional[str] = None
80
+ ) -> 'Iterator[dict[str, Any]]':
64
81
  """Return latest request details for a DID
65
82
 
66
83
  :param name: DID
67
- :type name: str
68
84
  :param rse: Destination RSE name
69
- :type rse: str
70
85
  :param scope: rucio scope, defaults to None
71
- :param scope: str, optional
72
86
  :raises exc_cls: from BaseClient._get_exception
73
87
  :return: request information
74
- :rtype: dict
75
88
  """
76
89
 
77
- path = '/'.join([self.REQUEST_BASEURL, quote_plus(scope), quote_plus(name), rse])
90
+ if scope is not None:
91
+ path = '/'.join([self.REQUEST_BASEURL, quote_plus(scope), quote_plus(name), rse])
78
92
  url = build_url(choice(self.list_hosts), path=path)
79
93
  r = self._send_request(url, type_='GET')
80
94
 
@@ -84,21 +98,23 @@ class RequestClient(BaseClient):
84
98
  exc_cls, exc_msg = self._get_exception(headers=r.headers, status_code=r.status_code, data=r.content)
85
99
  raise exc_cls(exc_msg)
86
100
 
87
- def list_request_history_by_did(self, name, rse, scope=None):
101
+ def list_request_history_by_did(
102
+ self,
103
+ name: str,
104
+ rse: str,
105
+ scope: Optional[str] = None
106
+ ) -> 'Iterator[dict[str, Any]]':
88
107
  """Return latest request details for a DID
89
108
 
90
109
  :param name: DID
91
- :type name: str
92
110
  :param rse: Destination RSE name
93
- :type rse: str
94
111
  :param scope: rucio scope, defaults to None
95
- :param scope: str, optional
96
112
  :raises exc_cls: from BaseClient._get_exception
97
113
  :return: request information
98
- :rtype: dict
99
114
  """
100
115
 
101
- path = '/'.join([self.REQUEST_BASEURL, 'history', quote_plus(scope), quote_plus(name), rse])
116
+ if scope is not None:
117
+ path = '/'.join([self.REQUEST_BASEURL, 'history', quote_plus(scope), quote_plus(name), rse])
102
118
  url = build_url(choice(self.list_hosts), path=path)
103
119
  r = self._send_request(url, type_='GET')
104
120