rucio 37.4.0__py3-none-any.whl → 37.6.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 (179) hide show
  1. rucio/cli/bin_legacy/rucio.py +1 -1
  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/subscription.py +1 -1
  6. rucio/client/baseclient.py +5 -1
  7. rucio/client/didclient.py +16 -16
  8. rucio/client/downloadclient.py +15 -15
  9. rucio/client/lockclient.py +3 -3
  10. rucio/client/replicaclient.py +2 -2
  11. rucio/client/requestclient.py +6 -5
  12. rucio/client/touchclient.py +1 -1
  13. rucio/client/uploadclient.py +725 -181
  14. rucio/common/config.py +1 -2
  15. rucio/common/constants.py +16 -17
  16. rucio/common/didtype.py +2 -2
  17. rucio/common/dumper/__init__.py +1 -1
  18. rucio/common/pcache.py +20 -25
  19. rucio/common/plugins.py +10 -17
  20. rucio/common/schema/__init__.py +7 -5
  21. rucio/common/utils.py +19 -3
  22. rucio/core/authentication.py +1 -1
  23. rucio/core/credential.py +1 -1
  24. rucio/core/did.py +54 -54
  25. rucio/core/did_meta_plugins/__init__.py +10 -10
  26. rucio/core/did_meta_plugins/did_column_meta.py +9 -9
  27. rucio/core/did_meta_plugins/did_meta_plugin_interface.py +3 -3
  28. rucio/core/did_meta_plugins/elasticsearch_meta.py +7 -7
  29. rucio/core/did_meta_plugins/json_meta.py +2 -2
  30. rucio/core/did_meta_plugins/mongo_meta.py +9 -9
  31. rucio/core/did_meta_plugins/postgres_meta.py +7 -7
  32. rucio/core/dirac.py +1 -1
  33. rucio/core/lifetime_exception.py +2 -2
  34. rucio/core/lock.py +7 -7
  35. rucio/core/meta_conventions.py +2 -2
  36. rucio/core/monitor.py +1 -1
  37. rucio/core/naming_convention.py +1 -1
  38. rucio/core/nongrid_trace.py +2 -2
  39. rucio/core/oidc.py +2 -2
  40. rucio/core/permission/__init__.py +7 -5
  41. rucio/core/permission/generic.py +5 -2
  42. rucio/core/permission/generic_multi_vo.py +2 -2
  43. rucio/core/replica.py +18 -18
  44. rucio/core/request.py +2 -2
  45. rucio/core/rule.py +30 -30
  46. rucio/core/rule_grouping.py +2 -3
  47. rucio/core/scope.py +1 -1
  48. rucio/core/trace.py +2 -2
  49. rucio/core/transfer.py +4 -5
  50. rucio/daemons/auditor/__init__.py +1 -1
  51. rucio/daemons/badreplicas/minos.py +9 -3
  52. rucio/daemons/badreplicas/minos_temporary_expiration.py +5 -2
  53. rucio/daemons/badreplicas/necromancer.py +9 -3
  54. rucio/daemons/bb8/common.py +1 -1
  55. rucio/daemons/bb8/nuclei_background_rebalance.py +1 -1
  56. rucio/daemons/bb8/t2_background_rebalance.py +1 -1
  57. rucio/daemons/cache/consumer.py +1 -1
  58. rucio/daemons/conveyor/finisher.py +13 -4
  59. rucio/daemons/conveyor/poller.py +5 -2
  60. rucio/daemons/conveyor/receiver.py +1 -1
  61. rucio/daemons/conveyor/throttler.py +2 -1
  62. rucio/daemons/follower/follower.py +1 -1
  63. rucio/daemons/hermes/hermes.py +2 -2
  64. rucio/daemons/judge/cleaner.py +2 -2
  65. rucio/daemons/judge/evaluator.py +7 -7
  66. rucio/daemons/judge/injector.py +2 -2
  67. rucio/daemons/judge/repairer.py +2 -2
  68. rucio/daemons/replicarecoverer/suspicious_replica_recoverer.py +1 -1
  69. rucio/daemons/storage/consistency/actions.py +3 -3
  70. rucio/daemons/transmogrifier/transmogrifier.py +1 -1
  71. rucio/daemons/undertaker/undertaker.py +6 -6
  72. rucio/db/sqla/constants.py +4 -3
  73. rucio/db/sqla/migrate_repo/versions/13d4f70c66a9_introduce_transfer_limits.py +1 -1
  74. rucio/db/sqla/migrate_repo/versions/3082b8cef557_add_naming_convention_table_and_closed_.py +1 -1
  75. rucio/db/sqla/migrate_repo/versions/4df2c5ddabc0_remove_temporary_dids.py +1 -1
  76. rucio/db/sqla/migrate_repo/versions/c129ccdb2d5_add_lumiblocknr_to_dids.py +1 -1
  77. rucio/db/sqla/models.py +2 -2
  78. rucio/db/sqla/session.py +7 -7
  79. rucio/gateway/account.py +65 -90
  80. rucio/gateway/did.py +26 -26
  81. rucio/gateway/dirac.py +1 -1
  82. rucio/gateway/lifetime_exception.py +1 -1
  83. rucio/gateway/replica.py +2 -2
  84. rucio/gateway/request.py +13 -12
  85. rucio/rse/protocols/ngarc.py +2 -2
  86. rucio/rse/protocols/srm.py +1 -1
  87. rucio/rse/protocols/webdav.py +8 -1
  88. rucio/rse/rsemanager.py +2 -2
  89. rucio/tests/common.py +4 -4
  90. rucio/vcsversion.py +3 -3
  91. rucio/web/rest/flaskapi/v1/accountlimits.py +22 -22
  92. rucio/web/rest/flaskapi/v1/accounts.py +177 -177
  93. rucio/web/rest/flaskapi/v1/archives.py +10 -10
  94. rucio/web/rest/flaskapi/v1/auth.py +106 -106
  95. rucio/web/rest/flaskapi/v1/common.py +1 -1
  96. rucio/web/rest/flaskapi/v1/config.py +37 -37
  97. rucio/web/rest/flaskapi/v1/credentials.py +25 -25
  98. rucio/web/rest/flaskapi/v1/dids.py +391 -391
  99. rucio/web/rest/flaskapi/v1/dirac.py +8 -8
  100. rucio/web/rest/flaskapi/v1/export.py +6 -6
  101. rucio/web/rest/flaskapi/v1/heartbeats.py +14 -14
  102. rucio/web/rest/flaskapi/v1/identities.py +25 -25
  103. rucio/web/rest/flaskapi/v1/import.py +19 -19
  104. rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +54 -54
  105. rucio/web/rest/flaskapi/v1/locks.py +62 -62
  106. rucio/web/rest/flaskapi/v1/main.py +1 -0
  107. rucio/web/rest/flaskapi/v1/meta_conventions.py +29 -29
  108. rucio/web/rest/flaskapi/v1/nongrid_traces.py +4 -4
  109. rucio/web/rest/flaskapi/v1/ping.py +4 -4
  110. rucio/web/rest/flaskapi/v1/redirect.py +16 -16
  111. rucio/web/rest/flaskapi/v1/replicas.py +282 -282
  112. rucio/web/rest/flaskapi/v1/requests.py +274 -270
  113. rucio/web/rest/flaskapi/v1/rses.py +427 -427
  114. rucio/web/rest/flaskapi/v1/rules.py +129 -129
  115. rucio/web/rest/flaskapi/v1/scopes.py +21 -21
  116. rucio/web/rest/flaskapi/v1/subscriptions.py +120 -120
  117. rucio/web/rest/flaskapi/v1/traces.py +18 -18
  118. rucio/web/rest/flaskapi/v1/vos.py +32 -32
  119. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/requirements.server.txt +1 -1
  120. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-abacus-account +8 -1
  121. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-abacus-rse +8 -1
  122. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-auditor +1 -1
  123. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-throttler +7 -1
  124. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-follower +1 -1
  125. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-judge-cleaner +9 -1
  126. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-necromancer +7 -1
  127. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-replica-recoverer +31 -9
  128. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-undertaker +8 -2
  129. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/METADATA +1 -1
  130. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/RECORD +179 -179
  131. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/WHEEL +1 -1
  132. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/alembic.ini.template +0 -0
  133. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
  134. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
  135. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
  136. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
  137. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
  138. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
  139. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
  140. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
  141. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
  142. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
  143. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
  144. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/rucio.cfg.template +0 -0
  145. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -0
  146. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/tools/bootstrap.py +0 -0
  147. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
  148. {rucio-37.4.0.data → rucio-37.6.0.data}/data/rucio/tools/reset_database.py +0 -0
  149. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio +0 -0
  150. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-abacus-collection-replica +0 -0
  151. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-admin +0 -0
  152. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-atropos +0 -0
  153. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-automatix +0 -0
  154. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-bb8 +0 -0
  155. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-cache-client +0 -0
  156. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-cache-consumer +0 -0
  157. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-finisher +0 -0
  158. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-poller +0 -0
  159. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-preparer +0 -0
  160. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-receiver +0 -0
  161. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-stager +0 -0
  162. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-conveyor-submitter +0 -0
  163. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-dark-reaper +0 -0
  164. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-dumper +0 -0
  165. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-hermes +0 -0
  166. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-judge-evaluator +0 -0
  167. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-judge-injector +0 -0
  168. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-judge-repairer +0 -0
  169. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-kronos +0 -0
  170. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-minos +0 -0
  171. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
  172. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-oauth-manager +0 -0
  173. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-reaper +0 -0
  174. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-rse-decommissioner +0 -0
  175. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-storage-consistency-actions +0 -0
  176. {rucio-37.4.0.data → rucio-37.6.0.data}/scripts/rucio-transmogrifier +0 -0
  177. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/licenses/AUTHORS.rst +0 -0
  178. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/licenses/LICENSE +0 -0
  179. {rucio-37.4.0.dist-info → rucio-37.6.0.dist-info}/top_level.txt +0 -0
rucio/core/rule.py CHANGED
@@ -191,7 +191,7 @@ def add_rule(
191
191
  logger: LoggerFunction = logging.log
192
192
  ) -> list[str]:
193
193
  """
194
- Adds a replication rule for every did in dids
194
+ Adds a replication rule for every DID in DIDs
195
195
 
196
196
  :param dids: List of data identifiers.
197
197
  :param account: Account issuing the rule.
@@ -277,7 +277,7 @@ def add_rule(
277
277
  notify_value = {'Y': RuleNotification.YES, 'C': RuleNotification.CLOSE, 'P': RuleNotification.PROGRESS}.get(notify or '', RuleNotification.NO)
278
278
 
279
279
  for elem in dids:
280
- # 3. Get the did
280
+ # 3. Get the DID
281
281
  with METRICS.timer('add_rule.get_did'):
282
282
  try:
283
283
  stmt = select(
@@ -292,7 +292,7 @@ def add_rule(
292
292
  except TypeError as error:
293
293
  raise InvalidObject(error.args) from error # https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/raise-missing-from.html
294
294
 
295
- # 3.1 If the did is a constituent, relay the rule to the archive
295
+ # 3.1 If the DID is a constituent, relay the rule to the archive
296
296
  if did.did_type == DIDType.FILE and did.constituent:
297
297
  # Check if a single replica of this DID exists; Do not put rule on file if there are only replicas on TAPE
298
298
  stmt = select(
@@ -407,7 +407,7 @@ def add_rule(
407
407
  logger(logging.DEBUG, "Forced injection of rule %s", str(new_rule.id))
408
408
 
409
409
  if asynchronous or delay_injection:
410
- # TODO: asynchronous mode only available for closed dids (on the whole tree?)
410
+ # TODO: asynchronous mode only available for closed DIDs (on the whole tree?)
411
411
  new_rule.state = RuleState.INJECT
412
412
  logger(logging.DEBUG, "Created rule %s for injection", str(new_rule.id))
413
413
  if delay_injection:
@@ -485,7 +485,7 @@ def add_rules(
485
485
  logger: LoggerFunction = logging.log
486
486
  ) -> dict[tuple[InternalScope, str], list[str]]:
487
487
  """
488
- Adds a list of replication rules to every did in dids
488
+ Adds a list of replication rules to every DID in DIDs
489
489
 
490
490
  :params dids: List of data identifiers.
491
491
  :param rules: List of dictionaries defining replication rules.
@@ -521,7 +521,7 @@ def add_rules(
521
521
  all_source_rses = list(set([rse['id'] for rse in all_source_rses]))
522
522
 
523
523
  for elem in dids:
524
- # 2. Get the did
524
+ # 2. Get the DID
525
525
  with METRICS.timer('add_rules.get_did'):
526
526
  try:
527
527
  stmt = select(
@@ -536,7 +536,7 @@ def add_rules(
536
536
  except TypeError as error:
537
537
  raise InvalidObject(error.args) from error
538
538
 
539
- # 2.1 If the did is a constituent, relay the rule to the archive
539
+ # 2.1 If the DID is a constituent, relay the rule to the archive
540
540
  if did.did_type == DIDType.FILE and did.constituent: # Check if a single replica of this DID exists
541
541
  stmt = select(
542
542
  func.count()
@@ -584,7 +584,7 @@ def add_rules(
584
584
 
585
585
  rule_ids[(elem['scope'], elem['name'])] = []
586
586
 
587
- # 3. Resolve the did into its contents
587
+ # 3. Resolve the DID into its contents
588
588
  with METRICS.timer('add_rules.resolve_dids_to_locks_replicas'):
589
589
  # Get all Replicas, not only the ones interesting for the rse_expression
590
590
  datasetfiles, locks, replicas, source_replicas = __resolve_did_to_locks_and_replicas(did=did,
@@ -828,7 +828,7 @@ def inject_rule(
828
828
  dids = [{'scope': dataset['scope'], 'name': dataset['name']} for dataset in rucio.core.did.list_child_datasets(scope=rule.scope, name=rule.name, session=session)]
829
829
  # Remove duplicates from the list of dictionaries
830
830
  dids = [dict(t) for t in {tuple(d.items()) for d in dids}]
831
- # Remove dids which already have a similar rule
831
+ # Remove DIDs which already have a similar rule
832
832
  stmt = select(
833
833
  models.ReplicationRule.id
834
834
  ).where(
@@ -881,7 +881,7 @@ def inject_rule(
881
881
  with METRICS.timer('inject_rule.create_rse_selector'):
882
882
  rseselector = RSESelector(account=rule['account'], rses=rses, weight=rule.weight, copies=rule.copies, ignore_account_limit=rule.ignore_account_limit, session=session)
883
883
 
884
- # 3. Get the did
884
+ # 3. Get the DID
885
885
  with METRICS.timer('inject_rule.get_did'):
886
886
  try:
887
887
  stmt = select(
@@ -1104,7 +1104,7 @@ def list_associated_rules_for_file(
1104
1104
  :param session: The database session in use.
1105
1105
  :raises: RucioException
1106
1106
  """
1107
- rucio.core.did.get_did(scope=scope, name=name, session=session) # Check if the did actually exists
1107
+ rucio.core.did.get_did(scope=scope, name=name, session=session) # Check if the DID actually exists
1108
1108
  stmt = select(
1109
1109
  models.ReplicationRule,
1110
1110
  models.DataIdentifier.bytes
@@ -1364,7 +1364,7 @@ def repair_rule(
1364
1364
  rule.locks_stuck_cnt = count.state_counter
1365
1365
  logger(logging.DEBUG, "Finished resetting counters for rule %s [%d/%d/%d]", str(rule.id), rule.locks_ok_cnt, rule.locks_replicating_cnt, rule.locks_stuck_cnt)
1366
1366
 
1367
- # Get the did
1367
+ # Get the DID
1368
1368
  stmt = select(
1369
1369
  models.DataIdentifier
1370
1370
  ).where(
@@ -1387,7 +1387,7 @@ def repair_rule(
1387
1387
  hard_repair = True
1388
1388
  logger(logging.DEBUG, 'Repairing rule %s in HARD mode', str(rule.id))
1389
1389
 
1390
- # Resolve the did to its contents
1390
+ # Resolve the DID to its contents
1391
1391
  datasetfiles, locks, replicas, source_replicas = __resolve_did_to_locks_and_replicas(did=did,
1392
1392
  nowait=True,
1393
1393
  restrict_rses=[rse['id'] for rse in rses],
@@ -2060,10 +2060,10 @@ def re_evaluate_did(
2060
2060
  logger: LoggerFunction = logging.log
2061
2061
  ) -> None:
2062
2062
  """
2063
- Re-Evaluates a did.
2063
+ Re-Evaluates a DID.
2064
2064
 
2065
- :param scope: The scope of the did to be re-evaluated.
2066
- :param name: The name of the did to be re-evaluated.
2065
+ :param scope: The scope of the DID to be re-evaluated.
2066
+ :param name: The name of the DID to be re-evaluated.
2067
2067
  :param rule_evaluation_action: The Rule evaluation action.
2068
2068
  :param session: The database session in use.
2069
2069
  :param logger: Optional decorated logger that can be passed from the calling daemons or servers.
@@ -2086,7 +2086,7 @@ def re_evaluate_did(
2086
2086
  else:
2087
2087
  __evaluate_did_detach(did, session=session, logger=logger)
2088
2088
 
2089
- # Update size and length of did
2089
+ # Update size and length of DID
2090
2090
  if session.bind.dialect.name == 'oracle':
2091
2091
  stmt = select(
2092
2092
  func.sum(models.DataIdentifierAssociation.bytes),
@@ -2118,12 +2118,12 @@ def get_updated_dids(
2118
2118
  session: "Session"
2119
2119
  ) -> list[tuple[str, InternalScope, str, DIDReEvaluation]]:
2120
2120
  """
2121
- Get updated dids.
2121
+ Get updated DIDs.
2122
2122
 
2123
2123
  :param total_workers: Number of total workers.
2124
2124
  :param worker_number: id of the executing worker.
2125
- :param limit: Maximum number of dids to return.
2126
- :param blocked_dids: Blocked dids to filter.
2125
+ :param limit: Maximum number of DIDs to return.
2126
+ :param blocked_dids: Blocked DIDs to filter.
2127
2127
  :param session: Database session in use.
2128
2128
  """
2129
2129
  blocked_dids = blocked_dids or []
@@ -2135,7 +2135,7 @@ def get_updated_dids(
2135
2135
  )
2136
2136
  stmt = filter_thread_work(session=session, query=stmt, total_threads=total_workers, thread_id=worker_number, hash_variable='name')
2137
2137
 
2138
- # Remove blocked dids from query, but only do the first 30 ones, not to overload the query
2138
+ # Remove blocked DIDs from query, but only do the first 30 ones, not to overload the query
2139
2139
  if blocked_dids:
2140
2140
  chunk = list(chunks(blocked_dids, 30))[0]
2141
2141
  stmt = stmt.where(tuple_(models.UpdatedDID.scope, models.UpdatedDID.name).notin_(chunk))
@@ -3403,9 +3403,9 @@ def __evaluate_did_detach(
3403
3403
  logger: LoggerFunction = logging.log
3404
3404
  ) -> None:
3405
3405
  """
3406
- Evaluate a parent did which has children removed.
3406
+ Evaluate a parent DID which has children removed.
3407
3407
 
3408
- :param eval_did: The did object in use.
3408
+ :param eval_did: The DID object in use.
3409
3409
  :param session: The database session in use.
3410
3410
  :param logger: Optional decorated logger that can be passed from the calling daemons or servers.
3411
3411
  """
@@ -3563,9 +3563,9 @@ def __evaluate_did_attach(
3563
3563
  logger: LoggerFunction = logging.log
3564
3564
  ) -> None:
3565
3565
  """
3566
- Evaluate a parent did which has new children
3566
+ Evaluate a parent DID which has new children
3567
3567
 
3568
- :param eval_did: The did object in use.
3568
+ :param eval_did: The DID object in use.
3569
3569
  :param session: The database session in use.
3570
3570
  :param logger: Optional decorated logger that can be passed from the calling daemons or servers.
3571
3571
  :raises: ReplicationRuleCreationTemporaryFailed
@@ -3793,7 +3793,7 @@ def __evaluate_did_attach(
3793
3793
  # Insert rule history
3794
3794
  insert_rule_history(rule=rule, recent=True, longterm=False, session=session)
3795
3795
 
3796
- # Unflage the dids
3796
+ # Unflag the DIDs
3797
3797
  with METRICS.timer('evaluate_did_attach.update_did'):
3798
3798
  for did in new_child_dids:
3799
3799
  did.rule_evaluation = None
@@ -3815,9 +3815,9 @@ def __resolve_did_to_locks_and_replicas(
3815
3815
  dict[tuple[str, str], models.RSEFileAssociation],
3816
3816
  dict[tuple[str, str], str]]:
3817
3817
  """
3818
- Resolves a did to its constituent children and reads the locks and replicas of all the constituent files.
3818
+ Resolves a DID to its constituent children and reads the locks and replicas of all the constituent files.
3819
3819
 
3820
- :param did: The db object of the did the rule is applied on.
3820
+ :param did: The db object of the DID the rule is applied on.
3821
3821
  :param nowait: Nowait parameter for the FOR UPDATE statement.
3822
3822
  :param restrict_rses: Possible rses of the rule, so only these replica/locks should be considered.
3823
3823
  :param source_rses: Source rses for this rule. These replicas are not row-locked.
@@ -3922,7 +3922,7 @@ def __resolve_dids_to_locks_and_replicas(
3922
3922
  dict[tuple[str, str], models.RSEFileAssociation],
3923
3923
  dict[tuple[str, str], str]]:
3924
3924
  """
3925
- Resolves a list of dids to its constituent children and reads the locks and replicas of all the constituent files.
3925
+ Resolves a list of DIDs to its constituent children and reads the locks and replicas of all the constituent files.
3926
3926
 
3927
3927
  :param dids: The list of DataIdentifierAssociation objects.
3928
3928
  :param nowait: Nowait parameter for the FOR UPDATE statement.
@@ -3940,7 +3940,7 @@ def __resolve_dids_to_locks_and_replicas(
3940
3940
  restrict_rses = restrict_rses or []
3941
3941
 
3942
3942
  if dids[0].child_type == DIDType.FILE:
3943
- # All the dids will be files!
3943
+ # All the DIDs will be files!
3944
3944
  # Prepare the datasetfiles
3945
3945
  files = []
3946
3946
  for did in dids:
@@ -1317,9 +1317,9 @@ def __set_replica_unavailable(replica, *, session: "Session"):
1317
1317
  @transactional_session
1318
1318
  def apply_rule(did, rule, rses, source_rses, rseselector, *, session: "Session", logger=logging.log):
1319
1319
  """
1320
- Apply a replication rule to one did.
1320
+ Apply a replication rule to one DID.
1321
1321
 
1322
- :param did: the did object
1322
+ :param did: the DID object
1323
1323
  :param rule: the rule object
1324
1324
  :param rses: target rses_ids
1325
1325
  :param source_rses: source rses_ids
@@ -1616,4 +1616,3 @@ def apply_rule(did, rule, rses, source_rses, rseselector, *, session: "Session",
1616
1616
  for rse_id in account_counters_files:
1617
1617
  account_counter.increase(rse_id=rse_id, account=rule.account, files=account_counters_files[rse_id], bytes_=account_counters_bytes[rse_id], session=session)
1618
1618
  session.flush()
1619
-
rucio/core/scope.py CHANGED
@@ -65,7 +65,7 @@ def add_scope(scope, account, *, session: "Session"):
65
65
  raise Duplicate('Scope \'%s\' already exists!' % scope)
66
66
  else:
67
67
  raise RucioException(e)
68
- except:
68
+ except Exception:
69
69
  raise RucioException(str(format_exc()))
70
70
 
71
71
 
rucio/core/trace.py CHANGED
@@ -71,7 +71,7 @@ ROTATING_LOGGER.addHandler(ROTATING_HANDLER)
71
71
  BROKERS_ALIAS, BROKERS_RESOLVED = [], []
72
72
  try:
73
73
  BROKERS_ALIAS = config_get_list('trace', 'brokers')
74
- except:
74
+ except Exception:
75
75
  raise Exception('Could not load brokers from configuration')
76
76
 
77
77
  PORT = config_get_int('trace', 'port')
@@ -285,7 +285,7 @@ for broker in BROKERS_ALIAS:
285
285
  try:
286
286
  addrinfos = socket.getaddrinfo(broker, 0, socket.AF_INET, 0, socket.IPPROTO_TCP)
287
287
  BROKERS_RESOLVED = [ai[4][0] for ai in addrinfos]
288
- except:
288
+ except Exception:
289
289
  pass
290
290
 
291
291
  CONNS = []
rucio/core/transfer.py CHANGED
@@ -27,11 +27,10 @@ from dogpile.cache.api import NoValue
27
27
  from sqlalchemy import select, update
28
28
  from sqlalchemy.exc import IntegrityError
29
29
 
30
- from rucio.common import constants
31
30
  from rucio.common.config import config_get, config_get_list
32
- from rucio.common.constants import SUPPORTED_PROTOCOLS, RseAttr
31
+ from rucio.common.constants import SUPPORTED_PROTOCOLS, RseAttr, TransferLimitDirection
33
32
  from rucio.common.exception import InvalidRSEExpression, RequestNotFound, RSEProtocolNotSupported, RucioException, UnsupportedOperation
34
- from rucio.common.utils import construct_non_deterministic_pfn
33
+ from rucio.common.utils import construct_non_deterministic_pfn, get_transfer_schemas
35
34
  from rucio.core import did
36
35
  from rucio.core import message as message_core
37
36
  from rucio.core import request as request_core
@@ -40,7 +39,7 @@ from rucio.core.monitor import MetricManager
40
39
  from rucio.core.request import DirectTransfer, RequestSource, RequestWithSources, TransferDestination, transition_request_state
41
40
  from rucio.core.rse_expression_parser import parse_expression
42
41
  from rucio.db.sqla import models
43
- from rucio.db.sqla.constants import DIDType, RequestState, RequestType, TransferLimitDirection
42
+ from rucio.db.sqla.constants import DIDType, RequestState, RequestType
44
43
  from rucio.db.sqla.session import read_session, stream_session, transactional_session
45
44
  from rucio.rse import rsemanager as rsemgr
46
45
  from rucio.transfertool.bittorrent import BittorrentTransfertool
@@ -1331,7 +1330,7 @@ def __add_compatible_schemes(schemes, allowed_schemes):
1331
1330
  for scheme in schemes:
1332
1331
  if scheme in allowed_schemes:
1333
1332
  return_schemes.append(scheme)
1334
- for scheme_map_scheme in constants.SCHEME_MAP.get(scheme, []):
1333
+ for scheme_map_scheme in get_transfer_schemas().get(scheme, []):
1335
1334
  if scheme_map_scheme not in allowed_schemes:
1336
1335
  continue
1337
1336
  else:
@@ -247,7 +247,7 @@ def check(
247
247
  results_dir)
248
248
  if output:
249
249
  process_output(output)
250
- except:
250
+ except Exception:
251
251
  elapsed = (datetime.now() - start).total_seconds() / 60
252
252
  logger.error('Check of "%s" failed in %d minutes, %d remaining attempts', rse, elapsed, attempts, exc_info=True)
253
253
  success = False
@@ -31,7 +31,7 @@ from rucio.core.did import get_metadata
31
31
  from rucio.core.replica import bulk_add_bad_replicas, bulk_delete_bad_pfns, declare_bad_file_replicas, get_bad_pfns, get_did_from_pfns, get_pfn_to_rse, get_replicas_state, update_replicas_states
32
32
  from rucio.core.rse import get_rse_name
33
33
  from rucio.daemons.common import run_daemon
34
- from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, BadFilesStatus, BadPFNStatus, ReplicaState
34
+ from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, BadFilesStatus, BadPFNStatus, ReplicaState
35
35
  from rucio.db.sqla.session import get_session
36
36
 
37
37
  if TYPE_CHECKING:
@@ -220,7 +220,10 @@ def run_once(heartbeat_handler: "HeartbeatHandler", bulk: int, **_kwargs) -> boo
220
220
  bulk_delete_bad_pfns(pfns=chunk, session=session)
221
221
  session.commit() # pylint: disable=no-member
222
222
  except (DatabaseException, DatabaseError) as error:
223
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
223
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
224
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
225
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
226
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
224
227
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
225
228
  else:
226
229
  logger(logging.ERROR, 'Exception', exc_info=True)
@@ -273,7 +276,10 @@ def run_once(heartbeat_handler: "HeartbeatHandler", bulk: int, **_kwargs) -> boo
273
276
  __update_temporary_unavailable(chunk=chunk, reason=reason, expires_at=expires_at, account=account, logger=logger)
274
277
  session = get_session()
275
278
  except (DatabaseException, DatabaseError) as error:
276
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
279
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
280
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
281
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
282
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
277
283
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
278
284
  else:
279
285
  logger(logging.ERROR, 'Exception', exc_info=True)
@@ -30,7 +30,7 @@ from rucio.common.utils import chunks
30
30
  from rucio.core.did import get_metadata
31
31
  from rucio.core.replica import bulk_delete_bad_replicas, get_replicas_state, list_expired_temporary_unavailable_replicas, update_replicas_states
32
32
  from rucio.daemons.common import run_daemon
33
- from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, BadFilesStatus, ReplicaState
33
+ from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, BadFilesStatus, ReplicaState
34
34
  from rucio.db.sqla.session import get_session
35
35
 
36
36
  if TYPE_CHECKING:
@@ -127,7 +127,10 @@ def run_once(heartbeat_handler: "HeartbeatHandler", bulk: int, **_kwargs) -> boo
127
127
  session.commit() # pylint: disable=no-member
128
128
  session = get_session()
129
129
  except (DatabaseException, DatabaseError) as error:
130
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
130
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
131
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
132
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
133
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
131
134
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
132
135
  else:
133
136
  logger(logging.ERROR, 'Exception', exc_info=True)
@@ -33,7 +33,7 @@ from rucio.core.monitor import MetricManager
33
33
  from rucio.core.replica import get_bad_replicas_backlog, get_replicas_state, list_bad_replicas
34
34
  from rucio.core.rule import get_evaluation_backlog, update_rules_for_bad_replica, update_rules_for_lost_replica
35
35
  from rucio.daemons.common import HeartbeatHandler, run_daemon
36
- from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, ReplicaState
36
+ from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, ReplicaState
37
37
 
38
38
  if TYPE_CHECKING:
39
39
  from types import FrameType
@@ -136,7 +136,10 @@ def run_once(heartbeat_handler: HeartbeatHandler, bulk: int, **_kwargs) -> bool:
136
136
  update_rules_for_lost_replica(scope=scope, name=name, rse_id=rse_id, nowait=True)
137
137
  METRICS.counter(name='badfiles.lostfile').inc()
138
138
  except (DatabaseException, DatabaseError) as error:
139
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
139
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
140
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
141
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
142
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
140
143
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
141
144
  else:
142
145
  logger(logging.ERROR, str(error))
@@ -149,7 +152,10 @@ def run_once(heartbeat_handler: HeartbeatHandler, bulk: int, **_kwargs) -> bool:
149
152
  update_rules_for_bad_replica(scope=scope, name=name, rse_id=rse_id, nowait=True)
150
153
  METRICS.counter(name='badfiles.recovering').inc()
151
154
  except (DatabaseException, DatabaseError) as error:
152
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
155
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
156
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
157
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
158
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
153
159
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
154
160
  else:
155
161
  logger(logging.ERROR, str(error))
@@ -279,7 +279,7 @@ def list_rebalance_rule_candidates(
279
279
 
280
280
  vo = get_rse_vo(rse_id=rse_id)
281
281
 
282
- # dumps can be applied only for decommission since the dumps doesn't contain info from dids
282
+ # dumps can be applied only for decommission since the dumps doesn't contain info from DIDs
283
283
  if mode == "decommission":
284
284
  return _list_rebalance_rule_candidates_dump(rse_id, mode)
285
285
 
@@ -43,7 +43,7 @@ def group_space(site: str) -> int:
43
43
  group_total = 0
44
44
  try:
45
45
  site_groupdisks = parse_expression('site=%s&spacetoken=ATLASDATADISK&type=GROUPDISK' % site)
46
- except:
46
+ except Exception:
47
47
  return group_total
48
48
 
49
49
  for rse in site_groupdisks:
@@ -43,7 +43,7 @@ def group_space(site: str) -> int:
43
43
  group_total = 0
44
44
  try:
45
45
  site_groupdisks = parse_expression('site=%s&spacetoken=ATLASDATADISK&type=GROUPDISK' % site)
46
- except:
46
+ except Exception:
47
47
  return group_total
48
48
 
49
49
  for rse in site_groupdisks:
@@ -103,7 +103,7 @@ class AMQConsumer:
103
103
  else:
104
104
  self.__logger(logging.DEBUG, 'Check failed: %s %s '
105
105
  % (isinstance(msg, dict), 'operation' in msg.keys()))
106
- except:
106
+ except Exception:
107
107
  self.__logger(logging.ERROR, str(format_exc()))
108
108
 
109
109
 
@@ -43,7 +43,7 @@ from rucio.core.rse import list_rses
43
43
  from rucio.core.topology import ExpiringObjectCache, Topology
44
44
  from rucio.core.transfer import ProtocolFactory
45
45
  from rucio.daemons.common import ProducerConsumerDaemon, db_workqueue
46
- from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, BadFilesStatus, ReplicaState, RequestState, RequestType
46
+ from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, BadFilesStatus, ReplicaState, RequestState, RequestType
47
47
  from rucio.db.sqla.session import transactional_session
48
48
 
49
49
  if TYPE_CHECKING:
@@ -140,7 +140,10 @@ def _handle_requests(
140
140
  logger(logging.DEBUG, 'Finish to update %s finished requests in %s seconds', len(reqs), total_stopwatch.elapsed)
141
141
 
142
142
  except (DatabaseException, DatabaseError) as error:
143
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
143
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
144
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
145
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
146
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
144
147
  logger(logging.WARNING, 'Lock detected when handling request - skipping: %s', str(error))
145
148
  else:
146
149
  raise
@@ -421,14 +424,20 @@ def __handle_terminated_replicas(
421
424
  try:
422
425
  __update_replica(replica, logger=logger)
423
426
  except (DatabaseException, DatabaseError) as error:
424
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
427
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
428
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
429
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
430
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
425
431
  logger(logging.WARNING, "Locks detected when handling replica %s:%s at RSE %s", replica['scope'], replica['name'], replica['rse_id'])
426
432
  else:
427
433
  logger(logging.ERROR, "Could not finish handling replicas %s:%s at RSE %s", replica['scope'], replica['name'], replica['rse_id'], exc_info=True)
428
434
  except Exception as error:
429
435
  logger(logging.ERROR, "Something unexpected happened when updating replica state for transfer %s:%s at %s (%s)", replica['scope'], replica['name'], replica['rse_id'], str(error))
430
436
  except (DatabaseException, DatabaseError) as error:
431
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
437
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
438
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
439
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
440
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
432
441
  logger(logging.WARNING, "Locks detected when handling replicas on %s rule %s, update updated time.", req_type, rule_id)
433
442
  try:
434
443
  request_core.touch_requests_by_rule(rule_id)
@@ -40,7 +40,7 @@ from rucio.core import transfer as transfer_core
40
40
  from rucio.core.monitor import MetricManager
41
41
  from rucio.core.topology import ExpiringObjectCache, Topology
42
42
  from rucio.daemons.common import ProducerConsumerDaemon, db_workqueue
43
- from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, RequestState, RequestType
43
+ from rucio.db.sqla.constants import MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED, ORACLE_DEADLOCK_DETECTED_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, RequestState, RequestType
44
44
  from rucio.transfertool.fts3 import FTS3Transfertool
45
45
 
46
46
  if TYPE_CHECKING:
@@ -387,7 +387,10 @@ def _poll_transfers(
387
387
  # Otherwise if one bulk transfer includes many requests and one is not terminated, the transfer will be poll again.
388
388
  transfer_core.touch_transfer(transfertool_obj.external_host, transfer_id)
389
389
  except (DatabaseException, DatabaseError) as error:
390
- if re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0]) or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0]) or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]:
390
+ if (re.match(ORACLE_RESOURCE_BUSY_REGEX, error.args[0])
391
+ or re.match(ORACLE_DEADLOCK_DETECTED_REGEX, error.args[0])
392
+ or re.match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(error.args[0]))
393
+ or MYSQL_LOCK_WAIT_TIMEOUT_EXCEEDED in error.args[0]):
391
394
  logger(logging.WARNING, "Lock detected when handling request %s - skipping" % transfer_id)
392
395
  else:
393
396
  logger(logging.ERROR, 'Exception', exc_info=True)
@@ -151,7 +151,7 @@ def receiver(
151
151
  use_ssl = True
152
152
  try:
153
153
  use_ssl = config_get_bool('messaging-fts3', 'use_ssl')
154
- except:
154
+ except Exception:
155
155
  logging.info('could not find use_ssl in configuration -- please update your rucio.cfg')
156
156
 
157
157
  port = config_get_int('messaging-fts3', 'port')
@@ -26,13 +26,14 @@ from sqlalchemy import null
26
26
 
27
27
  import rucio.db.sqla.util
28
28
  from rucio.common import exception
29
+ from rucio.common.constants import TransferLimitDirection
29
30
  from rucio.common.logging import setup_logging
30
31
  from rucio.core.monitor import MetricManager
31
32
  from rucio.core.request import get_request_stats, re_sync_all_transfer_limits, release_all_waiting_requests, release_waiting_requests_fifo, release_waiting_requests_grouped_fifo, reset_stale_waiting_requests, set_transfer_limit_stats
32
33
  from rucio.core.rse import RseCollection, RseData
33
34
  from rucio.core.transfer import applicable_rse_transfer_limits
34
35
  from rucio.daemons.common import ProducerConsumerDaemon, db_workqueue
35
- from rucio.db.sqla.constants import RequestState, TransferLimitDirection
36
+ from rucio.db.sqla.constants import RequestState
36
37
 
37
38
  if TYPE_CHECKING:
38
39
  from collections.abc import Iterator
@@ -38,7 +38,7 @@ def aggregate_events(
38
38
  once: bool = False
39
39
  ) -> None:
40
40
  """
41
- Collect all the events affecting the dids followed by the corresponding account.
41
+ Collect all the events affecting the DIDs followed by the corresponding account.
42
42
  """
43
43
 
44
44
  logging.info('event_aggregation: started')
@@ -115,7 +115,7 @@ def setup_activemq(
115
115
  brokers_resolved = []
116
116
  try:
117
117
  brokers_alias = config_get_list("messaging-hermes", "brokers")
118
- except:
118
+ except Exception:
119
119
  raise Exception("Could not load brokers from configuration")
120
120
 
121
121
  logger(logging.INFO, "[broker] Resolving broker dns alias: %s", brokers_alias)
@@ -148,7 +148,7 @@ def setup_activemq(
148
148
  use_ssl = True
149
149
  try:
150
150
  use_ssl = config_get_bool("messaging-hermes", "use_ssl")
151
- except:
151
+ except Exception:
152
152
  logger(
153
153
  logging.INFO,
154
154
  "[broker] Could not find use_ssl in configuration -- please update your rucio.cfg",
@@ -34,7 +34,7 @@ from rucio.common.logging import setup_logging
34
34
  from rucio.core.monitor import MetricManager
35
35
  from rucio.core.rule import delete_rule, get_expired_rules
36
36
  from rucio.daemons.common import HeartbeatHandler, run_daemon
37
- from rucio.db.sqla.constants import ORACLE_CONNECTION_LOST_CONTACT_REGEX, ORACLE_RESOURCE_BUSY_REGEX
37
+ from rucio.db.sqla.constants import MYSQL_LOCK_NOWAIT_REGEX, ORACLE_CONNECTION_LOST_CONTACT_REGEX, ORACLE_RESOURCE_BUSY_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX
38
38
  from rucio.db.sqla.util import get_db_time
39
39
 
40
40
  if TYPE_CHECKING:
@@ -103,7 +103,7 @@ def run_once(
103
103
  delete_rule(rule_id=rule_id, nowait=True)
104
104
  logger(logging.DEBUG, 'deletion of %s took %f' % (rule_id, time.time() - start))
105
105
  except (DatabaseException, DatabaseError, UnsupportedOperation) as e:
106
- if match(ORACLE_RESOURCE_BUSY_REGEX, str(e.args[0])):
106
+ if match(ORACLE_RESOURCE_BUSY_REGEX, str(e.args[0])) or match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(e.args[0])) or match(MYSQL_LOCK_NOWAIT_REGEX, str(e.args[0])):
107
107
  paused_rules[rule_id] = datetime.utcnow() + timedelta(seconds=randint(600, 2400)) # noqa: S311
108
108
  METRICS.counter('exceptions.{exception}').labels(exception='LocksDetected').inc()
109
109
  logger(logging.WARNING, 'Locks detected for %s' % rule_id)
@@ -36,7 +36,7 @@ from rucio.common.types import InternalScope
36
36
  from rucio.core.monitor import MetricManager
37
37
  from rucio.core.rule import delete_updated_did, get_updated_dids, re_evaluate_did
38
38
  from rucio.daemons.common import HeartbeatHandler, run_daemon
39
- from rucio.db.sqla.constants import ORACLE_CONNECTION_LOST_CONTACT_REGEX, ORACLE_RESOURCE_BUSY_REGEX, ORACLE_UNIQUE_CONSTRAINT_VIOLATED_REGEX
39
+ from rucio.db.sqla.constants import MYSQL_LOCK_NOWAIT_REGEX, ORACLE_CONNECTION_LOST_CONTACT_REGEX, ORACLE_RESOURCE_BUSY_REGEX, ORACLE_UNIQUE_CONSTRAINT_VIOLATED_REGEX, PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX
40
40
 
41
41
  if TYPE_CHECKING:
42
42
  from types import FrameType
@@ -52,7 +52,7 @@ def re_evaluator(
52
52
  did_limit: int = 100
53
53
  ) -> None:
54
54
  """
55
- Main loop to check the re-evaluation of dids.
55
+ Main loop to check the re-evaluation of DIDs.
56
56
  """
57
57
 
58
58
  paused_dids = {} # {(scope, name): datetime}
@@ -81,13 +81,13 @@ def run_once(
81
81
  # heartbeat
82
82
  start = time.time() # NOQA
83
83
 
84
- # Refresh paused dids
84
+ # Refresh paused DIDs
85
85
  iter_paused_dids = copy.copy(paused_dids)
86
86
  for key in iter_paused_dids:
87
87
  if datetime.utcnow() > paused_dids[key]:
88
88
  del paused_dids[key]
89
89
 
90
- # Select a bunch of dids for re evaluation for this worker
90
+ # Select a bunch of DIDs for re-evaluation for this worker
91
91
  dids = get_updated_dids(total_workers=total_workers,
92
92
  worker_number=worker_number,
93
93
  limit=did_limit,
@@ -106,7 +106,7 @@ def run_once(
106
106
  if graceful_stop.is_set():
107
107
  break
108
108
 
109
- # Check if this did has already been operated on
109
+ # Check if this DID has already been operated on
110
110
  did_tag = '%s:%s' % (did.scope.internal, did.name)
111
111
  if did_tag in done_dids:
112
112
  if did.rule_evaluation_action in done_dids[did_tag]:
@@ -116,7 +116,7 @@ def run_once(
116
116
  else:
117
117
  done_dids[did_tag] = []
118
118
 
119
- # Jump paused dids
119
+ # Jump paused DIDs
120
120
  if (did.scope.internal, did.name) in paused_dids:
121
121
  continue
122
122
 
@@ -129,7 +129,7 @@ def run_once(
129
129
  except DataIdentifierNotFound:
130
130
  delete_updated_did(id_=did.id)
131
131
  except (DatabaseException, DatabaseError) as e:
132
- if match(ORACLE_UNIQUE_CONSTRAINT_VIOLATED_REGEX, str(e.args[0])) or match(ORACLE_RESOURCE_BUSY_REGEX, str(e.args[0])):
132
+ if match(ORACLE_UNIQUE_CONSTRAINT_VIOLATED_REGEX, str(e.args[0])) or match(ORACLE_RESOURCE_BUSY_REGEX, str(e.args[0])) or match(PSQL_PSYCOPG_LOCK_NOT_AVAILABLE_REGEX, str(e.args[0])) or match(MYSQL_LOCK_NOWAIT_REGEX, str(e.args[0])):
133
133
  paused_dids[(did.scope.internal, did.name)] = datetime.utcnow() + timedelta(seconds=randint(60, 600)) # noqa: S311
134
134
  logger(logging.WARNING, 'Locks detected for %s:%s', did.scope, did.name)
135
135
  METRICS.counter('exceptions.{exception}').labels(exception='LocksDetected').inc()