rucio 37.5.0__py3-none-any.whl → 37.7.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 might be problematic. Click here for more details.

Files changed (202) hide show
  1. rucio/cli/bin_legacy/rucio.py +41 -22
  2. rucio/cli/bin_legacy/rucio_admin.py +1 -1
  3. rucio/cli/did.py +2 -2
  4. rucio/cli/rse.py +2 -3
  5. rucio/cli/rule.py +9 -5
  6. rucio/cli/subscription.py +1 -1
  7. rucio/client/baseclient.py +9 -4
  8. rucio/client/didclient.py +16 -16
  9. rucio/client/downloadclient.py +16 -15
  10. rucio/client/exportclient.py +45 -4
  11. rucio/client/lockclient.py +3 -3
  12. rucio/client/pingclient.py +35 -4
  13. rucio/client/replicaclient.py +2 -2
  14. rucio/client/touchclient.py +3 -2
  15. rucio/client/uploadclient.py +728 -183
  16. rucio/common/cache.py +1 -2
  17. rucio/common/client.py +4 -30
  18. rucio/common/config.py +27 -3
  19. rucio/common/constants.py +5 -1
  20. rucio/common/didtype.py +2 -2
  21. rucio/common/dumper/__init__.py +1 -1
  22. rucio/common/pcache.py +20 -25
  23. rucio/common/plugins.py +12 -19
  24. rucio/common/policy.py +3 -2
  25. rucio/common/schema/__init__.py +11 -8
  26. rucio/common/types.py +7 -5
  27. rucio/common/utils.py +1 -1
  28. rucio/core/account.py +2 -1
  29. rucio/core/account_limit.py +3 -2
  30. rucio/core/authentication.py +1 -1
  31. rucio/core/credential.py +1 -1
  32. rucio/core/did.py +62 -61
  33. rucio/core/did_meta_plugins/__init__.py +10 -10
  34. rucio/core/did_meta_plugins/did_column_meta.py +9 -9
  35. rucio/core/did_meta_plugins/did_meta_plugin_interface.py +3 -3
  36. rucio/core/did_meta_plugins/elasticsearch_meta.py +7 -7
  37. rucio/core/did_meta_plugins/json_meta.py +2 -2
  38. rucio/core/did_meta_plugins/mongo_meta.py +9 -9
  39. rucio/core/did_meta_plugins/postgres_meta.py +7 -7
  40. rucio/core/dirac.py +3 -2
  41. rucio/core/distance.py +2 -1
  42. rucio/core/exporter.py +3 -2
  43. rucio/core/importer.py +5 -5
  44. rucio/core/lifetime_exception.py +2 -2
  45. rucio/core/lock.py +7 -7
  46. rucio/core/meta_conventions.py +2 -2
  47. rucio/core/monitor.py +1 -1
  48. rucio/core/naming_convention.py +1 -1
  49. rucio/core/nongrid_trace.py +2 -2
  50. rucio/core/oidc.py +2 -2
  51. rucio/core/permission/__init__.py +9 -6
  52. rucio/core/permission/generic.py +2 -2
  53. rucio/core/permission/generic_multi_vo.py +2 -2
  54. rucio/core/replica.py +22 -22
  55. rucio/core/request.py +2 -2
  56. rucio/core/rse.py +7 -7
  57. rucio/core/rule.py +38 -38
  58. rucio/core/rule_grouping.py +2 -3
  59. rucio/core/scope.py +1 -1
  60. rucio/core/trace.py +2 -2
  61. rucio/core/transfer.py +2 -2
  62. rucio/core/vo.py +2 -1
  63. rucio/daemons/atropos/atropos.py +2 -1
  64. rucio/daemons/auditor/__init__.py +1 -1
  65. rucio/daemons/automatix/automatix.py +5 -5
  66. rucio/daemons/badreplicas/minos.py +12 -5
  67. rucio/daemons/badreplicas/minos_temporary_expiration.py +5 -2
  68. rucio/daemons/badreplicas/necromancer.py +9 -3
  69. rucio/daemons/bb8/bb8.py +2 -1
  70. rucio/daemons/bb8/common.py +1 -1
  71. rucio/daemons/bb8/nuclei_background_rebalance.py +3 -3
  72. rucio/daemons/bb8/t2_background_rebalance.py +1 -1
  73. rucio/daemons/cache/consumer.py +1 -1
  74. rucio/daemons/conveyor/common.py +3 -3
  75. rucio/daemons/conveyor/finisher.py +13 -4
  76. rucio/daemons/conveyor/poller.py +5 -2
  77. rucio/daemons/conveyor/receiver.py +1 -1
  78. rucio/daemons/conveyor/submitter.py +2 -1
  79. rucio/daemons/follower/follower.py +1 -1
  80. rucio/daemons/hermes/hermes.py +29 -8
  81. rucio/daemons/judge/cleaner.py +2 -2
  82. rucio/daemons/judge/evaluator.py +7 -7
  83. rucio/daemons/judge/injector.py +2 -2
  84. rucio/daemons/judge/repairer.py +2 -2
  85. rucio/daemons/reaper/dark_reaper.py +5 -4
  86. rucio/daemons/reaper/reaper.py +7 -7
  87. rucio/daemons/replicarecoverer/suspicious_replica_recoverer.py +4 -4
  88. rucio/daemons/storage/consistency/actions.py +3 -3
  89. rucio/daemons/tracer/kronos.py +3 -2
  90. rucio/daemons/transmogrifier/transmogrifier.py +71 -69
  91. rucio/daemons/undertaker/undertaker.py +8 -7
  92. rucio/db/sqla/constants.py +4 -3
  93. rucio/db/sqla/migrate_repo/versions/3082b8cef557_add_naming_convention_table_and_closed_.py +1 -1
  94. rucio/db/sqla/migrate_repo/versions/4df2c5ddabc0_remove_temporary_dids.py +1 -1
  95. rucio/db/sqla/migrate_repo/versions/c129ccdb2d5_add_lumiblocknr_to_dids.py +1 -1
  96. rucio/db/sqla/models.py +3 -3
  97. rucio/db/sqla/session.py +7 -7
  98. rucio/db/sqla/util.py +3 -2
  99. rucio/gateway/account.py +77 -101
  100. rucio/gateway/account_limit.py +90 -116
  101. rucio/gateway/authentication.py +9 -8
  102. rucio/gateway/config.py +11 -10
  103. rucio/gateway/credential.py +2 -1
  104. rucio/gateway/did.py +58 -58
  105. rucio/gateway/dirac.py +3 -2
  106. rucio/gateway/exporter.py +2 -1
  107. rucio/gateway/heartbeat.py +3 -2
  108. rucio/gateway/identity.py +4 -3
  109. rucio/gateway/importer.py +2 -1
  110. rucio/gateway/lifetime_exception.py +5 -4
  111. rucio/gateway/lock.py +6 -5
  112. rucio/gateway/meta_conventions.py +3 -2
  113. rucio/gateway/permission.py +2 -1
  114. rucio/gateway/quarantined_replica.py +2 -1
  115. rucio/gateway/replica.py +20 -20
  116. rucio/gateway/request.py +10 -10
  117. rucio/gateway/rse.py +27 -26
  118. rucio/gateway/rule.py +12 -11
  119. rucio/gateway/scope.py +4 -3
  120. rucio/gateway/subscription.py +7 -6
  121. rucio/gateway/vo.py +5 -4
  122. rucio/rse/__init__.py +7 -6
  123. rucio/rse/protocols/ngarc.py +2 -2
  124. rucio/rse/protocols/srm.py +1 -1
  125. rucio/rse/protocols/webdav.py +8 -1
  126. rucio/rse/rsemanager.py +5 -4
  127. rucio/rse/translation.py +2 -2
  128. rucio/tests/common.py +6 -5
  129. rucio/vcsversion.py +3 -3
  130. rucio/web/rest/flaskapi/v1/accountlimits.py +5 -5
  131. rucio/web/rest/flaskapi/v1/accounts.py +20 -20
  132. rucio/web/rest/flaskapi/v1/archives.py +4 -3
  133. rucio/web/rest/flaskapi/v1/common.py +5 -4
  134. rucio/web/rest/flaskapi/v1/dids.py +382 -331
  135. rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +5 -5
  136. rucio/web/rest/flaskapi/v1/locks.py +13 -13
  137. rucio/web/rest/flaskapi/v1/main.py +1 -0
  138. rucio/web/rest/flaskapi/v1/redirect.py +2 -2
  139. rucio/web/rest/flaskapi/v1/replicas.py +16 -16
  140. rucio/web/rest/flaskapi/v1/requests.py +16 -16
  141. rucio/web/rest/flaskapi/v1/subscriptions.py +7 -7
  142. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-account +8 -1
  143. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-rse +8 -1
  144. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-auditor +1 -1
  145. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-throttler +7 -1
  146. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-follower +1 -1
  147. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-cleaner +9 -1
  148. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-necromancer +7 -1
  149. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-replica-recoverer +31 -9
  150. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-undertaker +8 -2
  151. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/METADATA +1 -1
  152. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/RECORD +202 -202
  153. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic.ini.template +0 -0
  154. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
  155. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
  156. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
  157. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
  158. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
  159. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
  160. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
  161. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
  162. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
  163. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
  164. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
  165. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.template +0 -0
  166. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -0
  167. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/requirements.server.txt +0 -0
  168. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/bootstrap.py +0 -0
  169. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
  170. {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/reset_database.py +0 -0
  171. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio +0 -0
  172. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-collection-replica +0 -0
  173. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-admin +0 -0
  174. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-atropos +0 -0
  175. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-automatix +0 -0
  176. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-bb8 +0 -0
  177. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-client +0 -0
  178. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-consumer +0 -0
  179. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-finisher +0 -0
  180. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-poller +0 -0
  181. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-preparer +0 -0
  182. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-receiver +0 -0
  183. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-stager +0 -0
  184. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-submitter +0 -0
  185. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dark-reaper +0 -0
  186. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dumper +0 -0
  187. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-hermes +0 -0
  188. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-evaluator +0 -0
  189. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-injector +0 -0
  190. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-repairer +0 -0
  191. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-kronos +0 -0
  192. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos +0 -0
  193. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
  194. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-oauth-manager +0 -0
  195. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-reaper +0 -0
  196. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-rse-decommissioner +0 -0
  197. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-storage-consistency-actions +0 -0
  198. {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-transmogrifier +0 -0
  199. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/WHEEL +0 -0
  200. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/AUTHORS.rst +0 -0
  201. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/LICENSE +0 -0
  202. {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/top_level.txt +0 -0
@@ -122,8 +122,8 @@ class JSONDidMeta(DidMetaPlugin):
122
122
  """
123
123
  Delete a key from the metadata column
124
124
 
125
- :param scope: the scope of did
126
- :param name: the name of the did
125
+ :param scope: the scope of DID
126
+ :param name: the name of the DID
127
127
  :param key: the key to be deleted
128
128
  :param session: The database session in use.
129
129
  """
@@ -93,9 +93,9 @@ class MongoDidMeta(DidMetaPlugin):
93
93
  :param scope: The scope name
94
94
  :param name: The data identifier name
95
95
  :param session: The database session in use
96
- :returns: The metadata for the did
96
+ :returns: The metadata for the DID
97
97
  """
98
- # get first document with this did == _id
98
+ # get first document with this DID == _id
99
99
  doc = self.col.find_one({
100
100
  "_id": "{}:{}".format(scope.internal, name)
101
101
  })
@@ -113,8 +113,8 @@ class MongoDidMeta(DidMetaPlugin):
113
113
  """
114
114
  Set single metadata key.
115
115
 
116
- :param scope: the scope of did
117
- :param name: the name of the did
116
+ :param scope: the scope of DID
117
+ :param name: the name of the DID
118
118
  :param key: the key to be added
119
119
  :param value: the value of the key to be added
120
120
  :param recursive: recurse into DIDs (not supported)
@@ -126,8 +126,8 @@ class MongoDidMeta(DidMetaPlugin):
126
126
  """
127
127
  Bulk set metadata keys.
128
128
 
129
- :param scope: the scope of did
130
- :param name: the name of the did
129
+ :param scope: the scope of DID
130
+ :param name: the name of the DID
131
131
  :param metadata: dictionary of metadata keypairs to be added
132
132
  :param recursive: recurse into DIDs (not supported)
133
133
  :param session: The database session in use
@@ -137,7 +137,7 @@ class MongoDidMeta(DidMetaPlugin):
137
137
  if key in metadata:
138
138
  metadata.pop(key)
139
139
 
140
- # set first document with did == _id
140
+ # set first document with DID == _id
141
141
  self.col.update_one(
142
142
  {
143
143
  "_id": "{}:{}".format(scope.internal, name)
@@ -157,8 +157,8 @@ class MongoDidMeta(DidMetaPlugin):
157
157
  """
158
158
  Delete a key from metadata.
159
159
 
160
- :param scope: the scope of did
161
- :param name: the name of the did
160
+ :param scope: the scope of DID
161
+ :param name: the name of the DID
162
162
  :param key: the key to be deleted
163
163
  """
164
164
  meta = {key: ""}
@@ -199,7 +199,7 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
199
199
  :param scope: The scope name
200
200
  :param name: The data identifier name
201
201
  :param session: The database session in use
202
- :returns: the metadata for the did
202
+ :returns: the metadata for the DID
203
203
  """
204
204
  statement = sql.SQL("SELECT data from {} WHERE scope = {} AND name = {}").format(
205
205
  sql.Identifier(self.table),
@@ -221,8 +221,8 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
221
221
  """
222
222
  Set single metadata key.
223
223
 
224
- :param scope: the scope of did
225
- :param name: the name of the did
224
+ :param scope: the scope of DID
225
+ :param name: the name of the DID
226
226
  :param key: the key to be added
227
227
  :param value: the value of the key to be added
228
228
  :param recursive: recurse into DIDs (not supported)
@@ -234,8 +234,8 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
234
234
  """
235
235
  Bulk set metadata keys.
236
236
 
237
- :param scope: the scope of did
238
- :param name: the name of the did
237
+ :param scope: the scope of DID
238
+ :param name: the name of the DID
239
239
  :param metadata: dictionary of metadata keypairs to be added
240
240
  :param recursive: recurse into DIDs (not supported)
241
241
  :param session: The database session in use
@@ -262,8 +262,8 @@ class ExternalPostgresJSONDidMeta(DidMetaPlugin):
262
262
  """
263
263
  Delete a key from metadata.
264
264
 
265
- :param scope: the scope of did
266
- :param name: the name of the did
265
+ :param scope: the scope of DID
266
+ :param name: the name of the DID
267
267
  :param key: the key to be deleted
268
268
  :param session: the database session in use
269
269
  """
rucio/core/dirac.py CHANGED
@@ -21,6 +21,7 @@ from sqlalchemy import and_, select
21
21
  from sqlalchemy.exc import NoResultFound
22
22
 
23
23
  from rucio.common.config import config_get
24
+ from rucio.common.constants import DEFAULT_VO
24
25
  from rucio.common.exception import ConfigNotFound, InvalidType, RucioException, UnsupportedOperation
25
26
  from rucio.common.types import InternalAccount, InternalScope
26
27
  from rucio.common.utils import extract_scope
@@ -46,7 +47,7 @@ def _exists(
46
47
  session: "Session"
47
48
  ) -> tuple[bool, Optional[DIDType]]:
48
49
  """
49
- Check if the did exists
50
+ Check if the DID exists
50
51
 
51
52
  :scope: The scope
52
53
  :name: The name
@@ -74,7 +75,7 @@ def add_files(
74
75
  account: str,
75
76
  ignore_availability: bool,
76
77
  parents_metadata: Optional[dict[str, Any]] = None,
77
- vo: str = 'def',
78
+ vo: str = DEFAULT_VO,
78
79
  *,
79
80
  session: "Session"
80
81
  ) -> None:
rucio/core/distance.py CHANGED
@@ -19,6 +19,7 @@ from sqlalchemy.exc import DatabaseError, IntegrityError
19
19
  from sqlalchemy.orm import aliased
20
20
 
21
21
  from rucio.common import exception
22
+ from rucio.common.constants import DEFAULT_VO
22
23
  from rucio.db.sqla.models import RSE, Distance
23
24
  from rucio.db.sqla.session import read_session, transactional_session
24
25
 
@@ -147,7 +148,7 @@ def list_distances(filter_: Optional[dict[str, Any]] = None, *, session: "Sessio
147
148
 
148
149
 
149
150
  @read_session
150
- def export_distances(vo: str = 'def', *, session: "Session") -> dict[str, Any]:
151
+ def export_distances(vo: str = DEFAULT_VO, *, session: "Session") -> dict[str, Any]:
151
152
  """
152
153
  Export distances between all the RSEs using RSE ids.
153
154
  :param vo: The VO to export.
rucio/core/exporter.py CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  from typing import TYPE_CHECKING, Any
16
16
 
17
+ from rucio.common.constants import DEFAULT_VO
17
18
  from rucio.core import distance as distance_module
18
19
  from rucio.core import rse as rse_module
19
20
  from rucio.db.sqla.session import transactional_session
@@ -23,7 +24,7 @@ if TYPE_CHECKING:
23
24
 
24
25
 
25
26
  @transactional_session
26
- def export_rses(vo: str = 'def', *, session: "Session") -> dict[str, dict[str, Any]]:
27
+ def export_rses(vo: str = DEFAULT_VO, *, session: "Session") -> dict[str, dict[str, Any]]:
27
28
  """
28
29
  Export RSE data.
29
30
 
@@ -39,7 +40,7 @@ def export_rses(vo: str = 'def', *, session: "Session") -> dict[str, dict[str, A
39
40
 
40
41
 
41
42
  @transactional_session
42
- def export_data(vo: str = 'def', distance: bool = True, *, session: "Session") -> dict[str, Any]:
43
+ def export_data(vo: str = DEFAULT_VO, distance: bool = True, *, session: "Session") -> dict[str, Any]:
43
44
  """
44
45
  Export data.
45
46
 
rucio/core/importer.py CHANGED
@@ -17,7 +17,7 @@ from typing import TYPE_CHECKING, Any
17
17
  from sqlalchemy import select
18
18
 
19
19
  from rucio.common.config import config_get
20
- from rucio.common.constants import RseAttr
20
+ from rucio.common.constants import DEFAULT_VO, RseAttr
21
21
  from rucio.common.exception import RSEOperationNotSupported
22
22
  from rucio.common.types import InternalAccount
23
23
  from rucio.core import account as account_module
@@ -35,7 +35,7 @@ if TYPE_CHECKING:
35
35
 
36
36
 
37
37
  @transactional_session
38
- def import_rses(rses: dict[str, dict[str, Any]], rse_sync_method: str = 'edit', attr_sync_method: str = 'edit', protocol_sync_method: str = 'edit', vo: str = 'def', *, session: "Session") -> None:
38
+ def import_rses(rses: dict[str, dict[str, Any]], rse_sync_method: str = 'edit', attr_sync_method: str = 'edit', protocol_sync_method: str = 'edit', vo: str = DEFAULT_VO, *, session: "Session") -> None:
39
39
  new_rses = []
40
40
  for rse_name in rses:
41
41
  rse = rses[rse_name]
@@ -143,7 +143,7 @@ def import_rses(rses: dict[str, dict[str, Any]], rse_sync_method: str = 'edit',
143
143
 
144
144
 
145
145
  @transactional_session
146
- def import_distances(distances, vo: str = 'def', *, session: "Session") -> None:
146
+ def import_distances(distances, vo: str = DEFAULT_VO, *, session: "Session") -> None:
147
147
  for src_rse_name in distances:
148
148
  src = rse_module.get_rse_id(rse=src_rse_name, vo=vo, session=session)
149
149
  for dest_rse_name in distances[src_rse_name]:
@@ -192,7 +192,7 @@ def import_identities(identities: 'Iterable[dict[str, Any]]', account_name: str,
192
192
 
193
193
 
194
194
  @transactional_session
195
- def import_accounts(accounts: 'Iterable[dict[str, Any]]', vo: str = 'def', *, session: "Session") -> None:
195
+ def import_accounts(accounts: 'Iterable[dict[str, Any]]', vo: str = DEFAULT_VO, *, session: "Session") -> None:
196
196
  vo_filter = {'account': InternalAccount(account='*', vo=vo)}
197
197
  old_accounts = {account['account']: account for account in account_module.list_accounts(filter_=vo_filter, session=session)}
198
198
  missing_accounts = [account for account in accounts if account['account'] not in old_accounts]
@@ -234,7 +234,7 @@ def import_accounts(accounts: 'Iterable[dict[str, Any]]', vo: str = 'def', *, se
234
234
 
235
235
 
236
236
  @transactional_session
237
- def import_data(data: dict[str, Any], vo: str = 'def', *, session: "Session") -> None:
237
+ def import_data(data: dict[str, Any], vo: str = DEFAULT_VO, *, session: "Session") -> None:
238
238
  """
239
239
  Import data to add and update records in Rucio.
240
240
 
@@ -85,7 +85,7 @@ def add_exception(
85
85
  """
86
86
  Add exceptions to Lifetime Model.
87
87
 
88
- :param dids: The list of dids
88
+ :param dids: The list of DIDs
89
89
  :param account: The account of the requester.
90
90
  :param pattern: The account.
91
91
  :param comments: The comments associated to the exception.
@@ -160,7 +160,7 @@ def __add_exception(
160
160
  """
161
161
  Add exceptions to Lifetime Model.
162
162
 
163
- :param dids: The list of dids
163
+ :param dids: The list of DIDs
164
164
  :param account: The account of the requester.
165
165
  :param pattern: The pattern of the exception (not used).
166
166
  :param comments: The comments associated to the exception.
rucio/core/lock.py CHANGED
@@ -81,7 +81,7 @@ def get_dataset_locks_bulk(dids: "Iterable[dict[str, Any]]", *, session: "Sessio
81
81
  Get the dataset locks of a list of datasets or containers, recursively
82
82
 
83
83
  :param dids: List of dictionaries {"scope":scope(type:InternalScope), "name":name,
84
- "type":did type(DIDType.DATASET or DIDType.CONTAINER)}, "type" is optional
84
+ "type":DID type(DIDType.DATASET or DIDType.CONTAINER)}, "type" is optional
85
85
  :param session: The db session to use.
86
86
  :return: Generator of lock_info dicts, may contain duplicates
87
87
  """
@@ -156,8 +156,8 @@ def get_replica_locks(scope: InternalScope, name: str, nowait: bool = False, res
156
156
  """
157
157
  Get the active replica locks for a file
158
158
 
159
- :param scope: Scope of the did.
160
- :param name: Name of the did.
159
+ :param scope: Scope of the DID.
160
+ :param name: Name of the DID.
161
161
  :param nowait: Nowait parameter for the FOR UPDATE statement.
162
162
  :param restrict_rses: Possible RSE_ids to filter on.
163
163
  :param session: The db session.
@@ -334,8 +334,8 @@ def successful_transfer(scope: InternalScope, name: str, rse_id: str, nowait: bo
334
334
  """
335
335
  Update the state of all replica locks because of an successful transfer
336
336
 
337
- :param scope: Scope of the did
338
- :param name: Name of the did
337
+ :param scope: Scope of the DID
338
+ :param name: Name of the DID
339
339
  :param rse_id: RSE id
340
340
  :param nowait: Nowait parameter for the for_update queries.
341
341
  :param session: DB Session.
@@ -426,8 +426,8 @@ def failed_transfer(scope: InternalScope, name: str, rse_id: str, error_message:
426
426
  Update the state of all replica locks because of a failed transfer.
427
427
  If a transfer is permanently broken for a rule, the broken_rule_id should be filled which puts this rule into the SUSPENDED state.
428
428
 
429
- :param scope: Scope of the did.
430
- :param name: Name of the did.
429
+ :param scope: Scope of the DID.
430
+ :param name: Name of the DID.
431
431
  :param rse_id: RSE id.
432
432
  :param error_message: The error why this transfer failed.
433
433
  :param broken_rule_id: Id of the rule which will be suspended.
@@ -180,10 +180,10 @@ def list_values(key: str, *, session: "Session") -> list[str]:
180
180
  @read_session
181
181
  def validate_meta(meta: dict, did_type: DIDType, *, session: "Session") -> None:
182
182
  """
183
- Validates metadata for a did.
183
+ Validates metadata for a DID.
184
184
 
185
185
  :param meta: the dictionary of metadata.
186
- :param meta: the type of the did, e.g, DATASET, CONTAINER, FILE.
186
+ :param meta: the type of the DID, e.g, DATASET, CONTAINER, FILE.
187
187
  :param session: The database session in use.
188
188
 
189
189
  :raises InvalidObject:
rucio/core/monitor.py CHANGED
@@ -444,5 +444,5 @@ class MetricManager:
444
444
  for server in self.push_gateways:
445
445
  try:
446
446
  push_to_gateway(server.strip(), job=job, registry=self.registry, grouping_key=grouping_key)
447
- except:
447
+ except Exception:
448
448
  continue
@@ -69,7 +69,7 @@ def add_naming_convention(
69
69
  new_convention.save(session=session)
70
70
  except IntegrityError:
71
71
  raise Duplicate('Naming convention already exists!')
72
- except:
72
+ except Exception:
73
73
  raise RucioException(str(format_exc()))
74
74
 
75
75
 
@@ -59,7 +59,7 @@ ROTATING_LOGGER.addHandler(ROTATING_HANDLER)
59
59
  BROKERS_ALIAS, BROKERS_RESOLVED = [], []
60
60
  try:
61
61
  BROKERS_ALIAS = config_get_list('nongrid-trace', 'brokers')
62
- except:
62
+ except Exception:
63
63
  raise Exception('Could not load brokers from configuration')
64
64
 
65
65
  PORT = config_get_int('nongrid-trace', 'port')
@@ -74,7 +74,7 @@ for broker in BROKERS_ALIAS:
74
74
  try:
75
75
  addrinfos = socket.getaddrinfo(broker, 0, socket.AF_INET, 0, socket.IPPROTO_TCP)
76
76
  BROKERS_RESOLVED = [ai[4][0] for ai in addrinfos]
77
- except:
77
+ except Exception:
78
78
  pass
79
79
 
80
80
  CONNS = []
rucio/core/oidc.py CHANGED
@@ -173,7 +173,7 @@ def __get_rucio_oidc_clients(keytimeout: int = 43200) -> tuple[dict, dict]:
173
173
  try:
174
174
  with open(IDPSECRETS) as client_secret_file:
175
175
  client_secrets = json.load(client_secret_file)
176
- except:
176
+ except Exception:
177
177
  return (clients, admin_clients)
178
178
  for iss in client_secrets:
179
179
  try:
@@ -1426,7 +1426,7 @@ def validate_jwt(json_web_token: str, *, session: "Session") -> dict[str, Any]:
1426
1426
  try:
1427
1427
  token_dict['audience'] = inspect_claims['aud']
1428
1428
  token_dict['authz_scope'] = inspect_claims['scope']
1429
- except:
1429
+ except Exception:
1430
1430
  pass
1431
1431
  METRICS.counter(name='JSONWebToken.valid').inc()
1432
1432
  # if token is valid and coming from known issuer --> check aud and scope and save it if unknown
@@ -20,7 +20,8 @@ from typing import TYPE_CHECKING, Any
20
20
 
21
21
  import rucio.core.permission.generic
22
22
  from rucio.common import config, exception
23
- from rucio.common.plugins import check_policy_package_version
23
+ from rucio.common.constants import DEFAULT_VO
24
+ from rucio.common.plugins import check_policy_module_version
24
25
  from rucio.common.policy import get_policy
25
26
 
26
27
  if TYPE_CHECKING:
@@ -54,9 +55,10 @@ if not multivo:
54
55
  policy = environ['RUCIO_POLICY_PACKAGE']
55
56
  else:
56
57
  policy = config.config_get('policy', 'package', check_config_table=False)
57
- check_policy_package_version(policy)
58
+ package_module = importlib.import_module(policy)
59
+ check_policy_module_version(package_module)
58
60
  policy = policy + ".permission"
59
- except (NoOptionError, NoSectionError):
61
+ except (NoOptionError, NoSectionError, ModuleNotFoundError):
60
62
  # fall back to old system for now
61
63
  policy = 'rucio.core.permission.' + fallback_policy.lower()
62
64
  else:
@@ -79,7 +81,7 @@ if not multivo:
79
81
  except ImportError:
80
82
  raise exception.ErrorLoadingPolicyPackage(policy)
81
83
 
82
- permission_modules["def"] = module
84
+ permission_modules[DEFAULT_VO] = module
83
85
 
84
86
 
85
87
  def load_permission_for_vo(vo: str) -> None:
@@ -91,9 +93,10 @@ def load_permission_for_vo(vo: str) -> None:
91
93
  policy = environ[env_name]
92
94
  else:
93
95
  policy = config.config_get('policy', 'package-' + vo)
94
- check_policy_package_version(policy)
96
+ package_module = importlib.import_module(policy)
97
+ check_policy_module_version(package_module)
95
98
  policy = policy + ".permission"
96
- except (NoOptionError, NoSectionError):
99
+ except (NoOptionError, NoSectionError, ModuleNotFoundError):
97
100
  # fall back to old system for now
98
101
  try:
99
102
  policy = config.config_get('policy', 'permission')
@@ -1086,7 +1086,7 @@ def perm_add_bad_pfns(issuer: "InternalAccount", kwargs: dict[str, Any], *, sess
1086
1086
 
1087
1087
  def perm_remove_did_from_followed(issuer: "InternalAccount", kwargs: dict[str, Any], *, session: "Optional[Session]" = None) -> bool:
1088
1088
  """
1089
- Checks if an account can remove did from followed table.
1089
+ Checks if an account can remove DID from followed table.
1090
1090
 
1091
1091
  :param issuer: Account identifier which issues the command.
1092
1092
  :param kwargs: List of arguments for the action.
@@ -1101,7 +1101,7 @@ def perm_remove_did_from_followed(issuer: "InternalAccount", kwargs: dict[str, A
1101
1101
 
1102
1102
  def perm_remove_dids_from_followed(issuer: "InternalAccount", kwargs: dict[str, Any], *, session: "Optional[Session]" = None) -> bool:
1103
1103
  """
1104
- Checks if an account can bulk remove dids from followed table.
1104
+ Checks if an account can bulk remove DIDs from followed table.
1105
1105
 
1106
1106
  :param issuer: Account identifier which issues the command.
1107
1107
  :param kwargs: List of arguments for the action.
@@ -1055,7 +1055,7 @@ def perm_add_bad_pfns(issuer, kwargs, *, session: "Optional[Session]" = None):
1055
1055
 
1056
1056
  def perm_remove_did_from_followed(issuer, kwargs, *, session: "Optional[Session]" = None):
1057
1057
  """
1058
- Checks if an account can remove did from followed table.
1058
+ Checks if an account can remove DID from followed table.
1059
1059
 
1060
1060
  :param issuer: Account identifier which issues the command.
1061
1061
  :param kwargs: List of arguments for the action.
@@ -1070,7 +1070,7 @@ def perm_remove_did_from_followed(issuer, kwargs, *, session: "Optional[Session]
1070
1070
 
1071
1071
  def perm_remove_dids_from_followed(issuer, kwargs, *, session: "Optional[Session]" = None):
1072
1072
  """
1073
- Checks if an account can bulk remove dids from followed table.
1073
+ Checks if an account can bulk remove DIDs from followed table.
1074
1074
 
1075
1075
  :param issuer: Account identifier which issues the command.
1076
1076
  :param kwargs: List of arguments for the action.
rucio/core/replica.py CHANGED
@@ -41,7 +41,7 @@ import rucio.core.lock
41
41
  from rucio.common import exception
42
42
  from rucio.common.cache import MemcacheRegion
43
43
  from rucio.common.config import config_get, config_get_bool
44
- from rucio.common.constants import RseAttr, SuspiciousAvailability
44
+ from rucio.common.constants import DEFAULT_VO, RseAttr, SuspiciousAvailability
45
45
  from rucio.common.types import InternalAccount, InternalScope, IPDict, LFNDict, is_str_list
46
46
  from rucio.common.utils import add_url_query, chunks, clean_pfns, str_to_date
47
47
  from rucio.core.credential import get_signed_url
@@ -249,7 +249,7 @@ def list_bad_replicas_status(
249
249
  older_than: Optional[datetime] = None,
250
250
  limit: Optional[int] = None,
251
251
  list_pfns: Optional[bool] = False,
252
- vo: str = 'def',
252
+ vo: str = DEFAULT_VO,
253
253
  *,
254
254
  session: "Session"
255
255
  ) -> list[dict[str, Any]]:
@@ -536,7 +536,7 @@ def declare_bad_file_replicas(
536
536
  @read_session
537
537
  def get_pfn_to_rse(
538
538
  pfns: "Iterable[str]",
539
- vo: str = 'def',
539
+ vo: str = DEFAULT_VO,
540
540
  *,
541
541
  session: "Session"
542
542
  ) -> tuple[Optional[str], dict[str, Any], dict[str, list[str]]]:
@@ -711,7 +711,7 @@ def list_bad_replicas(
711
711
  def get_did_from_pfns(
712
712
  pfns: "Iterable[str]",
713
713
  rse_id: Optional[str] = None,
714
- vo: str = 'def',
714
+ vo: str = DEFAULT_VO,
715
715
  *,
716
716
  session: "Session"
717
717
  ) -> 'Iterator[dict[str, dict[str, Any]]]':
@@ -1298,7 +1298,7 @@ def list_replicas(
1298
1298
  session: "Session"
1299
1299
  ) -> tuple[int, Any]:
1300
1300
  """
1301
- Find all FILE dids contained in collections from temp_table and return them in a newly
1301
+ Find all FILE DIDs contained in collections from temp_table and return them in a newly
1302
1302
  created temporary table.
1303
1303
  """
1304
1304
  resolved_files_temp_table = temp_table_mngr(session).create_scope_name_table()
@@ -1391,7 +1391,7 @@ def list_replicas(
1391
1391
  Builds a query which list the replicas of FILEs from users input, but ignores
1392
1392
  collections in the same input.
1393
1393
 
1394
- Note: These FILE dids must be returned to the user even if they don't have replicas,
1394
+ Note: These FILE DIDs must be returned to the user even if they don't have replicas,
1395
1395
  hence the outerjoin against the replicas_subquery.
1396
1396
  """
1397
1397
  return select(
@@ -1426,7 +1426,7 @@ def list_replicas(
1426
1426
  session: "Session"
1427
1427
  ) -> tuple[int, int, int]:
1428
1428
  """
1429
- Find how many files, collections and constituents are among the dids in the temp_table
1429
+ Find how many files, collections and constituents are among the DIDs in the temp_table
1430
1430
  """
1431
1431
  stmt = select(
1432
1432
  func.sum(
@@ -1450,7 +1450,7 @@ def list_replicas(
1450
1450
  if dids:
1451
1451
  filter_ = {'vo': dids[0]['scope'].vo}
1452
1452
  else:
1453
- filter_ = {'vo': 'def'}
1453
+ filter_ = {'vo': DEFAULT_VO}
1454
1454
 
1455
1455
  dids = {(did['scope'], did['name']): did for did in dids} # type: ignore (Deduplicate input)
1456
1456
  if not dids:
@@ -1493,7 +1493,7 @@ def list_replicas(
1493
1493
  nrandom
1494
1494
  # Only try this optimisation if list_replicas was called on collection(s).
1495
1495
  # I didn't consider handling the case when list_replica is called with a mix of
1496
- # file/archive/collection dids: database queries in those cases are more complex
1496
+ # file/archive/collection DIDs: database queries in those cases are more complex
1497
1497
  # and people don't usually call list_replicas with nrandom on file/archive_constituents anyway.
1498
1498
  and (num_files_in_collections and not num_constituents and not num_files)
1499
1499
  # The following code introduces overhead if it fails to pick n random replicas.
@@ -1533,7 +1533,7 @@ def list_replicas(
1533
1533
  )
1534
1534
  session.execute(stmt)
1535
1535
 
1536
- # Fetch all replicas for randomly selected dids and apply filters on python side
1536
+ # Fetch all replicas for randomly selected DIDs and apply filters on python side
1537
1537
  stmt = _list_replicas_for_collection_files_stmt(random_dids_temp_table, replicas_subquery)
1538
1538
  stmt = stmt.order_by('scope', 'name')
1539
1539
  replica_tuples = session.execute(stmt)
@@ -1583,7 +1583,7 @@ def __bulk_add_new_file_dids(
1583
1583
  session: "Session"
1584
1584
  ) -> Literal[True]:
1585
1585
  """
1586
- Bulk add new dids.
1586
+ Bulk add new DIDs.
1587
1587
 
1588
1588
  :param dids: the list of new files.
1589
1589
  :param account: The account owner.
@@ -1636,7 +1636,7 @@ def __bulk_add_file_dids(
1636
1636
  session: "Session"
1637
1637
  ) -> list[dict[str, Any]]:
1638
1638
  """
1639
- Bulk add new dids.
1639
+ Bulk add new DIDs.
1640
1640
 
1641
1641
  :param dids: the list of files.
1642
1642
  :param account: The account owner.
@@ -1703,7 +1703,7 @@ def __bulk_add_replicas(
1703
1703
  session: "Session"
1704
1704
  ) -> tuple[int, int]:
1705
1705
  """
1706
- Bulk add new dids.
1706
+ Bulk add new DIDs.
1707
1707
 
1708
1708
  :param rse_id: the RSE id.
1709
1709
  :param dids: the list of files.
@@ -2016,7 +2016,7 @@ def __cleanup_after_replica_deletion(
2016
2016
  session: "Session"
2017
2017
  ) -> None:
2018
2018
  """
2019
- Perform update of collections/archive associations/dids after the removal of their replicas
2019
+ Perform update of collections/archive associations/DIDs after the removal of their replicas
2020
2020
  :param rse_id: the rse id
2021
2021
  :param files: list of files whose replica got deleted
2022
2022
  :param session: The database session in use.
@@ -2080,7 +2080,7 @@ def __cleanup_after_replica_deletion(
2080
2080
  rse_id=rse_id). \
2081
2081
  save(session=session, flush=False)
2082
2082
 
2083
- # Delete did from the content for the last did
2083
+ # Delete DID from the content for the last DID
2084
2084
  while parents_to_analyze:
2085
2085
  did_associations_to_remove = set()
2086
2086
 
@@ -2287,7 +2287,7 @@ def __cleanup_after_replica_deletion(
2287
2287
 
2288
2288
  session.execute(stmt)
2289
2289
 
2290
- # delete empty dids
2290
+ # delete empty DIDs
2291
2291
  if did_condition:
2292
2292
  for chunk in chunks(did_condition, 10):
2293
2293
  stmt = select(
@@ -2426,7 +2426,7 @@ def __cleanup_after_replica_deletion(
2426
2426
  for chunk in chunks(messages, 100):
2427
2427
  add_messages(chunk, session=session)
2428
2428
 
2429
- # Delete dids
2429
+ # Delete DIDs
2430
2430
  dids_to_delete_filter = exists(select(1)
2431
2431
  .where(and_(models.DataIdentifier.scope == scope_name_temp_table.scope,
2432
2432
  models.DataIdentifier.name == scope_name_temp_table.name)))
@@ -2806,7 +2806,7 @@ def touch_replica(
2806
2806
  session: "Session"
2807
2807
  ) -> bool:
2808
2808
  """
2809
- Update the accessed_at timestamp of the given file replica/did but don't wait if row is locked.
2809
+ Update the accessed_at timestamp of the given file replica/DID but don't wait if row is locked.
2810
2810
 
2811
2811
  :param replica: a dictionary with the information of the affected replica.
2812
2812
  :param session: The database session in use.
@@ -2921,8 +2921,8 @@ def get_and_lock_file_replicas(
2921
2921
  """
2922
2922
  Get file replicas for a specific scope:name.
2923
2923
 
2924
- :param scope: The scope of the did.
2925
- :param name: The name of the did.
2924
+ :param scope: The scope of the DID.
2925
+ :param name: The name of the DID.
2926
2926
  :param nowait: Nowait parameter for the FOR UPDATE statement
2927
2927
  :param restrict_rses: Possible RSE_ids to filter on.
2928
2928
  :param session: The db session in use.
@@ -2957,8 +2957,8 @@ def get_source_replicas(
2957
2957
  """
2958
2958
  Get source replicas for a specific scope:name.
2959
2959
 
2960
- :param scope: The scope of the did.
2961
- :param name: The name of the did.
2960
+ :param scope: The scope of the DID.
2961
+ :param name: The name of the DID.
2962
2962
  :param soruce_rses: Possible RSE_ids to filter on.
2963
2963
  :param session: The db session in use.
2964
2964
  :returns: List of SQLAlchemy Replica Objects
rucio/core/request.py CHANGED
@@ -31,7 +31,7 @@ from sqlalchemy.orm import aliased
31
31
  from sqlalchemy.sql.expression import asc, false, func, null, true
32
32
 
33
33
  from rucio.common.config import config_get_bool, config_get_int
34
- from rucio.common.constants import RseAttr, TransferLimitDirection
34
+ from rucio.common.constants import DEFAULT_VO, RseAttr, TransferLimitDirection
35
35
  from rucio.common.exception import InvalidRSEExpression, RequestNotFound, RucioException, UnsupportedOperation
36
36
  from rucio.common.types import FilterDict, InternalAccount, InternalScope, LoggerFunction, RequestDict
37
37
  from rucio.common.utils import chunks, generate_uuid
@@ -2918,7 +2918,7 @@ def add_monitor_message(
2918
2918
  if not message.get('vo') and request.get('source_rse_id'):
2919
2919
  src_id = request['source_rse_id']
2920
2920
  vo = get_rse_vo(rse_id=src_id, session=session)
2921
- if vo != 'def':
2921
+ if vo != DEFAULT_VO:
2922
2922
  message['vo'] = vo
2923
2923
  for time_field in ('created_at', 'submitted_at', 'started_at', 'transferred_at'):
2924
2924
  field_value = message[time_field]