rucio 35.7.0__py3-none-any.whl → 37.0.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.
- rucio/alembicrevision.py +1 -1
- rucio/{daemons/c3po/collectors → cli}/__init__.py +1 -0
- rucio/cli/account.py +216 -0
- rucio-35.7.0.data/scripts/rucio → rucio/cli/bin_legacy/rucio.py +769 -486
- rucio-35.7.0.data/scripts/rucio-admin → rucio/cli/bin_legacy/rucio_admin.py +476 -423
- 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/accountclient.py +0 -1
- rucio/client/baseclient.py +33 -24
- rucio/client/client.py +45 -1
- rucio/client/didclient.py +5 -3
- rucio/client/downloadclient.py +6 -8
- rucio/client/replicaclient.py +0 -2
- rucio/client/richclient.py +317 -0
- rucio/client/rseclient.py +4 -4
- rucio/client/uploadclient.py +26 -12
- rucio/common/bittorrent.py +234 -0
- rucio/common/cache.py +66 -29
- rucio/common/checksum.py +168 -0
- rucio/common/client.py +122 -0
- rucio/common/config.py +22 -35
- rucio/common/constants.py +61 -3
- rucio/common/didtype.py +72 -24
- rucio/common/dumper/__init__.py +45 -38
- rucio/common/dumper/consistency.py +75 -30
- rucio/common/dumper/data_models.py +63 -19
- rucio/common/dumper/path_parsing.py +19 -8
- rucio/common/exception.py +65 -8
- rucio/common/extra.py +5 -10
- rucio/common/logging.py +13 -13
- rucio/common/pcache.py +8 -7
- rucio/common/plugins.py +59 -27
- rucio/common/policy.py +12 -3
- rucio/common/schema/__init__.py +84 -34
- rucio/common/schema/generic.py +0 -17
- rucio/common/schema/generic_multi_vo.py +0 -17
- rucio/common/test_rucio_server.py +12 -6
- rucio/common/types.py +132 -52
- rucio/common/utils.py +93 -643
- rucio/core/account_limit.py +14 -12
- rucio/core/authentication.py +2 -2
- rucio/core/config.py +23 -42
- rucio/core/credential.py +14 -15
- rucio/core/did.py +5 -1
- rucio/core/did_meta_plugins/elasticsearch_meta.py +407 -0
- rucio/core/did_meta_plugins/filter_engine.py +62 -3
- rucio/core/did_meta_plugins/json_meta.py +2 -2
- rucio/core/did_meta_plugins/mongo_meta.py +43 -30
- rucio/core/did_meta_plugins/postgres_meta.py +75 -39
- rucio/core/identity.py +6 -5
- rucio/core/importer.py +4 -3
- rucio/core/lifetime_exception.py +2 -2
- rucio/core/lock.py +8 -7
- rucio/core/message.py +6 -0
- rucio/core/monitor.py +30 -29
- rucio/core/naming_convention.py +2 -2
- rucio/core/nongrid_trace.py +2 -2
- rucio/core/oidc.py +11 -9
- rucio/core/permission/__init__.py +79 -37
- rucio/core/permission/generic.py +1 -7
- rucio/core/permission/generic_multi_vo.py +1 -7
- rucio/core/quarantined_replica.py +4 -3
- rucio/core/replica.py +464 -139
- rucio/core/replica_sorter.py +55 -59
- rucio/core/request.py +34 -32
- rucio/core/rse.py +301 -97
- rucio/core/rse_counter.py +1 -2
- rucio/core/rse_expression_parser.py +7 -7
- rucio/core/rse_selector.py +9 -7
- rucio/core/rule.py +41 -40
- rucio/core/rule_grouping.py +42 -40
- rucio/core/scope.py +5 -4
- rucio/core/subscription.py +26 -28
- rucio/core/topology.py +11 -11
- rucio/core/trace.py +2 -2
- rucio/core/transfer.py +29 -15
- rucio/core/volatile_replica.py +4 -3
- rucio/daemons/atropos/atropos.py +1 -1
- rucio/daemons/auditor/__init__.py +2 -2
- rucio/daemons/auditor/srmdumps.py +6 -6
- rucio/daemons/automatix/automatix.py +32 -21
- rucio/daemons/badreplicas/necromancer.py +2 -2
- rucio/daemons/bb8/nuclei_background_rebalance.py +1 -1
- rucio/daemons/bb8/t2_background_rebalance.py +1 -1
- rucio/daemons/common.py +15 -25
- rucio/daemons/conveyor/finisher.py +2 -2
- rucio/daemons/conveyor/poller.py +18 -28
- rucio/daemons/conveyor/receiver.py +2 -2
- rucio/daemons/conveyor/stager.py +1 -0
- rucio/daemons/conveyor/submitter.py +3 -3
- rucio/daemons/hermes/hermes.py +91 -30
- rucio/daemons/judge/evaluator.py +2 -2
- rucio/daemons/oauthmanager/oauthmanager.py +3 -3
- rucio/daemons/reaper/dark_reaper.py +7 -3
- rucio/daemons/reaper/reaper.py +12 -16
- rucio/daemons/rsedecommissioner/config.py +1 -1
- rucio/daemons/rsedecommissioner/profiles/generic.py +5 -4
- rucio/daemons/rsedecommissioner/profiles/types.py +7 -6
- rucio/daemons/rsedecommissioner/rse_decommissioner.py +1 -1
- rucio/daemons/storage/consistency/actions.py +8 -6
- rucio/daemons/tracer/kronos.py +4 -4
- rucio/db/sqla/constants.py +5 -0
- rucio/db/sqla/migrate_repo/versions/1677d4d803c8_split_rse_availability_into_multiple.py +4 -4
- rucio/db/sqla/migrate_repo/versions/30d5206e9cad_increase_oauthrequest_redirect_msg_.py +37 -0
- rucio/db/sqla/models.py +157 -154
- rucio/db/sqla/session.py +58 -27
- rucio/db/sqla/types.py +2 -2
- rucio/db/sqla/util.py +2 -2
- rucio/gateway/account.py +18 -12
- rucio/gateway/account_limit.py +137 -60
- rucio/gateway/authentication.py +18 -12
- rucio/gateway/config.py +30 -20
- rucio/gateway/credential.py +9 -10
- rucio/gateway/did.py +70 -53
- rucio/gateway/dirac.py +6 -4
- rucio/gateway/exporter.py +3 -2
- rucio/gateway/heartbeat.py +6 -4
- rucio/gateway/identity.py +36 -51
- rucio/gateway/importer.py +3 -2
- rucio/gateway/lifetime_exception.py +3 -2
- rucio/gateway/meta_conventions.py +17 -6
- rucio/gateway/permission.py +4 -1
- rucio/gateway/quarantined_replica.py +3 -2
- rucio/gateway/replica.py +31 -22
- rucio/gateway/request.py +27 -18
- rucio/gateway/rse.py +69 -37
- rucio/gateway/rule.py +46 -26
- rucio/gateway/scope.py +3 -2
- rucio/gateway/subscription.py +14 -11
- rucio/gateway/vo.py +12 -8
- rucio/rse/__init__.py +3 -3
- rucio/rse/protocols/bittorrent.py +11 -1
- rucio/rse/protocols/cache.py +0 -11
- rucio/rse/protocols/dummy.py +0 -11
- rucio/rse/protocols/gfal.py +14 -9
- rucio/rse/protocols/globus.py +1 -1
- rucio/rse/protocols/http_cache.py +1 -1
- rucio/rse/protocols/posix.py +2 -2
- rucio/rse/protocols/protocol.py +84 -317
- rucio/rse/protocols/rclone.py +2 -1
- rucio/rse/protocols/rfio.py +10 -1
- rucio/rse/protocols/ssh.py +2 -1
- rucio/rse/protocols/storm.py +2 -13
- rucio/rse/protocols/webdav.py +74 -30
- rucio/rse/protocols/xrootd.py +2 -1
- rucio/rse/rsemanager.py +170 -53
- rucio/rse/translation.py +260 -0
- rucio/tests/common.py +23 -13
- rucio/tests/common_server.py +26 -9
- rucio/transfertool/bittorrent.py +15 -14
- rucio/transfertool/bittorrent_driver.py +5 -7
- rucio/transfertool/bittorrent_driver_qbittorrent.py +9 -8
- rucio/transfertool/fts3.py +20 -16
- rucio/transfertool/mock.py +2 -3
- rucio/vcsversion.py +4 -4
- rucio/version.py +7 -0
- rucio/web/rest/flaskapi/v1/accounts.py +17 -3
- rucio/web/rest/flaskapi/v1/auth.py +5 -5
- rucio/web/rest/flaskapi/v1/credentials.py +3 -2
- rucio/web/rest/flaskapi/v1/dids.py +21 -15
- rucio/web/rest/flaskapi/v1/identities.py +33 -9
- rucio/web/rest/flaskapi/v1/redirect.py +5 -4
- rucio/web/rest/flaskapi/v1/replicas.py +12 -8
- rucio/web/rest/flaskapi/v1/rses.py +15 -4
- rucio/web/rest/flaskapi/v1/traces.py +56 -19
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/alembic.ini.template +1 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/alembic_offline.ini.template +1 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +3 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio.cfg.template +3 -19
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +1 -18
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/requirements.server.txt +97 -68
- rucio-37.0.0.data/scripts/rucio +133 -0
- rucio-37.0.0.data/scripts/rucio-admin +97 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-atropos +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-auditor +2 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-automatix +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-cache-client +17 -10
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-receiver +1 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-kronos +1 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-minos +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-minos-temporary-expiration +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-necromancer +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-reaper +6 -6
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-transmogrifier +2 -2
- rucio-37.0.0.dist-info/METADATA +92 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/RECORD +237 -243
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/licenses/AUTHORS.rst +3 -0
- rucio/common/schema/atlas.py +0 -413
- rucio/common/schema/belleii.py +0 -408
- rucio/common/schema/domatpc.py +0 -401
- rucio/common/schema/escape.py +0 -426
- rucio/common/schema/icecube.py +0 -406
- rucio/core/permission/atlas.py +0 -1348
- rucio/core/permission/belleii.py +0 -1077
- rucio/core/permission/escape.py +0 -1078
- rucio/daemons/c3po/algorithms/__init__.py +0 -13
- rucio/daemons/c3po/algorithms/simple.py +0 -134
- rucio/daemons/c3po/algorithms/t2_free_space.py +0 -128
- rucio/daemons/c3po/algorithms/t2_free_space_only_pop.py +0 -130
- rucio/daemons/c3po/algorithms/t2_free_space_only_pop_with_network.py +0 -294
- rucio/daemons/c3po/c3po.py +0 -371
- rucio/daemons/c3po/collectors/agis.py +0 -108
- rucio/daemons/c3po/collectors/free_space.py +0 -81
- rucio/daemons/c3po/collectors/jedi_did.py +0 -57
- rucio/daemons/c3po/collectors/mock_did.py +0 -51
- rucio/daemons/c3po/collectors/network_metrics.py +0 -71
- rucio/daemons/c3po/collectors/workload.py +0 -112
- rucio/daemons/c3po/utils/__init__.py +0 -13
- rucio/daemons/c3po/utils/dataset_cache.py +0 -50
- rucio/daemons/c3po/utils/expiring_dataset_cache.py +0 -56
- rucio/daemons/c3po/utils/expiring_list.py +0 -62
- rucio/daemons/c3po/utils/popularity.py +0 -85
- rucio/daemons/c3po/utils/timeseries.py +0 -89
- rucio/rse/protocols/gsiftp.py +0 -92
- rucio-35.7.0.data/scripts/rucio-c3po +0 -85
- rucio-35.7.0.dist-info/METADATA +0 -72
- /rucio/{daemons/c3po → cli/bin_legacy}/__init__.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-account +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-rse +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-throttler +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-dumper +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-follower +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-hermes +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-cleaner +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-replica-recoverer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-undertaker +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/WHEEL +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/top_level.txt +0 -0
rucio/core/account_limit.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from typing import TYPE_CHECKING
|
|
15
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
16
16
|
|
|
17
17
|
from sqlalchemy.exc import NoResultFound
|
|
18
18
|
from sqlalchemy.sql import func, literal, select
|
|
@@ -27,9 +27,11 @@ from rucio.db.sqla.session import read_session, transactional_session
|
|
|
27
27
|
if TYPE_CHECKING:
|
|
28
28
|
from sqlalchemy.orm import Session
|
|
29
29
|
|
|
30
|
+
from rucio.common.types import InternalAccount, RSEAccountUsageDict, RSEGlobalAccountUsageDict, RSELocalAccountUsageDict, RSEResolvedGlobalAccountLimitDict
|
|
31
|
+
|
|
30
32
|
|
|
31
33
|
@read_session
|
|
32
|
-
def get_rse_account_usage(rse_id, *, session: "Session"):
|
|
34
|
+
def get_rse_account_usage(rse_id: str, *, session: "Session") -> list["RSEAccountUsageDict"]:
|
|
33
35
|
"""
|
|
34
36
|
Returns the account limit and usage for all accounts on a RSE.
|
|
35
37
|
|
|
@@ -89,7 +91,7 @@ def get_rse_account_usage(rse_id, *, session: "Session"):
|
|
|
89
91
|
|
|
90
92
|
|
|
91
93
|
@read_session
|
|
92
|
-
def get_global_account_limits(account=None, *, session: "Session"):
|
|
94
|
+
def get_global_account_limits(account: Optional["InternalAccount"] = None, *, session: "Session") -> dict[str, "RSEResolvedGlobalAccountLimitDict"]:
|
|
93
95
|
"""
|
|
94
96
|
Returns the global account limits for the account.
|
|
95
97
|
|
|
@@ -128,7 +130,7 @@ def get_global_account_limits(account=None, *, session: "Session"):
|
|
|
128
130
|
|
|
129
131
|
|
|
130
132
|
@read_session
|
|
131
|
-
def get_global_account_limit(account, rse_expression, *, session: "Session"):
|
|
133
|
+
def get_global_account_limit(account: "InternalAccount", rse_expression: str, *, session: "Session") -> Union[int, float, None]:
|
|
132
134
|
"""
|
|
133
135
|
Returns the global account limit for the account on the rse expression.
|
|
134
136
|
|
|
@@ -154,7 +156,7 @@ def get_global_account_limit(account, rse_expression, *, session: "Session"):
|
|
|
154
156
|
|
|
155
157
|
|
|
156
158
|
@read_session
|
|
157
|
-
def get_local_account_limit(account, rse_id, *, session: "Session"):
|
|
159
|
+
def get_local_account_limit(account: "InternalAccount", rse_id: str, *, session: "Session") -> Union[int, float, None]:
|
|
158
160
|
"""
|
|
159
161
|
Returns the account limit for the account on the rse.
|
|
160
162
|
|
|
@@ -180,7 +182,7 @@ def get_local_account_limit(account, rse_id, *, session: "Session"):
|
|
|
180
182
|
|
|
181
183
|
|
|
182
184
|
@read_session
|
|
183
|
-
def get_local_account_limits(account, rse_ids=None, *, session: "Session"):
|
|
185
|
+
def get_local_account_limits(account: "InternalAccount", rse_ids: Optional[list[str]] = None, *, session: "Session") -> dict[str, int]:
|
|
184
186
|
"""
|
|
185
187
|
Returns the account limits for the account on the list of rses.
|
|
186
188
|
|
|
@@ -225,7 +227,7 @@ def get_local_account_limits(account, rse_ids=None, *, session: "Session"):
|
|
|
225
227
|
|
|
226
228
|
|
|
227
229
|
@transactional_session
|
|
228
|
-
def set_local_account_limit(account, rse_id, bytes_, *, session: "Session"):
|
|
230
|
+
def set_local_account_limit(account: "InternalAccount", rse_id: str, bytes_: int, *, session: "Session") -> None:
|
|
229
231
|
"""
|
|
230
232
|
Returns the limits for the account on the rse.
|
|
231
233
|
|
|
@@ -248,7 +250,7 @@ def set_local_account_limit(account, rse_id, bytes_, *, session: "Session"):
|
|
|
248
250
|
|
|
249
251
|
|
|
250
252
|
@transactional_session
|
|
251
|
-
def set_global_account_limit(account, rse_expression, bytes_, *, session: "Session"):
|
|
253
|
+
def set_global_account_limit(account: "InternalAccount", rse_expression: str, bytes_: int, *, session: "Session") -> None:
|
|
252
254
|
"""
|
|
253
255
|
Sets the global limit for the account on a RSE expression.
|
|
254
256
|
|
|
@@ -271,7 +273,7 @@ def set_global_account_limit(account, rse_expression, bytes_, *, session: "Sessi
|
|
|
271
273
|
|
|
272
274
|
|
|
273
275
|
@transactional_session
|
|
274
|
-
def delete_local_account_limit(account, rse_id, *, session: "Session"):
|
|
276
|
+
def delete_local_account_limit(account: "InternalAccount", rse_id: str, *, session: "Session") -> bool:
|
|
275
277
|
"""
|
|
276
278
|
Deletes a local account limit.
|
|
277
279
|
|
|
@@ -295,7 +297,7 @@ def delete_local_account_limit(account, rse_id, *, session: "Session"):
|
|
|
295
297
|
|
|
296
298
|
|
|
297
299
|
@transactional_session
|
|
298
|
-
def delete_global_account_limit(account, rse_expression, *, session: "Session"):
|
|
300
|
+
def delete_global_account_limit(account: "InternalAccount", rse_expression: str, *, session: "Session") -> bool:
|
|
299
301
|
"""
|
|
300
302
|
Deletes a global account limit.
|
|
301
303
|
|
|
@@ -319,7 +321,7 @@ def delete_global_account_limit(account, rse_expression, *, session: "Session"):
|
|
|
319
321
|
|
|
320
322
|
|
|
321
323
|
@transactional_session
|
|
322
|
-
def get_local_account_usage(account, rse_id=None, *, session: "Session"):
|
|
324
|
+
def get_local_account_usage(account: "InternalAccount", rse_id: Optional[str] = None, *, session: "Session") -> list["RSELocalAccountUsageDict"]:
|
|
323
325
|
"""
|
|
324
326
|
Read the account usage and connect it with (if available) the account limits of the account.
|
|
325
327
|
|
|
@@ -370,7 +372,7 @@ def get_local_account_usage(account, rse_id=None, *, session: "Session"):
|
|
|
370
372
|
|
|
371
373
|
|
|
372
374
|
@transactional_session
|
|
373
|
-
def get_global_account_usage(account, rse_expression=None, *, session: "Session"):
|
|
375
|
+
def get_global_account_usage(account: "InternalAccount", rse_expression: Optional[str] = None, *, session: "Session") -> list["RSEGlobalAccountUsageDict"]:
|
|
374
376
|
"""
|
|
375
377
|
Read the account usage and connect it with the global account limits of the account.
|
|
376
378
|
|
rucio/core/authentication.py
CHANGED
|
@@ -26,7 +26,7 @@ from dogpile.cache import make_region
|
|
|
26
26
|
from dogpile.cache.api import NO_VALUE, NoValue
|
|
27
27
|
from sqlalchemy import delete, null, or_, select
|
|
28
28
|
|
|
29
|
-
from rucio.common.cache import
|
|
29
|
+
from rucio.common.cache import MemcacheRegion
|
|
30
30
|
from rucio.common.config import config_get_bool
|
|
31
31
|
from rucio.common.exception import CannotAuthenticate, RucioException
|
|
32
32
|
from rucio.common.utils import chunks, date_to_str, generate_uuid
|
|
@@ -83,7 +83,7 @@ def token_key_generator(namespace, fni, **kwargs):
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
if config_get_bool('cache', 'use_external_cache_for_auth_tokens', default=False):
|
|
86
|
-
TOKENREGION =
|
|
86
|
+
TOKENREGION = MemcacheRegion(expiration_time=900, function_key_generator=token_key_generator)
|
|
87
87
|
else:
|
|
88
88
|
TOKENREGION = make_region(function_key_generator=token_key_generator).configure('dogpile.cache.memory', expiration_time=900)
|
|
89
89
|
|
rucio/core/config.py
CHANGED
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from collections.abc import Callable
|
|
16
15
|
from typing import TYPE_CHECKING, Any, Optional, TypeVar
|
|
17
16
|
|
|
18
17
|
from dogpile.cache.api import NoValue
|
|
19
18
|
from sqlalchemy import and_, delete, func, select, update
|
|
20
19
|
|
|
21
|
-
from rucio.common.cache import
|
|
20
|
+
from rucio.common.cache import CacheKey, MemcacheRegion
|
|
22
21
|
from rucio.common.exception import ConfigNotFound
|
|
23
22
|
from rucio.db.sqla import models
|
|
24
23
|
from rucio.db.sqla.session import read_session, transactional_session
|
|
@@ -26,34 +25,16 @@ from rucio.db.sqla.session import read_session, transactional_session
|
|
|
26
25
|
T = TypeVar('T')
|
|
27
26
|
|
|
28
27
|
if TYPE_CHECKING:
|
|
28
|
+
from collections.abc import Callable
|
|
29
|
+
|
|
29
30
|
from sqlalchemy.orm import Session
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
REGION =
|
|
33
|
+
REGION = MemcacheRegion(expiration_time=900)
|
|
33
34
|
|
|
34
35
|
SECTIONS_CACHE_KEY = 'sections'
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
def _has_section_cache_key(section: str) -> str:
|
|
38
|
-
return 'has_section_%s' % section
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def _options_cache_key(section: str) -> str:
|
|
42
|
-
return 'options_%s' % section
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def _has_option_cache_key(section: str, option: str) -> str:
|
|
46
|
-
return 'has_option_%s_%s' % (section, option)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def _items_cache_key(section: str) -> str:
|
|
50
|
-
return 'items_%s' % section
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _value_cache_key(section: str, option: str) -> str:
|
|
54
|
-
return 'get_%s_%s' % (section, option)
|
|
55
|
-
|
|
56
|
-
|
|
57
38
|
@read_session
|
|
58
39
|
def sections(
|
|
59
40
|
*,
|
|
@@ -144,7 +125,7 @@ def options(
|
|
|
144
125
|
:param session: The database session in use.
|
|
145
126
|
:returns: ['option', ...]
|
|
146
127
|
"""
|
|
147
|
-
options_key =
|
|
128
|
+
options_key = CacheKey.options(section)
|
|
148
129
|
options = NoValue()
|
|
149
130
|
if use_cache:
|
|
150
131
|
options = read_from_cache(options_key, expiration_time)
|
|
@@ -178,7 +159,7 @@ def has_option(
|
|
|
178
159
|
:param session: The database session in use.
|
|
179
160
|
:returns: True/False
|
|
180
161
|
"""
|
|
181
|
-
has_option_key =
|
|
162
|
+
has_option_key = CacheKey.has_option(section, option)
|
|
182
163
|
has_option = NoValue()
|
|
183
164
|
if use_cache:
|
|
184
165
|
has_option = read_from_cache(has_option_key, expiration_time)
|
|
@@ -202,7 +183,7 @@ def get(
|
|
|
202
183
|
default: Optional[T] = None,
|
|
203
184
|
use_cache: bool = True,
|
|
204
185
|
expiration_time: int = 900,
|
|
205
|
-
convert_type_fnc: Callable[[str], T],
|
|
186
|
+
convert_type_fnc: 'Callable[[str], T]',
|
|
206
187
|
session: "Session"
|
|
207
188
|
) -> T:
|
|
208
189
|
"""
|
|
@@ -220,7 +201,7 @@ def get(
|
|
|
220
201
|
:param session: The database session in use.
|
|
221
202
|
:returns: The auto-coerced value.
|
|
222
203
|
"""
|
|
223
|
-
value_key =
|
|
204
|
+
value_key = CacheKey.value(section, option)
|
|
224
205
|
value = NoValue()
|
|
225
206
|
if use_cache:
|
|
226
207
|
value = read_from_cache(value_key, expiration_time)
|
|
@@ -251,7 +232,7 @@ def items(
|
|
|
251
232
|
use_cache: bool = True,
|
|
252
233
|
expiration_time: int = 900,
|
|
253
234
|
*,
|
|
254
|
-
convert_type_fnc: Callable[[str], T],
|
|
235
|
+
convert_type_fnc: 'Callable[[str], T]',
|
|
255
236
|
session: "Session"
|
|
256
237
|
) -> list[tuple[str, T]]:
|
|
257
238
|
"""
|
|
@@ -264,7 +245,7 @@ def items(
|
|
|
264
245
|
:param session: The database session in use.
|
|
265
246
|
:returns: [('option', auto-coerced value), ...]
|
|
266
247
|
"""
|
|
267
|
-
items_key =
|
|
248
|
+
items_key = CacheKey.items(section)
|
|
268
249
|
items = NoValue()
|
|
269
250
|
if use_cache:
|
|
270
251
|
items = read_from_cache(items_key, expiration_time)
|
|
@@ -303,12 +284,12 @@ def set(
|
|
|
303
284
|
new_option = models.Config(section=section, opt=option, value=value)
|
|
304
285
|
new_option.save(session=session)
|
|
305
286
|
|
|
306
|
-
delete_from_cache(key=
|
|
307
|
-
delete_from_cache(key=
|
|
308
|
-
delete_from_cache(key=
|
|
287
|
+
delete_from_cache(key=CacheKey.value(section, option))
|
|
288
|
+
delete_from_cache(key=CacheKey.has_option(section, option))
|
|
289
|
+
delete_from_cache(key=CacheKey.items(section))
|
|
309
290
|
if not section_existed:
|
|
310
291
|
delete_from_cache(key=SECTIONS_CACHE_KEY)
|
|
311
|
-
delete_from_cache(key=
|
|
292
|
+
delete_from_cache(key=CacheKey.has_section(section))
|
|
312
293
|
else:
|
|
313
294
|
stmt = select(
|
|
314
295
|
models.Config.value
|
|
@@ -331,8 +312,8 @@ def set(
|
|
|
331
312
|
models.Config.value: str(value)
|
|
332
313
|
})
|
|
333
314
|
session.execute(stmt)
|
|
334
|
-
delete_from_cache(key=
|
|
335
|
-
delete_from_cache(key=
|
|
315
|
+
delete_from_cache(key=CacheKey.value(section, option))
|
|
316
|
+
delete_from_cache(key=CacheKey.items(section))
|
|
336
317
|
|
|
337
318
|
|
|
338
319
|
@transactional_session
|
|
@@ -358,8 +339,8 @@ def remove_section(section: str, *, session: "Session") -> bool:
|
|
|
358
339
|
opt=old[1],
|
|
359
340
|
value=old[2])
|
|
360
341
|
old_option.save(session=session)
|
|
361
|
-
delete_from_cache(key=
|
|
362
|
-
delete_from_cache(key=
|
|
342
|
+
delete_from_cache(key=CacheKey.has_option(old[0], old[1]))
|
|
343
|
+
delete_from_cache(key=CacheKey.value(old[0], old[1]))
|
|
363
344
|
|
|
364
345
|
stmt = delete(
|
|
365
346
|
models.Config
|
|
@@ -368,7 +349,7 @@ def remove_section(section: str, *, session: "Session") -> bool:
|
|
|
368
349
|
)
|
|
369
350
|
session.execute(stmt)
|
|
370
351
|
delete_from_cache(key=SECTIONS_CACHE_KEY)
|
|
371
|
-
delete_from_cache(key=
|
|
352
|
+
delete_from_cache(key=CacheKey.items(section))
|
|
372
353
|
return True
|
|
373
354
|
|
|
374
355
|
|
|
@@ -416,10 +397,10 @@ def remove_option(section: str, option: str, *, session: "Session") -> bool:
|
|
|
416
397
|
if not session.execute(stmt).scalar_one_or_none():
|
|
417
398
|
# we deleted the last config entry in the section. Invalidate the section cache
|
|
418
399
|
delete_from_cache(key=SECTIONS_CACHE_KEY)
|
|
419
|
-
delete_from_cache(key=
|
|
420
|
-
delete_from_cache(key=
|
|
421
|
-
delete_from_cache(key=
|
|
422
|
-
delete_from_cache(key=
|
|
400
|
+
delete_from_cache(key=CacheKey.has_section(section))
|
|
401
|
+
delete_from_cache(key=CacheKey.items(section))
|
|
402
|
+
delete_from_cache(key=CacheKey.has_option(section, option))
|
|
403
|
+
delete_from_cache(key=CacheKey.value(section, option))
|
|
423
404
|
return True
|
|
424
405
|
|
|
425
406
|
|
rucio/core/credential.py
CHANGED
|
@@ -17,7 +17,7 @@ import datetime
|
|
|
17
17
|
import hmac
|
|
18
18
|
import time
|
|
19
19
|
from hashlib import sha1
|
|
20
|
-
from typing import
|
|
20
|
+
from typing import Optional
|
|
21
21
|
from urllib.parse import urlencode, urlparse
|
|
22
22
|
|
|
23
23
|
import boto3
|
|
@@ -25,25 +25,25 @@ from botocore.client import Config
|
|
|
25
25
|
from dogpile.cache.api import NO_VALUE
|
|
26
26
|
from google.oauth2.service_account import Credentials
|
|
27
27
|
|
|
28
|
-
from rucio.common.cache import
|
|
28
|
+
from rucio.common.cache import MemcacheRegion
|
|
29
29
|
from rucio.common.config import config_get, get_rse_credentials
|
|
30
|
-
from rucio.common.constants import RseAttr
|
|
30
|
+
from rucio.common.constants import RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS, RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL, SUPPORTED_SIGN_URL_SERVICES, SUPPORTED_SIGN_URL_SERVICES_LITERAL, RseAttr
|
|
31
31
|
from rucio.common.exception import UnsupportedOperation
|
|
32
32
|
from rucio.core.monitor import MetricManager
|
|
33
33
|
from rucio.core.rse import get_rse_attribute
|
|
34
34
|
|
|
35
35
|
CREDS_GCS = None
|
|
36
36
|
|
|
37
|
-
REGION =
|
|
37
|
+
REGION = MemcacheRegion(expiration_time=900)
|
|
38
38
|
METRICS = MetricManager(module=__name__)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def get_signed_url(
|
|
42
42
|
rse_id: str,
|
|
43
|
-
service:
|
|
44
|
-
operation:
|
|
43
|
+
service: SUPPORTED_SIGN_URL_SERVICES_LITERAL,
|
|
44
|
+
operation: RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL,
|
|
45
45
|
url: str,
|
|
46
|
-
lifetime: int = 600
|
|
46
|
+
lifetime: Optional[int] = 600
|
|
47
47
|
) -> str:
|
|
48
48
|
"""
|
|
49
49
|
Get a signed URL for a particular service and operation.
|
|
@@ -60,10 +60,10 @@ def get_signed_url(
|
|
|
60
60
|
|
|
61
61
|
global CREDS_GCS
|
|
62
62
|
|
|
63
|
-
if service not in
|
|
63
|
+
if service not in SUPPORTED_SIGN_URL_SERVICES:
|
|
64
64
|
raise UnsupportedOperation('Service must be "gcs", "s3" or "swift"')
|
|
65
65
|
|
|
66
|
-
if operation not in
|
|
66
|
+
if operation not in RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS:
|
|
67
67
|
raise UnsupportedOperation('Operation must be "read", "write", or "delete"')
|
|
68
68
|
|
|
69
69
|
if url is None or url == '':
|
|
@@ -84,10 +84,6 @@ def get_signed_url(
|
|
|
84
84
|
components = urlparse(url)
|
|
85
85
|
host = components.netloc
|
|
86
86
|
|
|
87
|
-
# select the correct operation
|
|
88
|
-
operations = {'read': 'GET', 'write': 'PUT', 'delete': 'DELETE'}
|
|
89
|
-
operation = operations[operation]
|
|
90
|
-
|
|
91
87
|
# special case to test signature, force epoch time
|
|
92
88
|
if lifetime is None:
|
|
93
89
|
lifetime = 0
|
|
@@ -100,8 +96,11 @@ def get_signed_url(
|
|
|
100
96
|
# sign the path only
|
|
101
97
|
path = components.path
|
|
102
98
|
|
|
99
|
+
# Map operations
|
|
100
|
+
operations = {'read': 'GET', 'write': 'PUT', 'delete': 'DELETE'}
|
|
101
|
+
|
|
103
102
|
# assemble message to sign
|
|
104
|
-
to_sign = "%s\n\n\n%s\n%s" % (operation, lifetime, path)
|
|
103
|
+
to_sign = "%s\n\n\n%s\n%s" % (operations[operation], lifetime, path)
|
|
105
104
|
|
|
106
105
|
# create URL-capable signature
|
|
107
106
|
# first character is always a '=', remove it
|
|
@@ -213,7 +212,7 @@ def get_signed_url(
|
|
|
213
212
|
else:
|
|
214
213
|
swiftop = 'DELETE'
|
|
215
214
|
|
|
216
|
-
expires = int(time.time() + lifetime)
|
|
215
|
+
expires = int(time.time() + lifetime) # type: ignore (lifetime could be None)
|
|
217
216
|
|
|
218
217
|
# create signed URL
|
|
219
218
|
with METRICS.timer('signswift'):
|
rucio/core/did.py
CHANGED
|
@@ -2011,8 +2011,10 @@ def get_metadata(
|
|
|
2011
2011
|
|
|
2012
2012
|
:param scope: The scope name.
|
|
2013
2013
|
:param name: The data identifier name.
|
|
2014
|
+
:param plugin: The metadata plugin to use or 'ALL' for all.
|
|
2014
2015
|
:param session: The database session in use.
|
|
2015
2016
|
|
|
2017
|
+
|
|
2016
2018
|
:returns: List of HARDCODED metadata for did.
|
|
2017
2019
|
"""
|
|
2018
2020
|
return did_meta_plugins.get_metadata(scope, name, plugin=plugin, session=session)
|
|
@@ -2058,6 +2060,7 @@ def list_parent_dids_bulk(
|
|
|
2058
2060
|
def get_metadata_bulk(
|
|
2059
2061
|
dids: list["Mapping[Any, Any]"],
|
|
2060
2062
|
inherit: bool = False,
|
|
2063
|
+
plugin: str = 'JSON',
|
|
2061
2064
|
*,
|
|
2062
2065
|
session: "Session"
|
|
2063
2066
|
) -> "Iterator[dict[str, Any]]":
|
|
@@ -2065,6 +2068,7 @@ def get_metadata_bulk(
|
|
|
2065
2068
|
Get metadata for a list of dids
|
|
2066
2069
|
:param dids: A list of dids.
|
|
2067
2070
|
:param inherit: A boolean. If set to true, the metadata of the parent are concatenated.
|
|
2071
|
+
:param plugin: A string. The metadata plugin to use or 'ALL' for all.
|
|
2068
2072
|
:param session: The database session in use.
|
|
2069
2073
|
"""
|
|
2070
2074
|
if inherit:
|
|
@@ -2096,7 +2100,7 @@ def get_metadata_bulk(
|
|
|
2096
2100
|
meta_dict = {}
|
|
2097
2101
|
for did in unique_dids:
|
|
2098
2102
|
try:
|
|
2099
|
-
meta = get_metadata(did['scope'], did['name'], plugin=
|
|
2103
|
+
meta = get_metadata(did['scope'], did['name'], plugin=plugin, session=session)
|
|
2100
2104
|
except exception.DataIdentifierNotFound:
|
|
2101
2105
|
meta = {}
|
|
2102
2106
|
meta_dict[(did['scope'], did['name'])] = meta
|