rucio 37.0.0rc1__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.
- rucio/__init__.py +17 -0
- rucio/alembicrevision.py +15 -0
- rucio/cli/__init__.py +14 -0
- rucio/cli/account.py +216 -0
- rucio/cli/bin_legacy/__init__.py +13 -0
- rucio/cli/bin_legacy/rucio.py +2825 -0
- rucio/cli/bin_legacy/rucio_admin.py +2500 -0
- rucio/cli/command.py +272 -0
- rucio/cli/config.py +72 -0
- rucio/cli/did.py +191 -0
- rucio/cli/download.py +128 -0
- rucio/cli/lifetime_exception.py +33 -0
- rucio/cli/replica.py +162 -0
- rucio/cli/rse.py +293 -0
- rucio/cli/rule.py +158 -0
- rucio/cli/scope.py +40 -0
- rucio/cli/subscription.py +73 -0
- rucio/cli/upload.py +60 -0
- rucio/cli/utils.py +226 -0
- rucio/client/__init__.py +15 -0
- rucio/client/accountclient.py +432 -0
- rucio/client/accountlimitclient.py +183 -0
- rucio/client/baseclient.py +983 -0
- rucio/client/client.py +120 -0
- rucio/client/configclient.py +126 -0
- rucio/client/credentialclient.py +59 -0
- rucio/client/didclient.py +868 -0
- rucio/client/diracclient.py +56 -0
- rucio/client/downloadclient.py +1783 -0
- rucio/client/exportclient.py +44 -0
- rucio/client/fileclient.py +50 -0
- rucio/client/importclient.py +42 -0
- rucio/client/lifetimeclient.py +90 -0
- rucio/client/lockclient.py +109 -0
- rucio/client/metaconventionsclient.py +140 -0
- rucio/client/pingclient.py +44 -0
- rucio/client/replicaclient.py +452 -0
- rucio/client/requestclient.py +125 -0
- rucio/client/richclient.py +317 -0
- rucio/client/rseclient.py +746 -0
- rucio/client/ruleclient.py +294 -0
- rucio/client/scopeclient.py +90 -0
- rucio/client/subscriptionclient.py +173 -0
- rucio/client/touchclient.py +82 -0
- rucio/client/uploadclient.py +969 -0
- rucio/common/__init__.py +13 -0
- rucio/common/bittorrent.py +234 -0
- rucio/common/cache.py +111 -0
- rucio/common/checksum.py +168 -0
- rucio/common/client.py +122 -0
- rucio/common/config.py +788 -0
- rucio/common/constants.py +217 -0
- rucio/common/constraints.py +17 -0
- rucio/common/didtype.py +237 -0
- rucio/common/dumper/__init__.py +342 -0
- rucio/common/dumper/consistency.py +497 -0
- rucio/common/dumper/data_models.py +362 -0
- rucio/common/dumper/path_parsing.py +75 -0
- rucio/common/exception.py +1208 -0
- rucio/common/extra.py +31 -0
- rucio/common/logging.py +420 -0
- rucio/common/pcache.py +1409 -0
- rucio/common/plugins.py +185 -0
- rucio/common/policy.py +93 -0
- rucio/common/schema/__init__.py +200 -0
- rucio/common/schema/generic.py +416 -0
- rucio/common/schema/generic_multi_vo.py +395 -0
- rucio/common/stomp_utils.py +423 -0
- rucio/common/stopwatch.py +55 -0
- rucio/common/test_rucio_server.py +154 -0
- rucio/common/types.py +483 -0
- rucio/common/utils.py +1688 -0
- rucio/core/__init__.py +13 -0
- rucio/core/account.py +496 -0
- rucio/core/account_counter.py +236 -0
- rucio/core/account_limit.py +425 -0
- rucio/core/authentication.py +620 -0
- rucio/core/config.py +437 -0
- rucio/core/credential.py +224 -0
- rucio/core/did.py +3004 -0
- rucio/core/did_meta_plugins/__init__.py +252 -0
- rucio/core/did_meta_plugins/did_column_meta.py +331 -0
- rucio/core/did_meta_plugins/did_meta_plugin_interface.py +165 -0
- rucio/core/did_meta_plugins/elasticsearch_meta.py +407 -0
- rucio/core/did_meta_plugins/filter_engine.py +672 -0
- rucio/core/did_meta_plugins/json_meta.py +240 -0
- rucio/core/did_meta_plugins/mongo_meta.py +229 -0
- rucio/core/did_meta_plugins/postgres_meta.py +352 -0
- rucio/core/dirac.py +237 -0
- rucio/core/distance.py +187 -0
- rucio/core/exporter.py +59 -0
- rucio/core/heartbeat.py +363 -0
- rucio/core/identity.py +301 -0
- rucio/core/importer.py +260 -0
- rucio/core/lifetime_exception.py +377 -0
- rucio/core/lock.py +577 -0
- rucio/core/message.py +288 -0
- rucio/core/meta_conventions.py +203 -0
- rucio/core/monitor.py +448 -0
- rucio/core/naming_convention.py +195 -0
- rucio/core/nongrid_trace.py +136 -0
- rucio/core/oidc.py +1463 -0
- rucio/core/permission/__init__.py +161 -0
- rucio/core/permission/generic.py +1124 -0
- rucio/core/permission/generic_multi_vo.py +1144 -0
- rucio/core/quarantined_replica.py +224 -0
- rucio/core/replica.py +4483 -0
- rucio/core/replica_sorter.py +362 -0
- rucio/core/request.py +3091 -0
- rucio/core/rse.py +2079 -0
- rucio/core/rse_counter.py +185 -0
- rucio/core/rse_expression_parser.py +459 -0
- rucio/core/rse_selector.py +304 -0
- rucio/core/rule.py +4484 -0
- rucio/core/rule_grouping.py +1620 -0
- rucio/core/scope.py +181 -0
- rucio/core/subscription.py +362 -0
- rucio/core/topology.py +490 -0
- rucio/core/trace.py +375 -0
- rucio/core/transfer.py +1531 -0
- rucio/core/vo.py +169 -0
- rucio/core/volatile_replica.py +151 -0
- rucio/daemons/__init__.py +13 -0
- rucio/daemons/abacus/__init__.py +13 -0
- rucio/daemons/abacus/account.py +116 -0
- rucio/daemons/abacus/collection_replica.py +124 -0
- rucio/daemons/abacus/rse.py +117 -0
- rucio/daemons/atropos/__init__.py +13 -0
- rucio/daemons/atropos/atropos.py +242 -0
- rucio/daemons/auditor/__init__.py +289 -0
- rucio/daemons/auditor/hdfs.py +97 -0
- rucio/daemons/auditor/srmdumps.py +355 -0
- rucio/daemons/automatix/__init__.py +13 -0
- rucio/daemons/automatix/automatix.py +304 -0
- rucio/daemons/badreplicas/__init__.py +13 -0
- rucio/daemons/badreplicas/minos.py +322 -0
- rucio/daemons/badreplicas/minos_temporary_expiration.py +171 -0
- rucio/daemons/badreplicas/necromancer.py +196 -0
- rucio/daemons/bb8/__init__.py +13 -0
- rucio/daemons/bb8/bb8.py +353 -0
- rucio/daemons/bb8/common.py +759 -0
- rucio/daemons/bb8/nuclei_background_rebalance.py +153 -0
- rucio/daemons/bb8/t2_background_rebalance.py +153 -0
- rucio/daemons/cache/__init__.py +13 -0
- rucio/daemons/cache/consumer.py +133 -0
- rucio/daemons/common.py +405 -0
- rucio/daemons/conveyor/__init__.py +13 -0
- rucio/daemons/conveyor/common.py +562 -0
- rucio/daemons/conveyor/finisher.py +529 -0
- rucio/daemons/conveyor/poller.py +394 -0
- rucio/daemons/conveyor/preparer.py +205 -0
- rucio/daemons/conveyor/receiver.py +179 -0
- rucio/daemons/conveyor/stager.py +133 -0
- rucio/daemons/conveyor/submitter.py +403 -0
- rucio/daemons/conveyor/throttler.py +532 -0
- rucio/daemons/follower/__init__.py +13 -0
- rucio/daemons/follower/follower.py +101 -0
- rucio/daemons/hermes/__init__.py +13 -0
- rucio/daemons/hermes/hermes.py +534 -0
- rucio/daemons/judge/__init__.py +13 -0
- rucio/daemons/judge/cleaner.py +159 -0
- rucio/daemons/judge/evaluator.py +185 -0
- rucio/daemons/judge/injector.py +162 -0
- rucio/daemons/judge/repairer.py +154 -0
- rucio/daemons/oauthmanager/__init__.py +13 -0
- rucio/daemons/oauthmanager/oauthmanager.py +198 -0
- rucio/daemons/reaper/__init__.py +13 -0
- rucio/daemons/reaper/dark_reaper.py +282 -0
- rucio/daemons/reaper/reaper.py +739 -0
- rucio/daemons/replicarecoverer/__init__.py +13 -0
- rucio/daemons/replicarecoverer/suspicious_replica_recoverer.py +626 -0
- rucio/daemons/rsedecommissioner/__init__.py +13 -0
- rucio/daemons/rsedecommissioner/config.py +81 -0
- rucio/daemons/rsedecommissioner/profiles/__init__.py +24 -0
- rucio/daemons/rsedecommissioner/profiles/atlas.py +60 -0
- rucio/daemons/rsedecommissioner/profiles/generic.py +452 -0
- rucio/daemons/rsedecommissioner/profiles/types.py +93 -0
- rucio/daemons/rsedecommissioner/rse_decommissioner.py +280 -0
- rucio/daemons/storage/__init__.py +13 -0
- rucio/daemons/storage/consistency/__init__.py +13 -0
- rucio/daemons/storage/consistency/actions.py +848 -0
- rucio/daemons/tracer/__init__.py +13 -0
- rucio/daemons/tracer/kronos.py +511 -0
- rucio/daemons/transmogrifier/__init__.py +13 -0
- rucio/daemons/transmogrifier/transmogrifier.py +762 -0
- rucio/daemons/undertaker/__init__.py +13 -0
- rucio/daemons/undertaker/undertaker.py +137 -0
- rucio/db/__init__.py +13 -0
- rucio/db/sqla/__init__.py +52 -0
- rucio/db/sqla/constants.py +206 -0
- rucio/db/sqla/migrate_repo/__init__.py +13 -0
- rucio/db/sqla/migrate_repo/env.py +110 -0
- rucio/db/sqla/migrate_repo/versions/01eaf73ab656_add_new_rule_notification_state_progress.py +70 -0
- rucio/db/sqla/migrate_repo/versions/0437a40dbfd1_add_eol_at_in_rules.py +47 -0
- rucio/db/sqla/migrate_repo/versions/0f1adb7a599a_create_transfer_hops_table.py +59 -0
- rucio/db/sqla/migrate_repo/versions/102efcf145f4_added_stuck_at_column_to_rules.py +43 -0
- rucio/db/sqla/migrate_repo/versions/13d4f70c66a9_introduce_transfer_limits.py +91 -0
- rucio/db/sqla/migrate_repo/versions/140fef722e91_cleanup_distances_table.py +76 -0
- rucio/db/sqla/migrate_repo/versions/14ec5aeb64cf_add_request_external_host.py +43 -0
- rucio/db/sqla/migrate_repo/versions/156fb5b5a14_add_request_type_to_requests_idx.py +50 -0
- rucio/db/sqla/migrate_repo/versions/1677d4d803c8_split_rse_availability_into_multiple.py +68 -0
- rucio/db/sqla/migrate_repo/versions/16a0aca82e12_create_index_on_table_replicas_path.py +40 -0
- rucio/db/sqla/migrate_repo/versions/1803333ac20f_adding_provenance_and_phys_group.py +45 -0
- rucio/db/sqla/migrate_repo/versions/1a29d6a9504c_add_didtype_chck_to_requests.py +60 -0
- rucio/db/sqla/migrate_repo/versions/1a80adff031a_create_index_on_rules_hist_recent.py +40 -0
- rucio/db/sqla/migrate_repo/versions/1c45d9730ca6_increase_identity_length.py +140 -0
- rucio/db/sqla/migrate_repo/versions/1d1215494e95_add_quarantined_replicas_table.py +73 -0
- rucio/db/sqla/migrate_repo/versions/1d96f484df21_asynchronous_rules_and_rule_approval.py +74 -0
- rucio/db/sqla/migrate_repo/versions/1f46c5f240ac_add_bytes_column_to_bad_replicas.py +43 -0
- rucio/db/sqla/migrate_repo/versions/1fc15ab60d43_add_message_history_table.py +50 -0
- rucio/db/sqla/migrate_repo/versions/2190e703eb6e_move_rse_settings_to_rse_attributes.py +134 -0
- rucio/db/sqla/migrate_repo/versions/21d6b9dc9961_add_mismatch_scheme_state_to_requests.py +64 -0
- rucio/db/sqla/migrate_repo/versions/22cf51430c78_add_availability_column_to_table_rses.py +39 -0
- rucio/db/sqla/migrate_repo/versions/22d887e4ec0a_create_sources_table.py +64 -0
- rucio/db/sqla/migrate_repo/versions/25821a8a45a3_remove_unique_constraint_on_requests.py +51 -0
- rucio/db/sqla/migrate_repo/versions/25fc855625cf_added_unique_constraint_to_rules.py +41 -0
- rucio/db/sqla/migrate_repo/versions/269fee20dee9_add_repair_cnt_to_locks.py +43 -0
- rucio/db/sqla/migrate_repo/versions/271a46ea6244_add_ignore_availability_column_to_rules.py +44 -0
- rucio/db/sqla/migrate_repo/versions/277b5fbb41d3_switch_heartbeats_executable.py +53 -0
- rucio/db/sqla/migrate_repo/versions/27e3a68927fb_remove_replicas_tombstone_and_replicas_.py +38 -0
- rucio/db/sqla/migrate_repo/versions/2854cd9e168_added_rule_id_column.py +47 -0
- rucio/db/sqla/migrate_repo/versions/295289b5a800_processed_by_and__at_in_requests.py +45 -0
- rucio/db/sqla/migrate_repo/versions/2962ece31cf4_add_nbaccesses_column_in_the_did_table.py +45 -0
- rucio/db/sqla/migrate_repo/versions/2af3291ec4c_added_replicas_history_table.py +57 -0
- rucio/db/sqla/migrate_repo/versions/2b69addda658_add_columns_for_third_party_copy_read_.py +45 -0
- rucio/db/sqla/migrate_repo/versions/2b8e7bcb4783_add_config_table.py +69 -0
- rucio/db/sqla/migrate_repo/versions/2ba5229cb54c_add_submitted_at_to_requests_table.py +43 -0
- rucio/db/sqla/migrate_repo/versions/2cbee484dcf9_added_column_volume_to_rse_transfer_.py +42 -0
- rucio/db/sqla/migrate_repo/versions/2edee4a83846_add_source_to_requests_and_requests_.py +47 -0
- rucio/db/sqla/migrate_repo/versions/2eef46be23d4_change_tokens_pk.py +46 -0
- rucio/db/sqla/migrate_repo/versions/2f648fc909f3_index_in_rule_history_on_scope_name.py +40 -0
- rucio/db/sqla/migrate_repo/versions/3082b8cef557_add_naming_convention_table_and_closed_.py +67 -0
- rucio/db/sqla/migrate_repo/versions/30d5206e9cad_increase_oauthrequest_redirect_msg_.py +37 -0
- rucio/db/sqla/migrate_repo/versions/30fa38b6434e_add_index_on_service_column_in_the_message_table.py +44 -0
- rucio/db/sqla/migrate_repo/versions/3152492b110b_added_staging_area_column.py +77 -0
- rucio/db/sqla/migrate_repo/versions/32c7d2783f7e_create_bad_replicas_table.py +60 -0
- rucio/db/sqla/migrate_repo/versions/3345511706b8_replicas_table_pk_definition_is_in_.py +72 -0
- rucio/db/sqla/migrate_repo/versions/35ef10d1e11b_change_index_on_table_requests.py +42 -0
- rucio/db/sqla/migrate_repo/versions/379a19b5332d_create_rse_limits_table.py +65 -0
- rucio/db/sqla/migrate_repo/versions/384b96aa0f60_created_rule_history_tables.py +133 -0
- rucio/db/sqla/migrate_repo/versions/3ac1660a1a72_extend_distance_table.py +55 -0
- rucio/db/sqla/migrate_repo/versions/3ad36e2268b0_create_collection_replicas_updates_table.py +76 -0
- rucio/db/sqla/migrate_repo/versions/3c9df354071b_extend_waiting_request_state.py +60 -0
- rucio/db/sqla/migrate_repo/versions/3d9813fab443_add_a_new_state_lost_in_badfilesstatus.py +44 -0
- rucio/db/sqla/migrate_repo/versions/40ad39ce3160_add_transferred_at_to_requests_table.py +43 -0
- rucio/db/sqla/migrate_repo/versions/4207be2fd914_add_notification_column_to_rules.py +64 -0
- rucio/db/sqla/migrate_repo/versions/42db2617c364_create_index_on_requests_external_id.py +40 -0
- rucio/db/sqla/migrate_repo/versions/436827b13f82_added_column_activity_to_table_requests.py +43 -0
- rucio/db/sqla/migrate_repo/versions/44278720f774_update_requests_typ_sta_upd_idx_index.py +44 -0
- rucio/db/sqla/migrate_repo/versions/45378a1e76a8_create_collection_replica_table.py +78 -0
- rucio/db/sqla/migrate_repo/versions/469d262be19_removing_created_at_index.py +41 -0
- rucio/db/sqla/migrate_repo/versions/4783c1f49cb4_create_distance_table.py +59 -0
- rucio/db/sqla/migrate_repo/versions/49a21b4d4357_create_index_on_table_tokens.py +44 -0
- rucio/db/sqla/migrate_repo/versions/4a2cbedda8b9_add_source_replica_expression_column_to_.py +43 -0
- rucio/db/sqla/migrate_repo/versions/4a7182d9578b_added_bytes_length_accessed_at_columns.py +49 -0
- rucio/db/sqla/migrate_repo/versions/4bab9edd01fc_create_index_on_requests_rule_id.py +40 -0
- rucio/db/sqla/migrate_repo/versions/4c3a4acfe006_new_attr_account_table.py +63 -0
- rucio/db/sqla/migrate_repo/versions/4cf0a2e127d4_adding_transient_metadata.py +43 -0
- rucio/db/sqla/migrate_repo/versions/4df2c5ddabc0_remove_temporary_dids.py +55 -0
- rucio/db/sqla/migrate_repo/versions/50280c53117c_add_qos_class_to_rse.py +45 -0
- rucio/db/sqla/migrate_repo/versions/52153819589c_add_rse_id_to_replicas_table.py +43 -0
- rucio/db/sqla/migrate_repo/versions/52fd9f4916fa_added_activity_to_rules.py +43 -0
- rucio/db/sqla/migrate_repo/versions/53b479c3cb0f_fix_did_meta_table_missing_updated_at_.py +45 -0
- rucio/db/sqla/migrate_repo/versions/5673b4b6e843_add_wfms_metadata_to_rule_tables.py +47 -0
- rucio/db/sqla/migrate_repo/versions/575767d9f89_added_source_history_table.py +58 -0
- rucio/db/sqla/migrate_repo/versions/58bff7008037_add_started_at_to_requests.py +45 -0
- rucio/db/sqla/migrate_repo/versions/58c8b78301ab_rename_callback_to_message.py +106 -0
- rucio/db/sqla/migrate_repo/versions/5f139f77382a_added_child_rule_id_column.py +55 -0
- rucio/db/sqla/migrate_repo/versions/688ef1840840_adding_did_meta_table.py +50 -0
- rucio/db/sqla/migrate_repo/versions/6e572a9bfbf3_add_new_split_container_column_to_rules.py +47 -0
- rucio/db/sqla/migrate_repo/versions/70587619328_add_comment_column_for_subscriptions.py +43 -0
- rucio/db/sqla/migrate_repo/versions/739064d31565_remove_history_table_pks.py +41 -0
- rucio/db/sqla/migrate_repo/versions/7541902bf173_add_didsfollowed_and_followevents_table.py +91 -0
- rucio/db/sqla/migrate_repo/versions/7ec22226cdbf_new_replica_state_for_temporary_.py +72 -0
- rucio/db/sqla/migrate_repo/versions/810a41685bc1_added_columns_rse_transfer_limits.py +49 -0
- rucio/db/sqla/migrate_repo/versions/83f991c63a93_correct_rse_expression_length.py +43 -0
- rucio/db/sqla/migrate_repo/versions/8523998e2e76_increase_size_of_extended_attributes_.py +43 -0
- rucio/db/sqla/migrate_repo/versions/8ea9122275b1_adding_missing_function_based_indices.py +53 -0
- rucio/db/sqla/migrate_repo/versions/90f47792bb76_add_clob_payload_to_messages.py +45 -0
- rucio/db/sqla/migrate_repo/versions/914b8f02df38_new_table_for_lifetime_model_exceptions.py +68 -0
- rucio/db/sqla/migrate_repo/versions/94a5961ddbf2_add_estimator_columns.py +45 -0
- rucio/db/sqla/migrate_repo/versions/9a1b149a2044_add_saml_identity_type.py +94 -0
- rucio/db/sqla/migrate_repo/versions/9a45bc4ea66d_add_vp_table.py +54 -0
- rucio/db/sqla/migrate_repo/versions/9eb936a81eb1_true_is_true.py +72 -0
- rucio/db/sqla/migrate_repo/versions/a08fa8de1545_transfer_stats_table.py +55 -0
- rucio/db/sqla/migrate_repo/versions/a118956323f8_added_vo_table_and_vo_col_to_rse.py +76 -0
- rucio/db/sqla/migrate_repo/versions/a193a275255c_add_status_column_in_messages.py +47 -0
- rucio/db/sqla/migrate_repo/versions/a5f6f6e928a7_1_7_0.py +121 -0
- rucio/db/sqla/migrate_repo/versions/a616581ee47_added_columns_to_table_requests.py +59 -0
- rucio/db/sqla/migrate_repo/versions/a6eb23955c28_state_idx_non_functional.py +52 -0
- rucio/db/sqla/migrate_repo/versions/a74275a1ad30_added_global_quota_table.py +54 -0
- rucio/db/sqla/migrate_repo/versions/a93e4e47bda_heartbeats.py +64 -0
- rucio/db/sqla/migrate_repo/versions/ae2a56fcc89_added_comment_column_to_rules.py +49 -0
- rucio/db/sqla/migrate_repo/versions/b0070f3695c8_add_deletedidmeta_table.py +57 -0
- rucio/db/sqla/migrate_repo/versions/b4293a99f344_added_column_identity_to_table_tokens.py +43 -0
- rucio/db/sqla/migrate_repo/versions/b5493606bbf5_fix_primary_key_for_subscription_history.py +41 -0
- rucio/db/sqla/migrate_repo/versions/b7d287de34fd_removal_of_replicastate_source.py +91 -0
- rucio/db/sqla/migrate_repo/versions/b818052fa670_add_index_to_quarantined_replicas.py +40 -0
- rucio/db/sqla/migrate_repo/versions/b8caac94d7f0_add_comments_column_for_subscriptions_.py +43 -0
- rucio/db/sqla/migrate_repo/versions/b96a1c7e1cc4_new_bad_pfns_table_and_bad_replicas_.py +143 -0
- rucio/db/sqla/migrate_repo/versions/bb695f45c04_extend_request_state.py +76 -0
- rucio/db/sqla/migrate_repo/versions/bc68e9946deb_add_staging_timestamps_to_request.py +50 -0
- rucio/db/sqla/migrate_repo/versions/bf3baa1c1474_correct_pk_and_idx_for_history_tables.py +72 -0
- rucio/db/sqla/migrate_repo/versions/c0937668555f_add_qos_policy_map_table.py +55 -0
- rucio/db/sqla/migrate_repo/versions/c129ccdb2d5_add_lumiblocknr_to_dids.py +43 -0
- rucio/db/sqla/migrate_repo/versions/ccdbcd48206e_add_did_type_column_index_on_did_meta_.py +65 -0
- rucio/db/sqla/migrate_repo/versions/cebad904c4dd_new_payload_column_for_heartbeats.py +47 -0
- rucio/db/sqla/migrate_repo/versions/d1189a09c6e0_oauth2_0_and_jwt_feature_support_adding_.py +146 -0
- rucio/db/sqla/migrate_repo/versions/d23453595260_extend_request_state_for_preparer.py +104 -0
- rucio/db/sqla/migrate_repo/versions/d6dceb1de2d_added_purge_column_to_rules.py +44 -0
- rucio/db/sqla/migrate_repo/versions/d6e2c3b2cf26_remove_third_party_copy_column_from_rse.py +43 -0
- rucio/db/sqla/migrate_repo/versions/d91002c5841_new_account_limits_table.py +103 -0
- rucio/db/sqla/migrate_repo/versions/e138c364ebd0_extending_columns_for_filter_and_.py +49 -0
- rucio/db/sqla/migrate_repo/versions/e59300c8b179_support_for_archive.py +104 -0
- rucio/db/sqla/migrate_repo/versions/f1b14a8c2ac1_postgres_use_check_constraints.py +29 -0
- rucio/db/sqla/migrate_repo/versions/f41ffe206f37_oracle_global_temporary_tables.py +74 -0
- rucio/db/sqla/migrate_repo/versions/f85a2962b021_adding_transfertool_column_to_requests_.py +47 -0
- rucio/db/sqla/migrate_repo/versions/fa7a7d78b602_increase_refresh_token_size.py +43 -0
- rucio/db/sqla/migrate_repo/versions/fb28a95fe288_add_replicas_rse_id_tombstone_idx.py +37 -0
- rucio/db/sqla/migrate_repo/versions/fe1a65b176c9_set_third_party_copy_read_and_write_.py +43 -0
- rucio/db/sqla/migrate_repo/versions/fe8ea2fa9788_added_third_party_copy_column_to_rse_.py +43 -0
- rucio/db/sqla/models.py +1743 -0
- rucio/db/sqla/sautils.py +55 -0
- rucio/db/sqla/session.py +529 -0
- rucio/db/sqla/types.py +206 -0
- rucio/db/sqla/util.py +543 -0
- rucio/gateway/__init__.py +13 -0
- rucio/gateway/account.py +345 -0
- rucio/gateway/account_limit.py +363 -0
- rucio/gateway/authentication.py +381 -0
- rucio/gateway/config.py +227 -0
- rucio/gateway/credential.py +70 -0
- rucio/gateway/did.py +987 -0
- rucio/gateway/dirac.py +83 -0
- rucio/gateway/exporter.py +60 -0
- rucio/gateway/heartbeat.py +76 -0
- rucio/gateway/identity.py +189 -0
- rucio/gateway/importer.py +46 -0
- rucio/gateway/lifetime_exception.py +121 -0
- rucio/gateway/lock.py +153 -0
- rucio/gateway/meta_conventions.py +98 -0
- rucio/gateway/permission.py +74 -0
- rucio/gateway/quarantined_replica.py +79 -0
- rucio/gateway/replica.py +538 -0
- rucio/gateway/request.py +330 -0
- rucio/gateway/rse.py +632 -0
- rucio/gateway/rule.py +437 -0
- rucio/gateway/scope.py +100 -0
- rucio/gateway/subscription.py +280 -0
- rucio/gateway/vo.py +126 -0
- rucio/rse/__init__.py +96 -0
- rucio/rse/protocols/__init__.py +13 -0
- rucio/rse/protocols/bittorrent.py +194 -0
- rucio/rse/protocols/cache.py +111 -0
- rucio/rse/protocols/dummy.py +100 -0
- rucio/rse/protocols/gfal.py +708 -0
- rucio/rse/protocols/globus.py +243 -0
- rucio/rse/protocols/http_cache.py +82 -0
- rucio/rse/protocols/mock.py +123 -0
- rucio/rse/protocols/ngarc.py +209 -0
- rucio/rse/protocols/posix.py +250 -0
- rucio/rse/protocols/protocol.py +361 -0
- rucio/rse/protocols/rclone.py +365 -0
- rucio/rse/protocols/rfio.py +145 -0
- rucio/rse/protocols/srm.py +338 -0
- rucio/rse/protocols/ssh.py +414 -0
- rucio/rse/protocols/storm.py +195 -0
- rucio/rse/protocols/webdav.py +594 -0
- rucio/rse/protocols/xrootd.py +302 -0
- rucio/rse/rsemanager.py +881 -0
- rucio/rse/translation.py +260 -0
- rucio/tests/__init__.py +13 -0
- rucio/tests/common.py +280 -0
- rucio/tests/common_server.py +149 -0
- rucio/transfertool/__init__.py +13 -0
- rucio/transfertool/bittorrent.py +200 -0
- rucio/transfertool/bittorrent_driver.py +50 -0
- rucio/transfertool/bittorrent_driver_qbittorrent.py +134 -0
- rucio/transfertool/fts3.py +1600 -0
- rucio/transfertool/fts3_plugins.py +152 -0
- rucio/transfertool/globus.py +201 -0
- rucio/transfertool/globus_library.py +181 -0
- rucio/transfertool/mock.py +89 -0
- rucio/transfertool/transfertool.py +221 -0
- rucio/vcsversion.py +11 -0
- rucio/version.py +45 -0
- rucio/web/__init__.py +13 -0
- rucio/web/rest/__init__.py +13 -0
- rucio/web/rest/flaskapi/__init__.py +13 -0
- rucio/web/rest/flaskapi/authenticated_bp.py +27 -0
- rucio/web/rest/flaskapi/v1/__init__.py +13 -0
- rucio/web/rest/flaskapi/v1/accountlimits.py +236 -0
- rucio/web/rest/flaskapi/v1/accounts.py +1103 -0
- rucio/web/rest/flaskapi/v1/archives.py +102 -0
- rucio/web/rest/flaskapi/v1/auth.py +1644 -0
- rucio/web/rest/flaskapi/v1/common.py +426 -0
- rucio/web/rest/flaskapi/v1/config.py +304 -0
- rucio/web/rest/flaskapi/v1/credentials.py +213 -0
- rucio/web/rest/flaskapi/v1/dids.py +2340 -0
- rucio/web/rest/flaskapi/v1/dirac.py +116 -0
- rucio/web/rest/flaskapi/v1/export.py +75 -0
- rucio/web/rest/flaskapi/v1/heartbeats.py +127 -0
- rucio/web/rest/flaskapi/v1/identities.py +285 -0
- rucio/web/rest/flaskapi/v1/import.py +132 -0
- rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +312 -0
- rucio/web/rest/flaskapi/v1/locks.py +358 -0
- rucio/web/rest/flaskapi/v1/main.py +91 -0
- rucio/web/rest/flaskapi/v1/meta_conventions.py +241 -0
- rucio/web/rest/flaskapi/v1/metrics.py +36 -0
- rucio/web/rest/flaskapi/v1/nongrid_traces.py +97 -0
- rucio/web/rest/flaskapi/v1/ping.py +88 -0
- rucio/web/rest/flaskapi/v1/redirect.py +366 -0
- rucio/web/rest/flaskapi/v1/replicas.py +1894 -0
- rucio/web/rest/flaskapi/v1/requests.py +998 -0
- rucio/web/rest/flaskapi/v1/rses.py +2250 -0
- rucio/web/rest/flaskapi/v1/rules.py +854 -0
- rucio/web/rest/flaskapi/v1/scopes.py +159 -0
- rucio/web/rest/flaskapi/v1/subscriptions.py +650 -0
- rucio/web/rest/flaskapi/v1/templates/auth_crash.html +80 -0
- rucio/web/rest/flaskapi/v1/templates/auth_granted.html +82 -0
- rucio/web/rest/flaskapi/v1/traces.py +137 -0
- rucio/web/rest/flaskapi/v1/types.py +20 -0
- rucio/web/rest/flaskapi/v1/vos.py +278 -0
- rucio/web/rest/main.py +18 -0
- rucio/web/rest/metrics.py +27 -0
- rucio/web/rest/ping.py +27 -0
- rucio-37.0.0rc1.data/data/rucio/etc/alembic.ini.template +71 -0
- rucio-37.0.0rc1.data/data/rucio/etc/alembic_offline.ini.template +74 -0
- rucio-37.0.0rc1.data/data/rucio/etc/globus-config.yml.template +5 -0
- rucio-37.0.0rc1.data/data/rucio/etc/ldap.cfg.template +30 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_approval_request.tmpl +38 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +4 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_approved_user.tmpl +17 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +6 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_denied_user.tmpl +17 -0
- rucio-37.0.0rc1.data/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +19 -0
- rucio-37.0.0rc1.data/data/rucio/etc/rse-accounts.cfg.template +25 -0
- rucio-37.0.0rc1.data/data/rucio/etc/rucio.cfg.atlas.client.template +43 -0
- rucio-37.0.0rc1.data/data/rucio/etc/rucio.cfg.template +241 -0
- rucio-37.0.0rc1.data/data/rucio/etc/rucio_multi_vo.cfg.template +217 -0
- rucio-37.0.0rc1.data/data/rucio/requirements.server.txt +297 -0
- rucio-37.0.0rc1.data/data/rucio/tools/bootstrap.py +34 -0
- rucio-37.0.0rc1.data/data/rucio/tools/merge_rucio_configs.py +144 -0
- rucio-37.0.0rc1.data/data/rucio/tools/reset_database.py +40 -0
- rucio-37.0.0rc1.data/scripts/rucio +133 -0
- rucio-37.0.0rc1.data/scripts/rucio-abacus-account +74 -0
- rucio-37.0.0rc1.data/scripts/rucio-abacus-collection-replica +46 -0
- rucio-37.0.0rc1.data/scripts/rucio-abacus-rse +78 -0
- rucio-37.0.0rc1.data/scripts/rucio-admin +97 -0
- rucio-37.0.0rc1.data/scripts/rucio-atropos +60 -0
- rucio-37.0.0rc1.data/scripts/rucio-auditor +206 -0
- rucio-37.0.0rc1.data/scripts/rucio-automatix +50 -0
- rucio-37.0.0rc1.data/scripts/rucio-bb8 +57 -0
- rucio-37.0.0rc1.data/scripts/rucio-cache-client +141 -0
- rucio-37.0.0rc1.data/scripts/rucio-cache-consumer +42 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-finisher +58 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-poller +66 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-preparer +37 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-receiver +44 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-stager +76 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-submitter +139 -0
- rucio-37.0.0rc1.data/scripts/rucio-conveyor-throttler +104 -0
- rucio-37.0.0rc1.data/scripts/rucio-dark-reaper +53 -0
- rucio-37.0.0rc1.data/scripts/rucio-dumper +160 -0
- rucio-37.0.0rc1.data/scripts/rucio-follower +44 -0
- rucio-37.0.0rc1.data/scripts/rucio-hermes +54 -0
- rucio-37.0.0rc1.data/scripts/rucio-judge-cleaner +89 -0
- rucio-37.0.0rc1.data/scripts/rucio-judge-evaluator +137 -0
- rucio-37.0.0rc1.data/scripts/rucio-judge-injector +44 -0
- rucio-37.0.0rc1.data/scripts/rucio-judge-repairer +44 -0
- rucio-37.0.0rc1.data/scripts/rucio-kronos +44 -0
- rucio-37.0.0rc1.data/scripts/rucio-minos +53 -0
- rucio-37.0.0rc1.data/scripts/rucio-minos-temporary-expiration +50 -0
- rucio-37.0.0rc1.data/scripts/rucio-necromancer +120 -0
- rucio-37.0.0rc1.data/scripts/rucio-oauth-manager +63 -0
- rucio-37.0.0rc1.data/scripts/rucio-reaper +83 -0
- rucio-37.0.0rc1.data/scripts/rucio-replica-recoverer +248 -0
- rucio-37.0.0rc1.data/scripts/rucio-rse-decommissioner +66 -0
- rucio-37.0.0rc1.data/scripts/rucio-storage-consistency-actions +74 -0
- rucio-37.0.0rc1.data/scripts/rucio-transmogrifier +77 -0
- rucio-37.0.0rc1.data/scripts/rucio-undertaker +76 -0
- rucio-37.0.0rc1.dist-info/METADATA +92 -0
- rucio-37.0.0rc1.dist-info/RECORD +487 -0
- rucio-37.0.0rc1.dist-info/WHEEL +5 -0
- rucio-37.0.0rc1.dist-info/licenses/AUTHORS.rst +100 -0
- rucio-37.0.0rc1.dist-info/licenses/LICENSE +201 -0
- rucio-37.0.0rc1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
# Copyright European Organization for Nuclear Research (CERN) since 2012
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
Reaper is a daemon to manage file deletion.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import concurrent.futures.thread # noqa (https://github.com/rucio/rucio/issues/6548)
|
|
20
|
+
|
|
21
|
+
import functools
|
|
22
|
+
import logging
|
|
23
|
+
import random
|
|
24
|
+
import threading
|
|
25
|
+
import time
|
|
26
|
+
import traceback
|
|
27
|
+
from configparser import NoOptionError, NoSectionError
|
|
28
|
+
from datetime import datetime, timedelta
|
|
29
|
+
from math import log2
|
|
30
|
+
from typing import TYPE_CHECKING, Any, Optional
|
|
31
|
+
|
|
32
|
+
from dogpile.cache.api import NoValue
|
|
33
|
+
from sqlalchemy.exc import DatabaseError, IntegrityError
|
|
34
|
+
|
|
35
|
+
import rucio.db.sqla.util
|
|
36
|
+
from rucio.common.cache import MemcacheRegion
|
|
37
|
+
from rucio.common.config import config_get_bool, config_get_int
|
|
38
|
+
from rucio.common.constants import RseAttr
|
|
39
|
+
from rucio.common.exception import DatabaseException, ReplicaNotFound, ReplicaUnAvailable, ResourceTemporaryUnavailable, RSEAccessDenied, RSENotFound, RSEProtocolNotSupported, ServiceUnavailable, SourceNotFound, VONotFound
|
|
40
|
+
from rucio.common.logging import setup_logging
|
|
41
|
+
from rucio.common.stopwatch import Stopwatch
|
|
42
|
+
from rucio.common.utils import chunks
|
|
43
|
+
from rucio.core.credential import get_signed_url
|
|
44
|
+
from rucio.core.heartbeat import list_payload_counts
|
|
45
|
+
from rucio.core.message import add_message
|
|
46
|
+
from rucio.core.monitor import MetricManager
|
|
47
|
+
from rucio.core.oidc import request_token
|
|
48
|
+
from rucio.core.replica import delete_replicas, list_and_mark_unlocked_replicas
|
|
49
|
+
from rucio.core.rse import RseData, determine_audience_for_rse, determine_scope_for_rse, list_rses
|
|
50
|
+
from rucio.core.rse_expression_parser import parse_expression
|
|
51
|
+
from rucio.core.rule import get_evaluation_backlog
|
|
52
|
+
from rucio.core.vo import list_vos
|
|
53
|
+
from rucio.daemons.common import run_daemon
|
|
54
|
+
from rucio.rse import rsemanager as rsemgr
|
|
55
|
+
|
|
56
|
+
if TYPE_CHECKING:
|
|
57
|
+
from collections.abc import Iterable, Sequence
|
|
58
|
+
from types import FrameType
|
|
59
|
+
|
|
60
|
+
from rucio.common.types import LFNDict, LoggerFunction
|
|
61
|
+
from rucio.daemons.common import HeartbeatHandler
|
|
62
|
+
|
|
63
|
+
GRACEFUL_STOP = threading.Event()
|
|
64
|
+
METRICS = MetricManager(module=__name__)
|
|
65
|
+
REGION = MemcacheRegion(expiration_time=600)
|
|
66
|
+
DAEMON_NAME = 'reaper'
|
|
67
|
+
|
|
68
|
+
EXCLUDED_RSE_GAUGE = METRICS.gauge('excluded_rses.{rse}', documentation='Temporarly excluded RSEs')
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def get_rses_to_process(
|
|
72
|
+
rses: Optional["Iterable[str]"],
|
|
73
|
+
include_rses: Optional[str],
|
|
74
|
+
exclude_rses: Optional[str],
|
|
75
|
+
vos: Optional["Sequence[str]"]
|
|
76
|
+
) -> Optional[list[dict[str, Any]]]:
|
|
77
|
+
"""
|
|
78
|
+
Return the list of RSEs to process based on rses, include_rses and exclude_rses
|
|
79
|
+
|
|
80
|
+
:param rses: List of RSEs the reaper should work against. If empty, it considers all RSEs.
|
|
81
|
+
:param exclude_rses: RSE expression to exclude RSEs from the Reaper.
|
|
82
|
+
:param include_rses: RSE expression to include RSEs.
|
|
83
|
+
:param vos: VOs on which to look for RSEs. Only used in multi-VO mode.
|
|
84
|
+
If None, we either use all VOs if run from "def"
|
|
85
|
+
|
|
86
|
+
:returns: A list of RSEs to process
|
|
87
|
+
"""
|
|
88
|
+
multi_vo = config_get_bool('common', 'multi_vo', raise_exception=False, default=False)
|
|
89
|
+
if not multi_vo:
|
|
90
|
+
if vos:
|
|
91
|
+
logging.log(logging.WARNING, 'Ignoring argument vos, this is only applicable in a multi-VO setup.')
|
|
92
|
+
vos = ['def']
|
|
93
|
+
else:
|
|
94
|
+
if vos:
|
|
95
|
+
invalid = set(vos) - set([v['vo'] for v in list_vos()])
|
|
96
|
+
if invalid:
|
|
97
|
+
msg = 'VO{} {} cannot be found'.format('s' if len(invalid) > 1 else '', ', '.join([repr(v) for v in invalid]))
|
|
98
|
+
raise VONotFound(msg)
|
|
99
|
+
else:
|
|
100
|
+
vos = [v['vo'] for v in list_vos()]
|
|
101
|
+
logging.log(logging.INFO, 'Reaper: This instance will work on VO%s: %s' % ('s' if len(vos) > 1 else '', ', '.join([v for v in vos])))
|
|
102
|
+
|
|
103
|
+
cache_key = 'rses_to_process_1%s2%s3%s' % (str(rses), str(include_rses), str(exclude_rses))
|
|
104
|
+
if multi_vo:
|
|
105
|
+
cache_key += '@%s' % '-'.join(vo for vo in vos)
|
|
106
|
+
|
|
107
|
+
result = REGION.get(cache_key)
|
|
108
|
+
if not isinstance(result, NoValue):
|
|
109
|
+
return result
|
|
110
|
+
|
|
111
|
+
all_rses: list[dict[str, Any]] = []
|
|
112
|
+
for vo in vos:
|
|
113
|
+
all_rses.extend(list_rses(filters={'vo': vo}))
|
|
114
|
+
|
|
115
|
+
if rses:
|
|
116
|
+
invalid = set(rses) - set([rse['rse'] for rse in all_rses])
|
|
117
|
+
if invalid:
|
|
118
|
+
msg = 'RSE{} {} cannot be found'.format('s' if len(invalid) > 1 else '',
|
|
119
|
+
', '.join([repr(rse) for rse in invalid]))
|
|
120
|
+
raise RSENotFound(msg)
|
|
121
|
+
rses_to_process = [rse for rse in all_rses if rse['rse'] in rses]
|
|
122
|
+
else:
|
|
123
|
+
rses_to_process = all_rses
|
|
124
|
+
|
|
125
|
+
if include_rses:
|
|
126
|
+
included_rses = parse_expression(include_rses)
|
|
127
|
+
rses_to_process = [rse for rse in rses_to_process if rse in included_rses]
|
|
128
|
+
|
|
129
|
+
if exclude_rses:
|
|
130
|
+
excluded_rses = parse_expression(exclude_rses)
|
|
131
|
+
rses_to_process = [rse for rse in rses_to_process if rse not in excluded_rses]
|
|
132
|
+
|
|
133
|
+
REGION.set(cache_key, rses_to_process)
|
|
134
|
+
logging.log(logging.INFO, 'Reaper: This instance will work on RSEs: %s', ', '.join([rse['rse'] for rse in rses_to_process]))
|
|
135
|
+
return rses_to_process
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def delete_from_storage(heartbeat_handler, hb_payload, replicas, prot, rse_info, is_staging, auto_exclude_threshold, logger=logging.log):
|
|
139
|
+
deleted_files = []
|
|
140
|
+
rse_name = rse_info['rse']
|
|
141
|
+
rse_id = rse_info['id']
|
|
142
|
+
noaccess_attempts = 0
|
|
143
|
+
pfns_to_bulk_delete = []
|
|
144
|
+
try:
|
|
145
|
+
prot.connect()
|
|
146
|
+
for replica in replicas:
|
|
147
|
+
# Physical deletion
|
|
148
|
+
_, _, logger = heartbeat_handler.live(payload=hb_payload)
|
|
149
|
+
stopwatch = Stopwatch()
|
|
150
|
+
deletion_dict = {'scope': replica['scope'].external,
|
|
151
|
+
'name': replica['name'],
|
|
152
|
+
'rse': rse_name,
|
|
153
|
+
'file-size': replica['bytes'],
|
|
154
|
+
'bytes': replica['bytes'],
|
|
155
|
+
'url': replica['pfn'],
|
|
156
|
+
'protocol': prot.attributes['scheme'],
|
|
157
|
+
'datatype': replica['datatype']}
|
|
158
|
+
try:
|
|
159
|
+
if replica['scope'].vo != 'def':
|
|
160
|
+
deletion_dict['vo'] = replica['scope'].vo
|
|
161
|
+
logger(logging.DEBUG, 'Deletion ATTEMPT of %s:%s as %s on %s', replica['scope'], replica['name'], replica['pfn'], rse_name)
|
|
162
|
+
# For STAGING RSEs, no physical deletion
|
|
163
|
+
if is_staging:
|
|
164
|
+
logger(logging.WARNING, 'Deletion STAGING of %s:%s as %s on %s, will only delete the catalog and not do physical deletion', replica['scope'], replica['name'], replica['pfn'], rse_name)
|
|
165
|
+
deleted_files.append({'scope': replica['scope'], 'name': replica['name']})
|
|
166
|
+
continue
|
|
167
|
+
|
|
168
|
+
if replica['pfn']:
|
|
169
|
+
pfn = replica['pfn']
|
|
170
|
+
# sign the URL if necessary
|
|
171
|
+
if prot.attributes['scheme'] == 'https' and rse_info['sign_url'] is not None:
|
|
172
|
+
pfn = get_signed_url(rse_id, rse_info['sign_url'], 'delete', pfn)
|
|
173
|
+
if prot.attributes['scheme'] == 'globus':
|
|
174
|
+
pfns_to_bulk_delete.append(replica['pfn'])
|
|
175
|
+
else:
|
|
176
|
+
prot.delete(pfn)
|
|
177
|
+
else:
|
|
178
|
+
logger(logging.WARNING, 'Deletion UNAVAILABLE of %s:%s as %s on %s', replica['scope'], replica['name'], replica['pfn'], rse_name)
|
|
179
|
+
|
|
180
|
+
duration = stopwatch.elapsed
|
|
181
|
+
METRICS.timer('delete.{scheme}.{rse}').labels(scheme=prot.attributes['scheme'], rse=rse_name).observe(duration)
|
|
182
|
+
|
|
183
|
+
deleted_files.append({'scope': replica['scope'], 'name': replica['name']})
|
|
184
|
+
|
|
185
|
+
deletion_dict['duration'] = duration
|
|
186
|
+
add_message('deletion-done', deletion_dict)
|
|
187
|
+
logger(logging.INFO, 'Deletion SUCCESS of %s:%s as %s on %s in %.2f seconds', replica['scope'], replica['name'], replica['pfn'], rse_name, duration)
|
|
188
|
+
|
|
189
|
+
except SourceNotFound:
|
|
190
|
+
duration = stopwatch.elapsed
|
|
191
|
+
err_msg = 'Deletion NOTFOUND of %s:%s as %s on %s in %.2f seconds' % (replica['scope'], replica['name'], replica['pfn'], rse_name, duration)
|
|
192
|
+
logger(logging.WARNING, '%s', err_msg)
|
|
193
|
+
deletion_dict['reason'] = 'File Not Found'
|
|
194
|
+
deletion_dict['duration'] = duration
|
|
195
|
+
add_message('deletion-not-found', deletion_dict)
|
|
196
|
+
deleted_files.append({'scope': replica['scope'], 'name': replica['name']})
|
|
197
|
+
|
|
198
|
+
except (ServiceUnavailable, RSEAccessDenied, ResourceTemporaryUnavailable) as error:
|
|
199
|
+
duration = stopwatch.elapsed
|
|
200
|
+
logger(logging.WARNING, 'Deletion NOACCESS of %s:%s as %s on %s: %s in %.2f', replica['scope'], replica['name'], replica['pfn'], rse_name, str(error), duration)
|
|
201
|
+
deletion_dict['reason'] = str(error)
|
|
202
|
+
deletion_dict['duration'] = duration
|
|
203
|
+
add_message('deletion-failed', deletion_dict)
|
|
204
|
+
noaccess_attempts += 1
|
|
205
|
+
if noaccess_attempts >= auto_exclude_threshold:
|
|
206
|
+
logger(logging.INFO, 'Too many (%d) NOACCESS attempts for %s. RSE will be temporarily excluded.', noaccess_attempts, rse_name)
|
|
207
|
+
REGION.set('temporary_exclude_%s' % rse_id, True)
|
|
208
|
+
METRICS.gauge('excluded_rses.{rse}').labels(rse=rse_name).set(1)
|
|
209
|
+
|
|
210
|
+
EXCLUDED_RSE_GAUGE.labels(rse=rse_name).set(1)
|
|
211
|
+
break
|
|
212
|
+
|
|
213
|
+
except Exception as error:
|
|
214
|
+
duration = stopwatch.elapsed
|
|
215
|
+
logger(logging.CRITICAL, 'Deletion CRITICAL of %s:%s as %s on %s in %.2f seconds : %s', replica['scope'], replica['name'], replica['pfn'], rse_name, duration, str(traceback.format_exc()))
|
|
216
|
+
deletion_dict['reason'] = str(error)
|
|
217
|
+
deletion_dict['duration'] = duration
|
|
218
|
+
add_message('deletion-failed', deletion_dict)
|
|
219
|
+
|
|
220
|
+
if pfns_to_bulk_delete and prot.attributes['scheme'] == 'globus':
|
|
221
|
+
logger(logging.DEBUG, 'Attempting bulk delete on RSE %s for scheme %s', rse_name, prot.attributes['scheme'])
|
|
222
|
+
prot.bulk_delete(pfns_to_bulk_delete)
|
|
223
|
+
|
|
224
|
+
except (ServiceUnavailable, RSEAccessDenied, ResourceTemporaryUnavailable) as error:
|
|
225
|
+
for replica in replicas:
|
|
226
|
+
logger(logging.WARNING, 'Deletion NOACCESS of %s:%s as %s on %s: %s', replica['scope'], replica['name'], replica['pfn'], rse_name, str(error))
|
|
227
|
+
payload = {'scope': replica['scope'].external,
|
|
228
|
+
'name': replica['name'],
|
|
229
|
+
'rse': rse_name,
|
|
230
|
+
'file-size': replica['bytes'],
|
|
231
|
+
'bytes': replica['bytes'],
|
|
232
|
+
'url': replica['pfn'],
|
|
233
|
+
'reason': str(error),
|
|
234
|
+
'protocol': prot.attributes['scheme']}
|
|
235
|
+
if replica['scope'].vo != 'def':
|
|
236
|
+
payload['vo'] = replica['scope'].vo
|
|
237
|
+
add_message('deletion-failed', payload)
|
|
238
|
+
logger(logging.INFO, 'Cannot connect to %s. RSE will be temporarily excluded.', rse_name)
|
|
239
|
+
REGION.set('temporary_exclude_%s' % rse_id, True)
|
|
240
|
+
EXCLUDED_RSE_GAUGE.labels(rse=rse_name).set(1)
|
|
241
|
+
finally:
|
|
242
|
+
prot.close()
|
|
243
|
+
return deleted_files
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _rse_deletion_hostname(rse: RseData, scheme: Optional[str]) -> Optional[str]:
|
|
247
|
+
"""
|
|
248
|
+
Retrieves the hostname of the default deletion protocol
|
|
249
|
+
"""
|
|
250
|
+
rse.ensure_loaded(load_info=True)
|
|
251
|
+
for prot in rse.info['protocols']:
|
|
252
|
+
if scheme:
|
|
253
|
+
if prot['scheme'] == scheme and prot['domains']['wan']['delete'] != 0:
|
|
254
|
+
return prot['hostname']
|
|
255
|
+
else:
|
|
256
|
+
if prot['domains']['wan']['delete'] == 1:
|
|
257
|
+
return prot['hostname']
|
|
258
|
+
return None
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def get_max_deletion_threads_by_hostname(hostname: str) -> int:
|
|
262
|
+
"""
|
|
263
|
+
Internal method to check RSE usage and limits.
|
|
264
|
+
|
|
265
|
+
:param hostname: the hostname of the SE
|
|
266
|
+
|
|
267
|
+
:returns: The maximum deletion thread for the SE.
|
|
268
|
+
"""
|
|
269
|
+
result = REGION.get('max_deletion_threads_%s' % hostname)
|
|
270
|
+
if isinstance(result, NoValue):
|
|
271
|
+
try:
|
|
272
|
+
max_deletion_thread = config_get_int('reaper', 'max_deletion_threads_%s' % hostname)
|
|
273
|
+
except (NoOptionError, NoSectionError, RuntimeError):
|
|
274
|
+
try:
|
|
275
|
+
max_deletion_thread = config_get_int('reaper', 'nb_workers_by_hostname')
|
|
276
|
+
except (NoOptionError, NoSectionError, RuntimeError):
|
|
277
|
+
max_deletion_thread = 5
|
|
278
|
+
REGION.set('max_deletion_threads_%s' % hostname, max_deletion_thread)
|
|
279
|
+
result = max_deletion_thread
|
|
280
|
+
return result
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def __try_reserve_worker_slot(heartbeat_handler: "HeartbeatHandler", rse: RseData, hostname: str, logger: "LoggerFunction") -> Optional[str]:
|
|
284
|
+
"""
|
|
285
|
+
The maximum number of concurrent workers is limited per hostname and per RSE due to storage performance reasons.
|
|
286
|
+
This function tries to reserve a slot to run the deletion worker for the given RSE and hostname.
|
|
287
|
+
|
|
288
|
+
The function doesn't guarantee strong consistency: the number of total workers may end being slightly
|
|
289
|
+
higher than the configured limit.
|
|
290
|
+
|
|
291
|
+
The reservation is done using the "payload" field of the rucio heart-beats.
|
|
292
|
+
if reservation successful, returns the heartbeat payload used for the reservation. Otherwise, returns None
|
|
293
|
+
"""
|
|
294
|
+
|
|
295
|
+
rse_hostname_key = '%s,%s' % (rse.id, hostname)
|
|
296
|
+
payload_cnt = list_payload_counts(heartbeat_handler.executable, older_than=heartbeat_handler.older_than) # type: ignore (argument missing: session)
|
|
297
|
+
tot_threads_for_hostname = 0
|
|
298
|
+
tot_threads_for_rse = 0
|
|
299
|
+
for key in payload_cnt:
|
|
300
|
+
if key and key.find(',') > -1:
|
|
301
|
+
if key.split(',')[1] == hostname:
|
|
302
|
+
tot_threads_for_hostname += payload_cnt[key]
|
|
303
|
+
if key.split(',')[0] == str(rse.id):
|
|
304
|
+
tot_threads_for_rse += payload_cnt[key]
|
|
305
|
+
max_deletion_thread = get_max_deletion_threads_by_hostname(hostname)
|
|
306
|
+
if rse_hostname_key in payload_cnt and tot_threads_for_hostname >= max_deletion_thread:
|
|
307
|
+
logger(logging.DEBUG, 'Too many deletion threads for %s on RSE %s. Back off', hostname, rse.name)
|
|
308
|
+
return None
|
|
309
|
+
logger(logging.INFO, 'Nb workers on %s smaller than the limit (current %i vs max %i). Starting new worker on RSE %s', hostname, tot_threads_for_hostname, max_deletion_thread, rse.name)
|
|
310
|
+
_, total_workers, logger = heartbeat_handler.live(payload=rse_hostname_key)
|
|
311
|
+
logger(logging.DEBUG, 'Total deletion workers for %s : %i', hostname, tot_threads_for_hostname + 1)
|
|
312
|
+
return rse_hostname_key
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def __check_rse_usage_cached(rse: RseData, greedy: bool = False, logger: "LoggerFunction" = logging.log) -> tuple[int, bool]:
|
|
316
|
+
"""
|
|
317
|
+
Wrapper around __check_rse_usage which manages the cache entry.
|
|
318
|
+
"""
|
|
319
|
+
cache_key = 'rse_usage_%s' % rse.id
|
|
320
|
+
result = REGION.get(cache_key)
|
|
321
|
+
if isinstance(result, NoValue):
|
|
322
|
+
result = __check_rse_usage(rse=rse, greedy=greedy, logger=logger)
|
|
323
|
+
REGION.set(cache_key, result)
|
|
324
|
+
return result
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def __check_rse_usage(rse: RseData, greedy: bool = False, logger: "LoggerFunction" = logging.log) -> tuple[int, bool]:
|
|
328
|
+
"""
|
|
329
|
+
Internal method to check RSE usage and limits.
|
|
330
|
+
|
|
331
|
+
:param rse_name: The RSE name.
|
|
332
|
+
:param rse_id: The RSE id.
|
|
333
|
+
:param greedy: If True, needed_free_space will be set to 1TB regardless of actual rse usage.
|
|
334
|
+
|
|
335
|
+
:returns: needed_free_space, only_delete_obsolete.
|
|
336
|
+
"""
|
|
337
|
+
|
|
338
|
+
needed_free_space = 0
|
|
339
|
+
# First of all check if greedy mode is enabled for this RSE
|
|
340
|
+
if greedy:
|
|
341
|
+
return 1000000000000, False
|
|
342
|
+
|
|
343
|
+
rse.ensure_loaded(load_limits=True, load_usage=True, load_attributes=True)
|
|
344
|
+
available_sources = {}
|
|
345
|
+
available_sources['total'] = {key['source']: key['total'] for key in rse.usage}
|
|
346
|
+
available_sources['used'] = {key['source']: key['used'] for key in rse.usage}
|
|
347
|
+
|
|
348
|
+
# Get RSE limits
|
|
349
|
+
min_free_space = rse.limits.get('MinFreeSpace', 0)
|
|
350
|
+
|
|
351
|
+
# Check from which sources to get used and total spaces (default storage)
|
|
352
|
+
# If specified sources do not exist, only delete obsolete
|
|
353
|
+
source_for_total_space = rse.attributes.get(RseAttr.SOURCE_FOR_TOTAL_SPACE, 'storage')
|
|
354
|
+
if source_for_total_space not in available_sources['total']:
|
|
355
|
+
logger(logging.WARNING, 'RSE: %s, \'%s\' requested for source_for_total_space but cannot be found. Will only delete obsolete',
|
|
356
|
+
rse.name, source_for_total_space)
|
|
357
|
+
return 0, True
|
|
358
|
+
source_for_used_space = rse.attributes.get(RseAttr.SOURCE_FOR_USED_SPACE, 'storage')
|
|
359
|
+
if source_for_used_space not in available_sources['used']:
|
|
360
|
+
logger(logging.WARNING, 'RSE: %s, \'%s\' requested for source_for_used_space but cannot be found. Will only delete obsolete',
|
|
361
|
+
rse.name, source_for_used_space)
|
|
362
|
+
return 0, True
|
|
363
|
+
|
|
364
|
+
logger(logging.DEBUG, 'RSE: %s, source_for_total_space: %s, source_for_used_space: %s',
|
|
365
|
+
rse.name, source_for_total_space, source_for_used_space)
|
|
366
|
+
|
|
367
|
+
# Get total and used space
|
|
368
|
+
total = available_sources['total'][source_for_total_space]
|
|
369
|
+
used = available_sources['used'][source_for_used_space]
|
|
370
|
+
|
|
371
|
+
free = total - used
|
|
372
|
+
if min_free_space:
|
|
373
|
+
needed_free_space = min_free_space - free
|
|
374
|
+
|
|
375
|
+
# If needed_free_space negative, nothing to delete except if some Epoch tombstoned replicas
|
|
376
|
+
if needed_free_space > 0:
|
|
377
|
+
return needed_free_space, False
|
|
378
|
+
|
|
379
|
+
return 0, True
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def reaper(
|
|
383
|
+
rses: "Sequence[str]",
|
|
384
|
+
include_rses: Optional[str],
|
|
385
|
+
exclude_rses: Optional[str],
|
|
386
|
+
vos: Optional["Sequence[str]"] = None,
|
|
387
|
+
chunk_size: int = 100,
|
|
388
|
+
once: bool = False,
|
|
389
|
+
greedy: bool = False,
|
|
390
|
+
scheme: Optional[str] = None,
|
|
391
|
+
delay_seconds: int = 0,
|
|
392
|
+
sleep_time: int = 60,
|
|
393
|
+
auto_exclude_threshold: int = 100,
|
|
394
|
+
auto_exclude_timeout: int = 600
|
|
395
|
+
) -> None:
|
|
396
|
+
"""
|
|
397
|
+
Main loop to select and delete files.
|
|
398
|
+
|
|
399
|
+
:param rses: List of RSEs the reaper should work against. If empty, it considers all RSEs.
|
|
400
|
+
:param include_rses: RSE expression to include RSEs.
|
|
401
|
+
:param exclude_rses: RSE expression to exclude RSEs from the Reaper.
|
|
402
|
+
:param vos: VOs on which to look for RSEs. Only used in multi-VO mode.
|
|
403
|
+
If None, we either use all VOs if run from "def", or the current VO otherwise.
|
|
404
|
+
:param chunk_size: The size of chunk for deletion.
|
|
405
|
+
:param once: If True, only runs one iteration of the main loop.
|
|
406
|
+
:param greedy: If True, delete right away replicas with tombstone.
|
|
407
|
+
:param scheme: Force the reaper to use a particular protocol, e.g., mock.
|
|
408
|
+
:param delay_seconds: The delay to query replicas in BEING_DELETED state.
|
|
409
|
+
:param sleep_time: Time between two cycles.
|
|
410
|
+
:param auto_exclude_threshold: Number of service unavailable exceptions after which the RSE gets temporarily excluded.
|
|
411
|
+
:param auto_exclude_timeout: Timeout for temporarily excluded RSEs.
|
|
412
|
+
"""
|
|
413
|
+
run_daemon(
|
|
414
|
+
once=once,
|
|
415
|
+
graceful_stop=GRACEFUL_STOP,
|
|
416
|
+
executable=DAEMON_NAME,
|
|
417
|
+
partition_wait_time=0 if once else 10,
|
|
418
|
+
sleep_time=sleep_time,
|
|
419
|
+
run_once_fnc=functools.partial(
|
|
420
|
+
run_once,
|
|
421
|
+
rses=rses,
|
|
422
|
+
include_rses=include_rses,
|
|
423
|
+
exclude_rses=exclude_rses,
|
|
424
|
+
vos=vos,
|
|
425
|
+
chunk_size=chunk_size,
|
|
426
|
+
greedy=greedy,
|
|
427
|
+
scheme=scheme,
|
|
428
|
+
delay_seconds=delay_seconds,
|
|
429
|
+
auto_exclude_threshold=auto_exclude_threshold,
|
|
430
|
+
auto_exclude_timeout=auto_exclude_timeout,
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
def run_once(
|
|
436
|
+
rses: "Sequence[str]",
|
|
437
|
+
include_rses: Optional[str],
|
|
438
|
+
exclude_rses: Optional[str],
|
|
439
|
+
vos: Optional["Sequence[str]"],
|
|
440
|
+
chunk_size: int,
|
|
441
|
+
greedy: bool,
|
|
442
|
+
scheme: Optional[str],
|
|
443
|
+
delay_seconds: int,
|
|
444
|
+
auto_exclude_threshold: int,
|
|
445
|
+
auto_exclude_timeout: int,
|
|
446
|
+
heartbeat_handler: "HeartbeatHandler",
|
|
447
|
+
**_kwargs
|
|
448
|
+
) -> bool:
|
|
449
|
+
|
|
450
|
+
must_sleep = True
|
|
451
|
+
|
|
452
|
+
_, total_workers, logger = heartbeat_handler.live()
|
|
453
|
+
logger(logging.INFO, 'Reaper started')
|
|
454
|
+
|
|
455
|
+
# try to get auto exclude parameters from the config table. Otherwise use CLI parameters.
|
|
456
|
+
auto_exclude_threshold = config_get_int('reaper', 'auto_exclude_threshold', default=auto_exclude_threshold, raise_exception=False)
|
|
457
|
+
auto_exclude_timeout = config_get_int('reaper', 'auto_exclude_timeout', default=auto_exclude_timeout, raise_exception=False)
|
|
458
|
+
# Check if there is a Judge Evaluator backlog
|
|
459
|
+
max_evaluator_backlog_count = config_get_int('reaper', 'max_evaluator_backlog_count', default=None, raise_exception=False)
|
|
460
|
+
max_evaluator_backlog_duration = config_get_int('reaper', 'max_evaluator_backlog_duration', default=None, raise_exception=False)
|
|
461
|
+
if max_evaluator_backlog_count or max_evaluator_backlog_duration:
|
|
462
|
+
backlog = get_evaluation_backlog()
|
|
463
|
+
count_is_hit = max_evaluator_backlog_count and backlog[0] and backlog[0] > max_evaluator_backlog_count
|
|
464
|
+
duration_is_hit = max_evaluator_backlog_duration and backlog[1] and backlog[1] < datetime.utcnow() - timedelta(minutes=max_evaluator_backlog_duration)
|
|
465
|
+
if count_is_hit and duration_is_hit:
|
|
466
|
+
logger(logging.ERROR, 'Reaper: Judge evaluator backlog count and duration hit, stopping operation')
|
|
467
|
+
return must_sleep
|
|
468
|
+
elif count_is_hit:
|
|
469
|
+
logger(logging.ERROR, 'Reaper: Judge evaluator backlog count hit, stopping operation')
|
|
470
|
+
return must_sleep
|
|
471
|
+
elif duration_is_hit:
|
|
472
|
+
logger(logging.ERROR, 'Reaper: Judge evaluator backlog duration hit, stopping operation')
|
|
473
|
+
return must_sleep
|
|
474
|
+
|
|
475
|
+
rses_to_process = get_rses_to_process(rses, include_rses, exclude_rses, vos)
|
|
476
|
+
if not rses_to_process:
|
|
477
|
+
logger(logging.WARNING, 'Reaper: No RSEs found, sleeping')
|
|
478
|
+
return must_sleep
|
|
479
|
+
else:
|
|
480
|
+
rses_to_process = [RseData(id_=rse['id'], name=rse['rse'], columns=rse) for rse in rses_to_process]
|
|
481
|
+
|
|
482
|
+
# On big deletion campaigns, we desire to re-iterate fast on RSEs which have a lot of data to delete.
|
|
483
|
+
# The called function will return the RSEs which have more work remaining.
|
|
484
|
+
# Call the deletion routine again on this returned subset of RSEs.
|
|
485
|
+
# Scale the number of allowed iterations with the number of total reaper workers
|
|
486
|
+
iteration = 0
|
|
487
|
+
max_fast_reiterations = int(log2(total_workers))
|
|
488
|
+
while rses_to_process and iteration <= max_fast_reiterations:
|
|
489
|
+
rses_to_process = _run_once(
|
|
490
|
+
rses_to_process=rses_to_process,
|
|
491
|
+
chunk_size=chunk_size,
|
|
492
|
+
greedy=greedy,
|
|
493
|
+
scheme=scheme,
|
|
494
|
+
delay_seconds=delay_seconds,
|
|
495
|
+
auto_exclude_threshold=auto_exclude_threshold,
|
|
496
|
+
auto_exclude_timeout=auto_exclude_timeout,
|
|
497
|
+
heartbeat_handler=heartbeat_handler,
|
|
498
|
+
)
|
|
499
|
+
if rses_to_process and iteration < max_fast_reiterations:
|
|
500
|
+
logger(logging.INFO, "Will perform fast-reiteration %d/%d with rses: %s", iteration + 1, max_fast_reiterations, [str(rse) for rse in rses_to_process])
|
|
501
|
+
iteration += 1
|
|
502
|
+
|
|
503
|
+
if rses_to_process:
|
|
504
|
+
# There is still more work to be performed.
|
|
505
|
+
# Inform the calling context that it must call reaper again (on the full list of rses)
|
|
506
|
+
must_sleep = False
|
|
507
|
+
|
|
508
|
+
return must_sleep
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
def _run_once(
|
|
512
|
+
rses_to_process: "Iterable[RseData]",
|
|
513
|
+
chunk_size: int,
|
|
514
|
+
greedy: bool,
|
|
515
|
+
scheme: Optional[str],
|
|
516
|
+
delay_seconds: int,
|
|
517
|
+
auto_exclude_threshold: int,
|
|
518
|
+
auto_exclude_timeout: int,
|
|
519
|
+
heartbeat_handler: "HeartbeatHandler",
|
|
520
|
+
**_kwargs
|
|
521
|
+
) -> list[RseData]:
|
|
522
|
+
|
|
523
|
+
dict_rses = {}
|
|
524
|
+
_, total_workers, logger = heartbeat_handler.live()
|
|
525
|
+
tot_needed_free_space = 0
|
|
526
|
+
for rse in rses_to_process:
|
|
527
|
+
# Check if RSE is blocklisted
|
|
528
|
+
if not rse.columns['availability_delete']:
|
|
529
|
+
logger(logging.DEBUG, 'RSE %s is blocklisted for delete', rse.name)
|
|
530
|
+
continue
|
|
531
|
+
rse.ensure_loaded(load_attributes=True)
|
|
532
|
+
enable_greedy = rse.attributes.get(RseAttr.GREEDYDELETION, False) or greedy
|
|
533
|
+
needed_free_space, only_delete_obsolete = __check_rse_usage_cached(rse, greedy=enable_greedy, logger=logger)
|
|
534
|
+
if needed_free_space:
|
|
535
|
+
dict_rses[rse] = [needed_free_space, only_delete_obsolete, enable_greedy]
|
|
536
|
+
tot_needed_free_space += needed_free_space
|
|
537
|
+
elif only_delete_obsolete:
|
|
538
|
+
dict_rses[rse] = [needed_free_space, only_delete_obsolete, enable_greedy]
|
|
539
|
+
else:
|
|
540
|
+
logger(logging.DEBUG, 'Nothing to delete on %s', rse.name)
|
|
541
|
+
|
|
542
|
+
rses_with_params = [(rse, needed_free_space, only_delete_obsolete, enable_greedy)
|
|
543
|
+
for rse, (needed_free_space, only_delete_obsolete, enable_greedy) in dict_rses.items()]
|
|
544
|
+
|
|
545
|
+
# Ordering the RSEs based on the needed free space
|
|
546
|
+
sorted_rses = sorted(rses_with_params, key=lambda x: x[1], reverse=True)
|
|
547
|
+
log_msg_str = ', '.join(f'{rse}:{needed_free_space}:{only_delete_obsolete}:{enable_greedy}'
|
|
548
|
+
for rse, needed_free_space, only_delete_obsolete, enable_greedy in sorted_rses)
|
|
549
|
+
logger(logging.DEBUG, 'List of RSEs to process ordered by needed space desc: %s', log_msg_str)
|
|
550
|
+
|
|
551
|
+
random.shuffle(rses_with_params)
|
|
552
|
+
|
|
553
|
+
work_remaining_by_rse = {}
|
|
554
|
+
paused_rses = []
|
|
555
|
+
for rse, needed_free_space, only_delete_obsolete, enable_greedy in rses_with_params:
|
|
556
|
+
result = REGION.get('pause_deletion_%s' % rse.id, expiration_time=120)
|
|
557
|
+
if not isinstance(result, NoValue):
|
|
558
|
+
paused_rses.append(rse.name)
|
|
559
|
+
logger(logging.DEBUG, 'Not enough replicas to delete on %s during the previous cycle. Deletion paused for a while', rse.name)
|
|
560
|
+
continue
|
|
561
|
+
|
|
562
|
+
result = REGION.get('temporary_exclude_%s' % rse.id, expiration_time=auto_exclude_timeout)
|
|
563
|
+
if not isinstance(result, NoValue):
|
|
564
|
+
logger(logging.WARNING, 'Too many failed attempts for %s in last cycle. RSE is temporarily excluded.', rse.name)
|
|
565
|
+
EXCLUDED_RSE_GAUGE.labels(rse=rse.name).set(1)
|
|
566
|
+
continue
|
|
567
|
+
EXCLUDED_RSE_GAUGE.labels(rse=rse.name).set(0)
|
|
568
|
+
|
|
569
|
+
percent = 0
|
|
570
|
+
if tot_needed_free_space:
|
|
571
|
+
percent = needed_free_space / tot_needed_free_space * 100
|
|
572
|
+
logger(logging.DEBUG, 'Working on %s. Percentage of the total space needed %.2f', rse.name, percent)
|
|
573
|
+
|
|
574
|
+
rse_hostname = _rse_deletion_hostname(rse, scheme)
|
|
575
|
+
if not rse_hostname:
|
|
576
|
+
if scheme:
|
|
577
|
+
logger(logging.WARNING, 'Protocol %s not supported on %s', scheme, rse.name)
|
|
578
|
+
else:
|
|
579
|
+
logger(logging.WARNING, 'No default delete protocol for %s', rse.name)
|
|
580
|
+
REGION.set('pause_deletion_%s' % rse.id, True)
|
|
581
|
+
continue
|
|
582
|
+
|
|
583
|
+
hb_payload = __try_reserve_worker_slot(heartbeat_handler=heartbeat_handler, rse=rse, hostname=rse_hostname, logger=logger)
|
|
584
|
+
if not hb_payload:
|
|
585
|
+
# Might need to reschedule a try on this RSE later in the same cycle
|
|
586
|
+
continue
|
|
587
|
+
|
|
588
|
+
# List and mark BEING_DELETED the files to delete
|
|
589
|
+
del_start_time = time.time()
|
|
590
|
+
try:
|
|
591
|
+
with METRICS.timer('list_unlocked_replicas'):
|
|
592
|
+
if only_delete_obsolete:
|
|
593
|
+
logger(logging.DEBUG, 'Will run list_and_mark_unlocked_replicas on %s. No space needed, will only delete EPOCH tombstoned replicas', rse.name)
|
|
594
|
+
replicas = list_and_mark_unlocked_replicas(limit=chunk_size,
|
|
595
|
+
bytes_=needed_free_space,
|
|
596
|
+
rse_id=rse.id,
|
|
597
|
+
delay_seconds=delay_seconds,
|
|
598
|
+
only_delete_obsolete=only_delete_obsolete,
|
|
599
|
+
session=None) # type: ignore (argument missing: session)
|
|
600
|
+
logger(logging.DEBUG, 'list_and_mark_unlocked_replicas on %s for %s bytes in %s seconds: %s replicas', rse.name, needed_free_space, time.time() - del_start_time, len(replicas))
|
|
601
|
+
if (len(replicas) == 0 and enable_greedy) or (len(replicas) < chunk_size and not enable_greedy):
|
|
602
|
+
logger(logging.DEBUG, 'Not enough replicas to delete on %s (%s requested vs %s returned). Will skip any new attempts on this RSE until next cycle', rse.name, chunk_size, len(replicas))
|
|
603
|
+
REGION.set('pause_deletion_%s' % rse.id, True)
|
|
604
|
+
work_remaining_by_rse[rse] = False
|
|
605
|
+
else:
|
|
606
|
+
work_remaining_by_rse[rse] = True
|
|
607
|
+
|
|
608
|
+
except (DatabaseException, IntegrityError, DatabaseError) as error:
|
|
609
|
+
logger(logging.ERROR, '%s', str(error))
|
|
610
|
+
continue
|
|
611
|
+
except Exception:
|
|
612
|
+
logger(logging.CRITICAL, 'Exception', exc_info=True)
|
|
613
|
+
continue
|
|
614
|
+
# Physical deletion will take place there
|
|
615
|
+
try:
|
|
616
|
+
rse.ensure_loaded(load_info=True, load_attributes=True)
|
|
617
|
+
prot = rsemgr.create_protocol(rse.info, 'delete', scheme=scheme, logger=logger)
|
|
618
|
+
if rse.attributes.get(RseAttr.OIDC_SUPPORT) is True and prot.attributes['scheme'] == 'davs':
|
|
619
|
+
audience = determine_audience_for_rse(rse.id)
|
|
620
|
+
# FIXME: At the time of writing, StoRM requires `storage.read`
|
|
621
|
+
# in order to perform a stat operation.
|
|
622
|
+
scope = determine_scope_for_rse(rse.id, scopes=['storage.modify', 'storage.read'])
|
|
623
|
+
auth_token = request_token(audience, scope)
|
|
624
|
+
if auth_token:
|
|
625
|
+
logger(logging.INFO, 'Using a token to delete on RSE %s', rse.name)
|
|
626
|
+
prot = rsemgr.create_protocol(rse.info, 'delete', scheme=scheme, auth_token=auth_token, logger=logger)
|
|
627
|
+
else:
|
|
628
|
+
logger(logging.WARNING, 'Failed to procure a token to delete on RSE %s', rse.name)
|
|
629
|
+
for file_replicas in chunks(replicas, chunk_size):
|
|
630
|
+
# Refresh heartbeat
|
|
631
|
+
_, total_workers, logger = heartbeat_handler.live(payload=hb_payload)
|
|
632
|
+
del_start_time = time.time()
|
|
633
|
+
for replica in file_replicas:
|
|
634
|
+
try:
|
|
635
|
+
lfn: "LFNDict" = {
|
|
636
|
+
'scope': replica['scope'].external,
|
|
637
|
+
'name': replica['name'],
|
|
638
|
+
'path': replica['path']
|
|
639
|
+
}
|
|
640
|
+
replica['pfn'] = str(list(rsemgr.lfns2pfns(rse_settings=rse.info,
|
|
641
|
+
lfns=[lfn],
|
|
642
|
+
operation='delete', scheme=scheme).values())[0])
|
|
643
|
+
except (ReplicaUnAvailable, ReplicaNotFound) as error:
|
|
644
|
+
logger(logging.WARNING, 'Failed get pfn UNAVAILABLE replica %s:%s on %s with error %s', replica['scope'], replica['name'], rse.name, str(error))
|
|
645
|
+
replica['pfn'] = None
|
|
646
|
+
|
|
647
|
+
except Exception:
|
|
648
|
+
logger(logging.CRITICAL, 'Exception', exc_info=True)
|
|
649
|
+
|
|
650
|
+
is_staging = rse.columns['staging_area']
|
|
651
|
+
deleted_files = delete_from_storage(heartbeat_handler, hb_payload, file_replicas, prot, rse.info, is_staging, auto_exclude_threshold, logger=logger)
|
|
652
|
+
logger(logging.INFO, '%i files processed in %s seconds', len(file_replicas), time.time() - del_start_time)
|
|
653
|
+
|
|
654
|
+
# Then finally delete the replicas
|
|
655
|
+
del_start = time.time()
|
|
656
|
+
delete_replicas(rse_id=rse.id, files=deleted_files) # type: ignore (argument missing: session)
|
|
657
|
+
logger(logging.DEBUG, 'delete_replicas succeeded on %s : %s replicas in %s seconds', rse.name, len(deleted_files), time.time() - del_start)
|
|
658
|
+
METRICS.counter('deletion.done').inc(len(deleted_files))
|
|
659
|
+
except RSEProtocolNotSupported:
|
|
660
|
+
logger(logging.WARNING, 'Protocol %s not supported on %s', scheme, rse.name)
|
|
661
|
+
except Exception:
|
|
662
|
+
logger(logging.CRITICAL, 'Exception', exc_info=True)
|
|
663
|
+
|
|
664
|
+
if paused_rses:
|
|
665
|
+
logger(logging.INFO, 'Deletion paused for a while for following RSEs: %s', ', '.join(paused_rses))
|
|
666
|
+
|
|
667
|
+
rses_with_more_work = [rse for rse, has_more_work in work_remaining_by_rse.items() if has_more_work]
|
|
668
|
+
return rses_with_more_work
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
def stop(signum: Optional[int] = None, frame: Optional["FrameType"] = None) -> None:
|
|
672
|
+
"""
|
|
673
|
+
Graceful exit.
|
|
674
|
+
"""
|
|
675
|
+
GRACEFUL_STOP.set()
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
def run(
|
|
679
|
+
threads: int = 1,
|
|
680
|
+
chunk_size: int = 100,
|
|
681
|
+
once: bool = False,
|
|
682
|
+
greedy: bool = False,
|
|
683
|
+
rses: Optional["Sequence[str]"] = None,
|
|
684
|
+
scheme: Optional[str] = None,
|
|
685
|
+
exclude_rses: Optional[str] = None,
|
|
686
|
+
include_rses: Optional[str] = None,
|
|
687
|
+
vos: Optional["Sequence[str]"] = None,
|
|
688
|
+
delay_seconds: int = 0,
|
|
689
|
+
sleep_time: int = 60,
|
|
690
|
+
auto_exclude_threshold: int = 100,
|
|
691
|
+
auto_exclude_timeout: int = 600
|
|
692
|
+
) -> None:
|
|
693
|
+
"""
|
|
694
|
+
Starts up the reaper threads.
|
|
695
|
+
|
|
696
|
+
:param threads: The total number of workers.
|
|
697
|
+
:param chunk_size: The size of chunk for deletion.
|
|
698
|
+
:param once: If True, only runs one iteration of the main loop.
|
|
699
|
+
:param greedy: If True, delete right away replicas with tombstone.
|
|
700
|
+
:param rses: List of RSEs the reaper should work against.
|
|
701
|
+
If empty, it considers all RSEs.
|
|
702
|
+
:param scheme: Force the reaper to use a particular protocol/scheme, e.g., mock.
|
|
703
|
+
:param exclude_rses: RSE expression to exclude RSEs from the Reaper.
|
|
704
|
+
:param include_rses: RSE expression to include RSEs.
|
|
705
|
+
:param vos: VOs on which to look for RSEs. Only used in multi-VO mode.
|
|
706
|
+
If None, we either use all VOs if run from "def",
|
|
707
|
+
or the current VO otherwise.
|
|
708
|
+
:param delay_seconds: The delay to query replicas in BEING_DELETED state.
|
|
709
|
+
:param sleep_time: Time between two cycles.
|
|
710
|
+
:param auto_exclude_threshold: Number of service unavailable exceptions after which the RSE gets temporarily excluded.
|
|
711
|
+
:param auto_exclude_timeout: Timeout for temporarily excluded RSEs.
|
|
712
|
+
"""
|
|
713
|
+
setup_logging(process_name=DAEMON_NAME)
|
|
714
|
+
|
|
715
|
+
if rucio.db.sqla.util.is_old_db():
|
|
716
|
+
raise DatabaseException('Database was not updated, daemon won\'t start')
|
|
717
|
+
|
|
718
|
+
logging.log(logging.INFO, 'starting reaper threads')
|
|
719
|
+
threads_list = [threading.Thread(target=reaper, kwargs={'once': once,
|
|
720
|
+
'rses': rses,
|
|
721
|
+
'include_rses': include_rses,
|
|
722
|
+
'exclude_rses': exclude_rses,
|
|
723
|
+
'vos': vos,
|
|
724
|
+
'chunk_size': chunk_size,
|
|
725
|
+
'greedy': greedy,
|
|
726
|
+
'sleep_time': sleep_time,
|
|
727
|
+
'delay_seconds': delay_seconds,
|
|
728
|
+
'scheme': scheme,
|
|
729
|
+
'auto_exclude_threshold': auto_exclude_threshold,
|
|
730
|
+
'auto_exclude_timeout': auto_exclude_timeout}) for _ in range(0, threads)]
|
|
731
|
+
|
|
732
|
+
for thread in threads_list:
|
|
733
|
+
thread.start()
|
|
734
|
+
|
|
735
|
+
logging.log(logging.INFO, 'waiting for interrupts')
|
|
736
|
+
|
|
737
|
+
# Interruptible joins require a timeout.
|
|
738
|
+
while threads_list:
|
|
739
|
+
threads_list = [thread.join(timeout=3.14) for thread in threads_list if thread and thread.is_alive()]
|