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,16 @@
14
13
  # limitations under the License.
15
14
 
16
15
  from json import dumps
16
+ from typing import TYPE_CHECKING, Any, Literal, Optional, Union
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
25
+
24
26
 
25
27
  class SubscriptionClient(BaseClient):
26
28
 
@@ -28,29 +30,31 @@ class SubscriptionClient(BaseClient):
28
30
 
29
31
  SUB_BASEURL = 'subscriptions'
30
32
 
31
- def add_subscription(self, name, account, filter_, replication_rules, comments, lifetime, retroactive, dry_run, priority=3):
33
+ def add_subscription(
34
+ self,
35
+ name: str,
36
+ account: str,
37
+ filter_: dict[str, Any],
38
+ replication_rules: dict[str, Any],
39
+ comments: str,
40
+ lifetime: Union[int, Literal[False]],
41
+ retroactive: bool,
42
+ dry_run: bool,
43
+ priority: int = 3
44
+ ) -> str:
32
45
  """
33
46
  Adds a new subscription which will be verified against every new added file and dataset
34
47
 
35
48
  :param name: Name of the subscription
36
- :type: String
37
49
  :param account: Account identifier
38
- :type account: String
39
50
  :param filter_: Dictionary of attributes by which the input data should be filtered
40
51
  **Example**: ``{'dsn': 'data11_hi*.express_express.*,data11_hi*physics_MinBiasOverlay*', 'account': 'tzero'}``
41
- :type filter_: Dict
42
52
  :param replication_rules: Replication rules to be set : Dictionary with keys copies, rse_expression, weight, rse_expression
43
- :type replication_rules: Dict
44
53
  :param comments: Comments for the subscription
45
- :type comments: String
46
54
  :param lifetime: Subscription's lifetime (days); False if subscription has no lifetime
47
- :type lifetime: Integer or False
48
55
  :param retroactive: Flag to know if the subscription should be applied on previous data
49
- :type retroactive: Boolean
50
56
  :param dry_run: Just print the subscriptions actions without actually executing them (Useful if retroactive flag is set)
51
- :type dry_run: Boolean
52
57
  :param priority: The priority of the subscription (3 by default)
53
- :type priority: Integer
54
58
  """
55
59
  path = self.SUB_BASEURL + '/' + account + '/' + name
56
60
  url = build_url(choice(self.list_hosts), path=path)
@@ -69,17 +73,18 @@ class SubscriptionClient(BaseClient):
69
73
  exc_cls, exc_msg = self._get_exception(headers=result.headers, status_code=result.status_code, data=result.content)
70
74
  raise exc_cls(exc_msg)
71
75
 
72
- def list_subscriptions(self, name=None, account=None):
76
+ def list_subscriptions(
77
+ self,
78
+ name: Optional[str] = None,
79
+ account: Optional[dict[str, Any]] = None
80
+ ) -> Union["Iterator[dict[str, Any]]", list]:
73
81
  """
74
82
  Returns a dictionary with the subscription information :
75
83
  Examples: ``{'status': 'INACTIVE/ACTIVE/BROKEN', 'last_modified_date': ...}``
76
84
 
77
85
  :param name: Name of the subscription
78
- :type: String
79
86
  :param account: Account identifier
80
- :type account: String
81
87
  :returns: Dictionary containing subscription parameter
82
- :rtype: Dict
83
88
  :raises: exception.NotFound if subscription is not found
84
89
  """
85
90
  path = self.SUB_BASEURL
@@ -88,47 +93,50 @@ class SubscriptionClient(BaseClient):
88
93
  if name:
89
94
  path += '/%s' % (name)
90
95
  elif name:
91
- path += '/Name/%s' % (name)
96
+ path += '/name/%s' % (name)
92
97
  else:
93
98
  path += '/'
94
99
  url = build_url(choice(self.list_hosts), path=path)
95
100
  result = self._send_request(url, type_='GET')
96
101
  if result.status_code == codes.ok: # pylint: disable=no-member
97
102
  return self._load_json_data(result)
98
- else:
99
- exc_cls, exc_msg = self._get_exception(headers=result.headers, status_code=result.status_code, data=result.content)
100
- raise exc_cls(exc_msg)
101
-
102
- def update_subscription(self, name, account=None, filter_=None, replication_rules=None, comments=None, lifetime=None, retroactive=None, dry_run=None, priority=None):
103
+ if result.status_code == codes.not_found:
104
+ return []
105
+ exc_cls, exc_msg = self._get_exception(headers=result.headers, status_code=result.status_code, data=result.content)
106
+ raise exc_cls(exc_msg)
107
+
108
+ def update_subscription(
109
+ self,
110
+ name,
111
+ account: Optional[str] = None,
112
+ filter_: Optional[dict[str, Any]] = None,
113
+ replication_rules: Optional[dict[str, Any]] = None,
114
+ comments: Optional[str] = None,
115
+ lifetime: Optional[Union[int, Literal[False]]] = None,
116
+ retroactive: Optional[bool] = None,
117
+ dry_run: Optional[bool] = None,
118
+ priority: Optional[int] = None
119
+ ) -> Literal[True]:
103
120
  """
104
121
  Updates a subscription
105
122
 
106
123
  :param name: Name of the subscription
107
- :type: String
108
124
  :param account: Account identifier
109
- :type account: String
110
125
  :param filter_: Dictionary of attributes by which the input data should be filtered
111
126
  **Example**: ``{'dsn': 'data11_hi*.express_express.*,data11_hi*physics_MinBiasOverlay*', 'account': 'tzero'}``
112
- :type filter_: Dict
113
127
  :param replication_rules: Replication rules to be set : Dictionary with keys copies, rse_expression, weight, rse_expression
114
- :type replication_rules: Dict
115
128
  :param comments: Comments for the subscription
116
- :type comments: String
117
129
  :param lifetime: Subscription's lifetime (days); False if subscription has no lifetime
118
- :type lifetime: Integer or False
119
130
  :param retroactive: Flag to know if the subscription should be applied on previous data
120
- :type retroactive: Boolean
121
131
  :param dry_run: Just print the subscriptions actions without actually executing them (Useful if retroactive flag is set)
122
- :type dry_run: Boolean
123
132
  :param priority: The priority of the subscription
124
- :type priority: Integer
125
133
  :raises: exception.NotFound if subscription is not found
126
134
  """
127
135
  if not account:
128
136
  account = self.account
129
137
  if retroactive:
130
138
  raise NotImplementedError('Retroactive mode is not implemented')
131
- path = self.SUB_BASEURL + '/' + account + '/' + name
139
+ path = self.SUB_BASEURL + '/' + account + '/' + name # type: ignore
132
140
  url = build_url(choice(self.list_hosts), path=path)
133
141
  if filter_ and not isinstance(filter_, dict):
134
142
  raise TypeError('filter should be a dict')
@@ -143,7 +151,11 @@ class SubscriptionClient(BaseClient):
143
151
  exc_cls, exc_msg = self._get_exception(headers=result.headers, status_code=result.status_code, data=result.content)
144
152
  raise exc_cls(exc_msg)
145
153
 
146
- def list_subscription_rules(self, account, name):
154
+ def list_subscription_rules(
155
+ self,
156
+ account: str,
157
+ name: str
158
+ ) -> "Iterator[dict[str, Any]]":
147
159
  """
148
160
  List the associated rules of a subscription.
149
161
 
@@ -151,7 +163,7 @@ class SubscriptionClient(BaseClient):
151
163
  :param name: Name of the subscription.
152
164
  """
153
165
 
154
- path = '/'.join([self.SUB_BASEURL, account, name, 'Rules'])
166
+ path = '/'.join([self.SUB_BASEURL, account, name, 'rules'])
155
167
  url = build_url(choice(self.list_hosts), path=path)
156
168
  result = self._send_request(url, type_='GET')
157
169
  if result.status_code == codes.ok: # pylint: disable=no-member
@@ -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,11 +13,11 @@
14
13
  # limitations under the License.
15
14
 
16
15
  from json import dumps
16
+ from typing import Optional
17
17
 
18
18
  from requests import post
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.exception import RucioException, UnsupportedDIDType
23
22
 
24
23
 
@@ -32,7 +31,12 @@ class TouchClient(BaseClient):
32
31
  DIDS_BASEURL = 'dids'
33
32
  TRACES_BASEURL = 'traces'
34
33
 
35
- def touch(self, scope, name, rse=None):
34
+ def touch(
35
+ self,
36
+ scope: str,
37
+ name: str,
38
+ rse: Optional[str] = None
39
+ ) -> None:
36
40
  """
37
41
  Sends a touch trace for a given file or dataset.
38
42