rucio 37.5.0__py3-none-any.whl → 37.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rucio might be problematic. Click here for more details.
- rucio/cli/bin_legacy/rucio.py +41 -22
- rucio/cli/bin_legacy/rucio_admin.py +1 -1
- rucio/cli/did.py +2 -2
- rucio/cli/rse.py +2 -3
- rucio/cli/rule.py +9 -5
- rucio/cli/subscription.py +1 -1
- rucio/client/baseclient.py +9 -4
- rucio/client/didclient.py +16 -16
- rucio/client/downloadclient.py +16 -15
- rucio/client/exportclient.py +45 -4
- rucio/client/lockclient.py +3 -3
- rucio/client/pingclient.py +35 -4
- rucio/client/replicaclient.py +2 -2
- rucio/client/touchclient.py +3 -2
- rucio/client/uploadclient.py +728 -183
- rucio/common/cache.py +1 -2
- rucio/common/client.py +4 -30
- rucio/common/config.py +27 -3
- rucio/common/constants.py +5 -1
- rucio/common/didtype.py +2 -2
- rucio/common/dumper/__init__.py +1 -1
- rucio/common/pcache.py +20 -25
- rucio/common/plugins.py +12 -19
- rucio/common/policy.py +3 -2
- rucio/common/schema/__init__.py +11 -8
- rucio/common/types.py +7 -5
- rucio/common/utils.py +1 -1
- rucio/core/account.py +2 -1
- rucio/core/account_limit.py +3 -2
- rucio/core/authentication.py +1 -1
- rucio/core/credential.py +1 -1
- rucio/core/did.py +62 -61
- rucio/core/did_meta_plugins/__init__.py +10 -10
- rucio/core/did_meta_plugins/did_column_meta.py +9 -9
- rucio/core/did_meta_plugins/did_meta_plugin_interface.py +3 -3
- rucio/core/did_meta_plugins/elasticsearch_meta.py +7 -7
- rucio/core/did_meta_plugins/json_meta.py +2 -2
- rucio/core/did_meta_plugins/mongo_meta.py +9 -9
- rucio/core/did_meta_plugins/postgres_meta.py +7 -7
- rucio/core/dirac.py +3 -2
- rucio/core/distance.py +2 -1
- rucio/core/exporter.py +3 -2
- rucio/core/importer.py +5 -5
- rucio/core/lifetime_exception.py +2 -2
- rucio/core/lock.py +7 -7
- rucio/core/meta_conventions.py +2 -2
- rucio/core/monitor.py +1 -1
- rucio/core/naming_convention.py +1 -1
- rucio/core/nongrid_trace.py +2 -2
- rucio/core/oidc.py +2 -2
- rucio/core/permission/__init__.py +9 -6
- rucio/core/permission/generic.py +2 -2
- rucio/core/permission/generic_multi_vo.py +2 -2
- rucio/core/replica.py +22 -22
- rucio/core/request.py +2 -2
- rucio/core/rse.py +7 -7
- rucio/core/rule.py +38 -38
- rucio/core/rule_grouping.py +2 -3
- rucio/core/scope.py +1 -1
- rucio/core/trace.py +2 -2
- rucio/core/transfer.py +2 -2
- rucio/core/vo.py +2 -1
- rucio/daemons/atropos/atropos.py +2 -1
- rucio/daemons/auditor/__init__.py +1 -1
- rucio/daemons/automatix/automatix.py +5 -5
- rucio/daemons/badreplicas/minos.py +12 -5
- rucio/daemons/badreplicas/minos_temporary_expiration.py +5 -2
- rucio/daemons/badreplicas/necromancer.py +9 -3
- rucio/daemons/bb8/bb8.py +2 -1
- rucio/daemons/bb8/common.py +1 -1
- rucio/daemons/bb8/nuclei_background_rebalance.py +3 -3
- rucio/daemons/bb8/t2_background_rebalance.py +1 -1
- rucio/daemons/cache/consumer.py +1 -1
- rucio/daemons/conveyor/common.py +3 -3
- rucio/daemons/conveyor/finisher.py +13 -4
- rucio/daemons/conveyor/poller.py +5 -2
- rucio/daemons/conveyor/receiver.py +1 -1
- rucio/daemons/conveyor/submitter.py +2 -1
- rucio/daemons/follower/follower.py +1 -1
- rucio/daemons/hermes/hermes.py +29 -8
- rucio/daemons/judge/cleaner.py +2 -2
- rucio/daemons/judge/evaluator.py +7 -7
- rucio/daemons/judge/injector.py +2 -2
- rucio/daemons/judge/repairer.py +2 -2
- rucio/daemons/reaper/dark_reaper.py +5 -4
- rucio/daemons/reaper/reaper.py +7 -7
- rucio/daemons/replicarecoverer/suspicious_replica_recoverer.py +4 -4
- rucio/daemons/storage/consistency/actions.py +3 -3
- rucio/daemons/tracer/kronos.py +3 -2
- rucio/daemons/transmogrifier/transmogrifier.py +71 -69
- rucio/daemons/undertaker/undertaker.py +8 -7
- rucio/db/sqla/constants.py +4 -3
- rucio/db/sqla/migrate_repo/versions/3082b8cef557_add_naming_convention_table_and_closed_.py +1 -1
- rucio/db/sqla/migrate_repo/versions/4df2c5ddabc0_remove_temporary_dids.py +1 -1
- rucio/db/sqla/migrate_repo/versions/c129ccdb2d5_add_lumiblocknr_to_dids.py +1 -1
- rucio/db/sqla/models.py +3 -3
- rucio/db/sqla/session.py +7 -7
- rucio/db/sqla/util.py +3 -2
- rucio/gateway/account.py +77 -101
- rucio/gateway/account_limit.py +90 -116
- rucio/gateway/authentication.py +9 -8
- rucio/gateway/config.py +11 -10
- rucio/gateway/credential.py +2 -1
- rucio/gateway/did.py +58 -58
- rucio/gateway/dirac.py +3 -2
- rucio/gateway/exporter.py +2 -1
- rucio/gateway/heartbeat.py +3 -2
- rucio/gateway/identity.py +4 -3
- rucio/gateway/importer.py +2 -1
- rucio/gateway/lifetime_exception.py +5 -4
- rucio/gateway/lock.py +6 -5
- rucio/gateway/meta_conventions.py +3 -2
- rucio/gateway/permission.py +2 -1
- rucio/gateway/quarantined_replica.py +2 -1
- rucio/gateway/replica.py +20 -20
- rucio/gateway/request.py +10 -10
- rucio/gateway/rse.py +27 -26
- rucio/gateway/rule.py +12 -11
- rucio/gateway/scope.py +4 -3
- rucio/gateway/subscription.py +7 -6
- rucio/gateway/vo.py +5 -4
- rucio/rse/__init__.py +7 -6
- rucio/rse/protocols/ngarc.py +2 -2
- rucio/rse/protocols/srm.py +1 -1
- rucio/rse/protocols/webdav.py +8 -1
- rucio/rse/rsemanager.py +5 -4
- rucio/rse/translation.py +2 -2
- rucio/tests/common.py +6 -5
- rucio/vcsversion.py +3 -3
- rucio/web/rest/flaskapi/v1/accountlimits.py +5 -5
- rucio/web/rest/flaskapi/v1/accounts.py +20 -20
- rucio/web/rest/flaskapi/v1/archives.py +4 -3
- rucio/web/rest/flaskapi/v1/common.py +5 -4
- rucio/web/rest/flaskapi/v1/dids.py +382 -331
- rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +5 -5
- rucio/web/rest/flaskapi/v1/locks.py +13 -13
- rucio/web/rest/flaskapi/v1/main.py +1 -0
- rucio/web/rest/flaskapi/v1/redirect.py +2 -2
- rucio/web/rest/flaskapi/v1/replicas.py +16 -16
- rucio/web/rest/flaskapi/v1/requests.py +16 -16
- rucio/web/rest/flaskapi/v1/subscriptions.py +7 -7
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-account +8 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-rse +8 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-auditor +1 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-throttler +7 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-follower +1 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-cleaner +9 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-necromancer +7 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-replica-recoverer +31 -9
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-undertaker +8 -2
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/METADATA +1 -1
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/RECORD +202 -202
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic.ini.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/requirements.server.txt +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-admin +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-atropos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-automatix +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-client +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-receiver +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dumper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-hermes +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-kronos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-reaper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-transmogrifier +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/WHEEL +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/top_level.txt +0 -0
rucio/core/did.py
CHANGED
|
@@ -28,6 +28,7 @@ import rucio.core.replica # import add_replicas
|
|
|
28
28
|
import rucio.core.rule
|
|
29
29
|
from rucio.common import exception
|
|
30
30
|
from rucio.common.config import config_get_bool, config_get_int
|
|
31
|
+
from rucio.common.constants import DEFAULT_VO
|
|
31
32
|
from rucio.common.utils import chunks, is_archive
|
|
32
33
|
from rucio.core import did_meta_plugins
|
|
33
34
|
from rucio.core.message import add_message
|
|
@@ -163,7 +164,7 @@ def add_dids(
|
|
|
163
164
|
"""
|
|
164
165
|
Bulk add data identifiers.
|
|
165
166
|
|
|
166
|
-
:param dids: A list of
|
|
167
|
+
:param dids: A list of DIDs.
|
|
167
168
|
:param account: The account owner.
|
|
168
169
|
:param session: The database session in use.
|
|
169
170
|
"""
|
|
@@ -211,7 +212,7 @@ def add_dids(
|
|
|
211
212
|
'scope': did['scope'].external,
|
|
212
213
|
'name': did['name'],
|
|
213
214
|
'expired_at': str(expired_at) if expired_at is not None else None}
|
|
214
|
-
if account.vo !=
|
|
215
|
+
if account.vo != DEFAULT_VO:
|
|
215
216
|
message['vo'] = account.vo
|
|
216
217
|
|
|
217
218
|
add_message(event_type, message, session=session)
|
|
@@ -375,7 +376,7 @@ def __add_files_to_archive(
|
|
|
375
376
|
session: "Session"
|
|
376
377
|
) -> None:
|
|
377
378
|
"""
|
|
378
|
-
Add files to archive.
|
|
379
|
+
Add files to the archive.
|
|
379
380
|
|
|
380
381
|
:param parent_did: the DataIdentifier object of the parent did
|
|
381
382
|
:param files: archive content.
|
|
@@ -773,7 +774,7 @@ def __add_collections_to_container(
|
|
|
773
774
|
'childscope': c['scope'].external,
|
|
774
775
|
'childname': c['name'],
|
|
775
776
|
'childtype': chld_type}
|
|
776
|
-
if account.vo !=
|
|
777
|
+
if account.vo != DEFAULT_VO:
|
|
777
778
|
message['vo'] = account.vo
|
|
778
779
|
messages.append(message)
|
|
779
780
|
|
|
@@ -809,11 +810,11 @@ def delete_dids(
|
|
|
809
810
|
"""
|
|
810
811
|
Delete data identifiers
|
|
811
812
|
|
|
812
|
-
:param dids: The list of
|
|
813
|
+
:param dids: The list of DIDs to delete.
|
|
813
814
|
:param account: The account.
|
|
814
815
|
:param expire_rules: Expire large rules instead of deleting them right away. This should only be used in Undertaker mode, as it can be that
|
|
815
|
-
the method returns normally, but a
|
|
816
|
-
expired
|
|
816
|
+
the method returns normally, but a DID was not deleted; This trusts in the fact that the undertaker will retry an
|
|
817
|
+
expired DID.
|
|
817
818
|
:param session: The database session in use.
|
|
818
819
|
:param logger: Optional decorated logger that can be passed from the calling daemons or servers.
|
|
819
820
|
"""
|
|
@@ -857,7 +858,7 @@ def delete_dids(
|
|
|
857
858
|
message = {'account': account.external,
|
|
858
859
|
'scope': did['scope'].external,
|
|
859
860
|
'name': did['name']}
|
|
860
|
-
if did['scope'].vo !=
|
|
861
|
+
if did['scope'].vo != DEFAULT_VO:
|
|
861
862
|
message['vo'] = did['scope'].vo
|
|
862
863
|
|
|
863
864
|
add_message('ERASE', message, session=session)
|
|
@@ -879,7 +880,7 @@ def delete_dids(
|
|
|
879
880
|
)
|
|
880
881
|
session.execute(stmt, values)
|
|
881
882
|
|
|
882
|
-
# Delete rules on
|
|
883
|
+
# Delete rules on DID
|
|
883
884
|
skip_deletion = False # Skip deletion in case of expiration of a rule
|
|
884
885
|
with METRICS.timer('delete_dids.rules'):
|
|
885
886
|
stmt = select(
|
|
@@ -899,7 +900,7 @@ def delete_dids(
|
|
|
899
900
|
for (rule_id, scope, name, rse_expression, locks_ok_cnt, locks_replicating_cnt, locks_stuck_cnt) in session.execute(stmt):
|
|
900
901
|
logger(logging.DEBUG, 'Removing rule %s for did %s:%s on RSE-Expression %s' % (str(rule_id), scope, name, rse_expression))
|
|
901
902
|
|
|
902
|
-
# Propagate purge_replicas from
|
|
903
|
+
# Propagate purge_replicas from DID to rules
|
|
903
904
|
if (scope, name) in not_purge_replicas:
|
|
904
905
|
purge_replicas = False
|
|
905
906
|
else:
|
|
@@ -907,7 +908,7 @@ def delete_dids(
|
|
|
907
908
|
if expire_rules and locks_ok_cnt + locks_replicating_cnt + locks_stuck_cnt > int(config_get_int('undertaker', 'expire_rules_locks_size', default=10000, session=session)):
|
|
908
909
|
# Expire the rule (soft=True)
|
|
909
910
|
rucio.core.rule.delete_rule(rule_id=rule_id, purge_replicas=purge_replicas, soft=True, delete_parent=True, nowait=True, session=session)
|
|
910
|
-
# Update expiration of
|
|
911
|
+
# Update expiration of DID
|
|
911
912
|
set_metadata(scope=scope, name=name, key='lifetime', value=3600 * 24, session=session)
|
|
912
913
|
skip_deletion = True
|
|
913
914
|
else:
|
|
@@ -916,7 +917,7 @@ def delete_dids(
|
|
|
916
917
|
if skip_deletion:
|
|
917
918
|
return
|
|
918
919
|
|
|
919
|
-
# Detach from parent
|
|
920
|
+
# Detach from parent DIDs:
|
|
920
921
|
existing_parent_dids = False
|
|
921
922
|
with METRICS.timer('delete_dids.parent_content'):
|
|
922
923
|
stmt = select(
|
|
@@ -931,7 +932,7 @@ def delete_dids(
|
|
|
931
932
|
existing_parent_dids = True
|
|
932
933
|
detach_dids(scope=parent_did.scope, name=parent_did.name, dids=[{'scope': parent_did.child_scope, 'name': parent_did.child_name}], session=session)
|
|
933
934
|
|
|
934
|
-
# Remove generic
|
|
935
|
+
# Remove generic DID metadata
|
|
935
936
|
must_delete_did_meta = True
|
|
936
937
|
if session.bind.dialect.name == 'oracle':
|
|
937
938
|
oracle_version = int(session.connection().connection.version.split('.')[0])
|
|
@@ -1036,7 +1037,7 @@ def delete_dids(
|
|
|
1036
1037
|
)
|
|
1037
1038
|
session.execute(stmt)
|
|
1038
1039
|
|
|
1039
|
-
# Set Epoch tombstone for the files replicas inside the
|
|
1040
|
+
# Set Epoch tombstone for the files replicas inside the DID
|
|
1040
1041
|
if config_get_bool('undertaker', 'purge_all_replicas', default=False, session=session):
|
|
1041
1042
|
with METRICS.timer('delete_dids.file_content'):
|
|
1042
1043
|
stmt = update(
|
|
@@ -1093,7 +1094,7 @@ def delete_dids(
|
|
|
1093
1094
|
|
|
1094
1095
|
# remove data identifier
|
|
1095
1096
|
if existing_parent_dids:
|
|
1096
|
-
# Exit method early to give Judge time to remove locks (Otherwise, due to foreign keys,
|
|
1097
|
+
# Exit method early to give Judge time to remove locks (Otherwise, due to foreign keys, DID removal does not work
|
|
1097
1098
|
logger(logging.DEBUG, 'Leaving delete_dids early for Judge-Evaluator checks')
|
|
1098
1099
|
return
|
|
1099
1100
|
|
|
@@ -1195,7 +1196,7 @@ def detach_dids(
|
|
|
1195
1196
|
:param dids: The content.
|
|
1196
1197
|
:param session: The database session in use.
|
|
1197
1198
|
"""
|
|
1198
|
-
# Row Lock the parent
|
|
1199
|
+
# Row Lock the parent DID
|
|
1199
1200
|
stmt = select(
|
|
1200
1201
|
models.DataIdentifier
|
|
1201
1202
|
).where(
|
|
@@ -1215,7 +1216,7 @@ def detach_dids(
|
|
|
1215
1216
|
except NoResultFound:
|
|
1216
1217
|
raise exception.DataIdentifierNotFound(f"Data identifier '{scope}:{name}' not found")
|
|
1217
1218
|
|
|
1218
|
-
# TODO: should judge target
|
|
1219
|
+
# TODO: should judge target DID's status: open, monotonic, close.
|
|
1219
1220
|
stmt = select(
|
|
1220
1221
|
models.DataIdentifierAssociation
|
|
1221
1222
|
).where(
|
|
@@ -1286,7 +1287,7 @@ def detach_dids(
|
|
|
1286
1287
|
'childscope': source['scope'].external,
|
|
1287
1288
|
'childname': source['name'],
|
|
1288
1289
|
'childtype': chld_type}
|
|
1289
|
-
if scope.vo !=
|
|
1290
|
+
if scope.vo != DEFAULT_VO:
|
|
1290
1291
|
message['vo'] = scope.vo
|
|
1291
1292
|
|
|
1292
1293
|
add_message('ERASE_CNT', message, session=session)
|
|
@@ -1297,7 +1298,7 @@ def detach_dids(
|
|
|
1297
1298
|
'child_scope': source['scope'].external,
|
|
1298
1299
|
'child_name': str(source['name']),
|
|
1299
1300
|
'child_type': str(child_type)}
|
|
1300
|
-
if scope.vo !=
|
|
1301
|
+
if scope.vo != DEFAULT_VO:
|
|
1301
1302
|
message['vo'] = scope.vo
|
|
1302
1303
|
|
|
1303
1304
|
add_message('DETACH', message, session=session)
|
|
@@ -1374,7 +1375,7 @@ def set_new_dids(
|
|
|
1374
1375
|
"""
|
|
1375
1376
|
Set/reset the flag new
|
|
1376
1377
|
|
|
1377
|
-
:param dids: A list of
|
|
1378
|
+
:param dids: A list of DIDs
|
|
1378
1379
|
:param new_flag: A boolean to flag new DIDs.
|
|
1379
1380
|
:param session: The database session in use.
|
|
1380
1381
|
"""
|
|
@@ -1436,7 +1437,7 @@ def list_content(
|
|
|
1436
1437
|
yield {'scope': tmp_did.child_scope, 'name': tmp_did.child_name, 'type': tmp_did.child_type,
|
|
1437
1438
|
'bytes': tmp_did.bytes, 'adler32': tmp_did.adler32, 'md5': tmp_did.md5}
|
|
1438
1439
|
if not children_found:
|
|
1439
|
-
# Raise exception if the
|
|
1440
|
+
# Raise exception if the DID doesn't exist
|
|
1440
1441
|
__get_did(scope=scope, name=name, session=session)
|
|
1441
1442
|
|
|
1442
1443
|
|
|
@@ -1480,13 +1481,13 @@ def list_parent_dids(
|
|
|
1480
1481
|
session: "Session"
|
|
1481
1482
|
) -> "Iterator[dict[str, Any]]":
|
|
1482
1483
|
"""
|
|
1483
|
-
List parent datasets and containers of a
|
|
1484
|
+
List parent datasets and containers of a DID.
|
|
1484
1485
|
|
|
1485
1486
|
:param scope: The scope.
|
|
1486
1487
|
:param name: The name.
|
|
1487
1488
|
:param order_by: List of parameters to order the query by. Possible values: ['scope', 'name', 'did_type', 'created_at'].
|
|
1488
1489
|
:param session: The database session.
|
|
1489
|
-
:returns: List of
|
|
1490
|
+
:returns: List of DIDs.
|
|
1490
1491
|
:rtype: Generator.
|
|
1491
1492
|
"""
|
|
1492
1493
|
|
|
@@ -1519,12 +1520,12 @@ def list_all_parent_dids(
|
|
|
1519
1520
|
session: "Session"
|
|
1520
1521
|
) -> "Iterator[dict[str, Any]]":
|
|
1521
1522
|
"""
|
|
1522
|
-
List all parent datasets and containers of a
|
|
1523
|
+
List all parent datasets and containers of a DID, no matter on what level.
|
|
1523
1524
|
|
|
1524
1525
|
:param scope: The scope.
|
|
1525
1526
|
:param name: The name.
|
|
1526
1527
|
:param session: The database session.
|
|
1527
|
-
:returns: List of
|
|
1528
|
+
:returns: List of DIDs.
|
|
1528
1529
|
:rtype: Generator.
|
|
1529
1530
|
"""
|
|
1530
1531
|
|
|
@@ -1548,8 +1549,8 @@ def list_child_dids_stmt(
|
|
|
1548
1549
|
did_type: DIDType,
|
|
1549
1550
|
) -> "Select[tuple[InternalScope, str]]":
|
|
1550
1551
|
"""
|
|
1551
|
-
Build and returns a query which recursively lists children
|
|
1552
|
-
for the
|
|
1552
|
+
Build and returns a query which recursively lists children DIDs of type `did_type`
|
|
1553
|
+
for the DIDs given as input in a scope/name (temporary) table.
|
|
1553
1554
|
|
|
1554
1555
|
did_type defines the desired type of DIDs in the result. If set to DIDType.Dataset,
|
|
1555
1556
|
will only resolve containers and return datasets. If set to DIDType.File, will
|
|
@@ -1605,7 +1606,7 @@ def list_one_did_childs_stmt(
|
|
|
1605
1606
|
did_type: DIDType,
|
|
1606
1607
|
) -> "Select[tuple[InternalScope, str]]":
|
|
1607
1608
|
"""
|
|
1608
|
-
Returns the sqlalchemy query for recursively fetching the child
|
|
1609
|
+
Returns the sqlalchemy query for recursively fetching the child DIDs of type
|
|
1609
1610
|
'did_type' for the input did.
|
|
1610
1611
|
|
|
1611
1612
|
did_type defines the desired type of DIDs in the result. If set to DIDType.Dataset,
|
|
@@ -1667,7 +1668,7 @@ def list_child_datasets(
|
|
|
1667
1668
|
:param scope: The scope.
|
|
1668
1669
|
:param name: The name.
|
|
1669
1670
|
:param session: The database session
|
|
1670
|
-
:returns: List of
|
|
1671
|
+
:returns: List of DIDs
|
|
1671
1672
|
:rtype: Generator
|
|
1672
1673
|
"""
|
|
1673
1674
|
stmt = list_one_did_childs_stmt(scope, name, did_type=DIDType.DATASET)
|
|
@@ -1939,7 +1940,7 @@ def get_did(scope: "InternalScope", name: str, dynamic_depth: "Optional[DIDType]
|
|
|
1939
1940
|
:param scope: The scope name.
|
|
1940
1941
|
:param name: The data identifier name.
|
|
1941
1942
|
:param dynamic_depth: the DID type to use as source for estimation of this DIDs length/bytes.
|
|
1942
|
-
If set to None, or to a value which doesn't make sense (ex: requesting depth = CONTAINER for a
|
|
1943
|
+
If set to None, or to a value which doesn't make sense (ex: requesting depth = CONTAINER for a DID of type DATASET)
|
|
1943
1944
|
will not compute the size dynamically.
|
|
1944
1945
|
:param session: The database session in use.
|
|
1945
1946
|
"""
|
|
@@ -2017,7 +2018,7 @@ def set_dids_metadata_bulk(
|
|
|
2017
2018
|
"""
|
|
2018
2019
|
Add metadata to a list of data identifiers.
|
|
2019
2020
|
|
|
2020
|
-
:param dids: A list of
|
|
2021
|
+
:param dids: A list of DIDs including metadata.
|
|
2021
2022
|
:param recursive: Option to propagate the metadata change to content.
|
|
2022
2023
|
:param session: The database session in use.
|
|
2023
2024
|
"""
|
|
@@ -2043,7 +2044,7 @@ def get_metadata(
|
|
|
2043
2044
|
:param session: The database session in use.
|
|
2044
2045
|
|
|
2045
2046
|
|
|
2046
|
-
:returns: List of HARDCODED metadata for
|
|
2047
|
+
:returns: List of HARDCODED metadata for DID.
|
|
2047
2048
|
"""
|
|
2048
2049
|
return did_meta_plugins.get_metadata(scope, name, plugin=plugin, session=session)
|
|
2049
2050
|
|
|
@@ -2055,11 +2056,11 @@ def list_parent_dids_bulk(
|
|
|
2055
2056
|
session: "Session"
|
|
2056
2057
|
) -> "Iterator[dict[str, Any]]":
|
|
2057
2058
|
"""
|
|
2058
|
-
List parent datasets and containers of a
|
|
2059
|
+
List parent datasets and containers of a DID.
|
|
2059
2060
|
|
|
2060
|
-
:param dids: A list of
|
|
2061
|
+
:param dids: A list of DIDs.
|
|
2061
2062
|
:param session: The database session in use.
|
|
2062
|
-
:returns: List of
|
|
2063
|
+
:returns: List of DIDs.
|
|
2063
2064
|
:rtype: Generator.
|
|
2064
2065
|
"""
|
|
2065
2066
|
condition = []
|
|
@@ -2093,8 +2094,8 @@ def get_metadata_bulk(
|
|
|
2093
2094
|
session: "Session"
|
|
2094
2095
|
) -> "Iterator[dict[str, Any]]":
|
|
2095
2096
|
"""
|
|
2096
|
-
Get metadata for a list of
|
|
2097
|
-
:param dids: A list of
|
|
2097
|
+
Get metadata for a list of DIDs
|
|
2098
|
+
:param dids: A list of DIDs.
|
|
2098
2099
|
:param inherit: A boolean. If set to true, the metadata of the parent are concatenated.
|
|
2099
2100
|
:param plugin: A string. The metadata plugin to use or 'ALL' for all.
|
|
2100
2101
|
:param session: The database session in use.
|
|
@@ -2172,8 +2173,8 @@ def delete_metadata(
|
|
|
2172
2173
|
"""
|
|
2173
2174
|
Delete a key from the metadata column
|
|
2174
2175
|
|
|
2175
|
-
:param scope: the scope of
|
|
2176
|
-
:param name: the name of the
|
|
2176
|
+
:param scope: the scope of DID
|
|
2177
|
+
:param name: the name of the DID
|
|
2177
2178
|
:param key: the key to be deleted
|
|
2178
2179
|
"""
|
|
2179
2180
|
did_meta_plugins.delete_metadata(scope, name, key, session=session)
|
|
@@ -2241,7 +2242,7 @@ def set_status(
|
|
|
2241
2242
|
'bytes': values['bytes'],
|
|
2242
2243
|
'length': values['length'],
|
|
2243
2244
|
'events': values['events']}
|
|
2244
|
-
if scope.vo !=
|
|
2245
|
+
if scope.vo != DEFAULT_VO:
|
|
2245
2246
|
message['vo'] = scope.vo
|
|
2246
2247
|
|
|
2247
2248
|
add_message('CLOSE', message, session=session)
|
|
@@ -2259,7 +2260,7 @@ def set_status(
|
|
|
2259
2260
|
values['is_open'] = True
|
|
2260
2261
|
|
|
2261
2262
|
message = {'scope': scope.external, 'name': name}
|
|
2262
|
-
if scope.vo !=
|
|
2263
|
+
if scope.vo != DEFAULT_VO:
|
|
2263
2264
|
message['vo'] = scope.vo
|
|
2264
2265
|
add_message('OPEN', message, session=session)
|
|
2265
2266
|
|
|
@@ -2312,7 +2313,7 @@ def list_dids(
|
|
|
2312
2313
|
|
|
2313
2314
|
:param scope: the scope name.
|
|
2314
2315
|
:param filters: dictionary of attributes by which the results should be filtered.
|
|
2315
|
-
:param did_type: the type of the
|
|
2316
|
+
:param did_type: the type of the DID: all(container, dataset, file), collection(dataset or container), dataset, container, file.
|
|
2316
2317
|
:param ignore_case: ignore case distinctions.
|
|
2317
2318
|
:param limit: limit number.
|
|
2318
2319
|
:param offset: offset number.
|
|
@@ -2332,7 +2333,7 @@ def get_did_atime(
|
|
|
2332
2333
|
session: "Session"
|
|
2333
2334
|
) -> datetime:
|
|
2334
2335
|
"""
|
|
2335
|
-
Get the accessed_at timestamp for a
|
|
2336
|
+
Get the accessed_at timestamp for a DID. Just for testing.
|
|
2336
2337
|
:param scope: the scope name.
|
|
2337
2338
|
:param name: The data identifier name.
|
|
2338
2339
|
:param session: Database session to use.
|
|
@@ -2356,7 +2357,7 @@ def get_did_access_cnt(
|
|
|
2356
2357
|
session: "Session"
|
|
2357
2358
|
) -> int:
|
|
2358
2359
|
"""
|
|
2359
|
-
Get the access_cnt for a
|
|
2360
|
+
Get the access_cnt for a DID. Just for testing.
|
|
2360
2361
|
:param scope: the scope name.
|
|
2361
2362
|
:param name: The data identifier name.
|
|
2362
2363
|
:param session: Database session to use.
|
|
@@ -2383,7 +2384,7 @@ def get_dataset_by_guid(
|
|
|
2383
2384
|
:param guid: The GUID.
|
|
2384
2385
|
:param session: Database session to use.
|
|
2385
2386
|
|
|
2386
|
-
:returns: A
|
|
2387
|
+
:returns: A DID.
|
|
2387
2388
|
"""
|
|
2388
2389
|
stmt = select(
|
|
2389
2390
|
models.DataIdentifier
|
|
@@ -2422,9 +2423,9 @@ def touch_dids(
|
|
|
2422
2423
|
session: "Session"
|
|
2423
2424
|
) -> bool:
|
|
2424
2425
|
"""
|
|
2425
|
-
Update the accessed_at timestamp and the access_cnt of the given
|
|
2426
|
+
Update the accessed_at timestamp and the access_cnt of the given DIDs.
|
|
2426
2427
|
|
|
2427
|
-
:param replicas: the list of
|
|
2428
|
+
:param replicas: the list of DIDs.
|
|
2428
2429
|
:param session: The database session in use.
|
|
2429
2430
|
|
|
2430
2431
|
:returns: True, if successful, False otherwise.
|
|
@@ -2489,11 +2490,11 @@ def __resolve_bytes_length_events_did(
|
|
|
2489
2490
|
*, session: "Session",
|
|
2490
2491
|
) -> tuple[int, int, int]:
|
|
2491
2492
|
"""
|
|
2492
|
-
Resolve bytes, length and events of a
|
|
2493
|
+
Resolve bytes, length and events of a DID
|
|
2493
2494
|
|
|
2494
2495
|
:did: the DID ORM object for which we perform the resolution
|
|
2495
2496
|
:param dynamic_depth: the DID type to use as source for estimation of this DIDs length/bytes.
|
|
2496
|
-
If set to None, or to a value which doesn't make sense (ex: requesting depth = DATASET for a
|
|
2497
|
+
If set to None, or to a value which doesn't make sense (ex: requesting depth = DATASET for a DID of type FILE)
|
|
2497
2498
|
will not compute the size dynamically.
|
|
2498
2499
|
:param session: The database session in use.
|
|
2499
2500
|
"""
|
|
@@ -2554,7 +2555,7 @@ def resurrect(dids: "Iterable[Mapping[str, Any]]", *, session: "Session") -> Non
|
|
|
2554
2555
|
"""
|
|
2555
2556
|
Resurrect data identifiers.
|
|
2556
2557
|
|
|
2557
|
-
:param dids: The list of
|
|
2558
|
+
:param dids: The list of DIDs to resurrect.
|
|
2558
2559
|
:param session: The database session in use.
|
|
2559
2560
|
"""
|
|
2560
2561
|
for did in dids:
|
|
@@ -2651,7 +2652,7 @@ def add_did_to_followed(
|
|
|
2651
2652
|
session: "Session"
|
|
2652
2653
|
) -> None:
|
|
2653
2654
|
"""
|
|
2654
|
-
Mark a
|
|
2655
|
+
Mark a DID as followed by the given account
|
|
2655
2656
|
|
|
2656
2657
|
:param scope: The scope name.
|
|
2657
2658
|
:param name: The data identifier name.
|
|
@@ -2672,13 +2673,13 @@ def add_dids_to_followed(
|
|
|
2672
2673
|
"""
|
|
2673
2674
|
Bulk mark datasets as followed
|
|
2674
2675
|
|
|
2675
|
-
:param dids: A list of
|
|
2676
|
+
:param dids: A list of DIDs.
|
|
2676
2677
|
:param account: The account owner.
|
|
2677
2678
|
:param session: The database session in use.
|
|
2678
2679
|
"""
|
|
2679
2680
|
try:
|
|
2680
2681
|
for did in dids:
|
|
2681
|
-
# Get the
|
|
2682
|
+
# Get the DID details corresponding to the scope and name passed.
|
|
2682
2683
|
stmt = select(
|
|
2683
2684
|
models.DataIdentifier
|
|
2684
2685
|
).where(
|
|
@@ -2705,7 +2706,7 @@ def get_users_following_did(
|
|
|
2705
2706
|
session: "Session"
|
|
2706
2707
|
) -> "Iterator[dict[str, InternalAccount]]":
|
|
2707
2708
|
"""
|
|
2708
|
-
Return list of users following a
|
|
2709
|
+
Return list of users following a DID
|
|
2709
2710
|
|
|
2710
2711
|
:param scope: The scope name.
|
|
2711
2712
|
:param name: The data identifier name.
|
|
@@ -2735,7 +2736,7 @@ def remove_did_from_followed(
|
|
|
2735
2736
|
session: "Session"
|
|
2736
2737
|
) -> None:
|
|
2737
2738
|
"""
|
|
2738
|
-
Mark a
|
|
2739
|
+
Mark a DID as not followed
|
|
2739
2740
|
|
|
2740
2741
|
:param scope: The scope name.
|
|
2741
2742
|
:param name: The data identifier name.
|
|
@@ -2756,7 +2757,7 @@ def remove_dids_from_followed(
|
|
|
2756
2757
|
"""
|
|
2757
2758
|
Bulk mark datasets as not followed
|
|
2758
2759
|
|
|
2759
|
-
:param dids: A list of
|
|
2760
|
+
:param dids: A list of DIDs.
|
|
2760
2761
|
:param account: The account owner.
|
|
2761
2762
|
:param session: The database session in use.
|
|
2762
2763
|
"""
|
|
@@ -2786,11 +2787,11 @@ def trigger_event(
|
|
|
2786
2787
|
session: "Session"
|
|
2787
2788
|
) -> None:
|
|
2788
2789
|
"""
|
|
2789
|
-
Records changes occurring in the
|
|
2790
|
+
Records changes occurring in the DID to the FollowEvent table
|
|
2790
2791
|
|
|
2791
2792
|
:param scope: The scope name.
|
|
2792
2793
|
:param name: The data identifier name.
|
|
2793
|
-
:param event_type: The type of event affecting the
|
|
2794
|
+
:param event_type: The type of event affecting the DID.
|
|
2794
2795
|
:param payload: Any message to be stored along with the event.
|
|
2795
2796
|
:param session: The database session in use.
|
|
2796
2797
|
"""
|
|
@@ -2887,10 +2888,10 @@ def insert_content_history(
|
|
|
2887
2888
|
session: "Session"
|
|
2888
2889
|
) -> None:
|
|
2889
2890
|
"""
|
|
2890
|
-
Insert into content history a list of
|
|
2891
|
+
Insert into content history a list of DID
|
|
2891
2892
|
|
|
2892
2893
|
:param filter_: Content clause of the files to archive
|
|
2893
|
-
:param did_created_at: Creation date of the
|
|
2894
|
+
:param did_created_at: Creation date of the DID
|
|
2894
2895
|
:param session: The database session in use.
|
|
2895
2896
|
"""
|
|
2896
2897
|
new_did_created_at = did_created_at
|
|
@@ -2940,7 +2941,7 @@ def insert_deleted_dids(filter_: "ColumnExpressionArgument[bool]", *, session: "
|
|
|
2940
2941
|
"""
|
|
2941
2942
|
Insert into deleted_dids a list of did
|
|
2942
2943
|
|
|
2943
|
-
:param filter_: The database filter to retrieve
|
|
2944
|
+
:param filter_: The database filter to retrieve DIDs for archival
|
|
2944
2945
|
:param session: The database session in use.
|
|
2945
2946
|
"""
|
|
2946
2947
|
stmt = select(
|
|
@@ -76,16 +76,16 @@ RESTRICTED_CHARACTERS = {
|
|
|
76
76
|
@read_session
|
|
77
77
|
def get_metadata(scope, name, plugin="DID_COLUMN", *, session: "Session"):
|
|
78
78
|
"""
|
|
79
|
-
Gets the metadata for a given
|
|
79
|
+
Gets the metadata for a given DID from a specified plugin.
|
|
80
80
|
|
|
81
81
|
If [plugin] is set to "all", metadata from all available metadata plugins will be returned,
|
|
82
82
|
else [plugin] can be used to only return the metadata using a specific plugin.
|
|
83
83
|
|
|
84
|
-
:param scope: The scope of the
|
|
84
|
+
:param scope: The scope of the DID.
|
|
85
85
|
:param name: The data identifier name.
|
|
86
86
|
:param plugin: (optional) Filter specific metadata plugins.
|
|
87
87
|
:param session: (optional) The database session in use.
|
|
88
|
-
:returns: Dictionary containing metadata for
|
|
88
|
+
:returns: Dictionary containing metadata for DID.
|
|
89
89
|
:raises: UnsupportedMetadataPlugin: If the specified plugin is not enabled/available
|
|
90
90
|
"""
|
|
91
91
|
if plugin.lower() == "all":
|
|
@@ -104,9 +104,9 @@ def get_metadata(scope, name, plugin="DID_COLUMN", *, session: "Session"):
|
|
|
104
104
|
@transactional_session
|
|
105
105
|
def set_metadata(scope, name, key, value, recursive=False, *, session: "Session"):
|
|
106
106
|
"""
|
|
107
|
-
Sets metadata for a given
|
|
107
|
+
Sets metadata for a given DID.
|
|
108
108
|
|
|
109
|
-
:param scope: The scope of the
|
|
109
|
+
:param scope: The scope of the DID.
|
|
110
110
|
:param name: The data identifier name.
|
|
111
111
|
:param key: Metadata key.
|
|
112
112
|
:param value: Metadata value.
|
|
@@ -138,7 +138,7 @@ def set_metadata(scope, name, key, value, recursive=False, *, session: "Session"
|
|
|
138
138
|
@transactional_session
|
|
139
139
|
def set_metadata_bulk(scope, name, meta, recursive=False, *, session: "Session"):
|
|
140
140
|
"""
|
|
141
|
-
Bulk sets metadata for a given
|
|
141
|
+
Bulk sets metadata for a given DID.
|
|
142
142
|
|
|
143
143
|
:param scope: The scope name.
|
|
144
144
|
:param name: The data identifier name.
|
|
@@ -188,8 +188,8 @@ def delete_metadata(scope, name, key, *, session: "Session"):
|
|
|
188
188
|
"""
|
|
189
189
|
Deletes metadata stored for a given key.
|
|
190
190
|
|
|
191
|
-
:param scope: The scope of the
|
|
192
|
-
:param name: The name of the
|
|
191
|
+
:param scope: The scope of the DID.
|
|
192
|
+
:param name: The name of the DID.
|
|
193
193
|
:param key: Key of the metadata.
|
|
194
194
|
"""
|
|
195
195
|
for metadata_plugin in METADATA_PLUGIN_MODULES:
|
|
@@ -207,7 +207,7 @@ def list_dids(scope=None, filters=None, did_type='collection', ignore_case=False
|
|
|
207
207
|
|
|
208
208
|
:param scope: the scope name.
|
|
209
209
|
:param filters: dictionary of attributes by which the results should be filtered.
|
|
210
|
-
:param did_type: the type of the
|
|
210
|
+
:param did_type: the type of the DID: all(container, dataset, file), collection(dataset or container), dataset, container, file.
|
|
211
211
|
:param ignore_case: ignore case distinctions.
|
|
212
212
|
:param limit: limit number.
|
|
213
213
|
:param offset: offset number.
|
|
@@ -215,7 +215,7 @@ def list_dids(scope=None, filters=None, did_type='collection', ignore_case=False
|
|
|
215
215
|
:param recursive: Recursively list DIDs content.
|
|
216
216
|
:param ignore_dids: List of DIDs to refrain from yielding.
|
|
217
217
|
:param session: The database session in use.
|
|
218
|
-
:returns: List of
|
|
218
|
+
:returns: List of DIDs satisfying metadata criteria.
|
|
219
219
|
:raises: InvalidMetadata
|
|
220
220
|
"""
|
|
221
221
|
# backwards compatibility for filters as single {}.
|
|
@@ -37,7 +37,7 @@ if TYPE_CHECKING:
|
|
|
37
37
|
|
|
38
38
|
class DidColumnMeta(DidMetaPlugin):
|
|
39
39
|
"""
|
|
40
|
-
A metadata plugin to interact with the base
|
|
40
|
+
A metadata plugin to interact with the base DID table metadata.
|
|
41
41
|
"""
|
|
42
42
|
def __init__(self):
|
|
43
43
|
super(DidColumnMeta, self).__init__()
|
|
@@ -78,7 +78,7 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
78
78
|
except TypeError as error:
|
|
79
79
|
raise exception.InvalidValueForKey(error)
|
|
80
80
|
if not rowcount:
|
|
81
|
-
# check for
|
|
81
|
+
# check for DID presence
|
|
82
82
|
raise exception.UnsupportedOperation('%s for %s:%s cannot be updated' % (key, scope, name))
|
|
83
83
|
elif key == 'lifetime':
|
|
84
84
|
try:
|
|
@@ -89,12 +89,12 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
89
89
|
except TypeError as error:
|
|
90
90
|
raise exception.InvalidValueForKey(error)
|
|
91
91
|
if not rowcount:
|
|
92
|
-
# check for
|
|
92
|
+
# check for DID presence
|
|
93
93
|
raise exception.UnsupportedOperation('%s for %s:%s cannot be updated' % (key, scope, name))
|
|
94
94
|
elif key in ['guid', 'events']:
|
|
95
95
|
rowcount = did_query.filter_by(did_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
96
96
|
if not rowcount:
|
|
97
|
-
# check for
|
|
97
|
+
# check for DID presence
|
|
98
98
|
raise exception.UnsupportedOperation('%s for %s:%s cannot be updated' % (key, scope, name))
|
|
99
99
|
|
|
100
100
|
session.query(models.DataIdentifierAssociation).filter_by(child_scope=scope, child_name=name, child_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
@@ -105,7 +105,7 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
105
105
|
elif key == 'adler32':
|
|
106
106
|
rowcount = did_query.filter_by(did_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
107
107
|
if not rowcount:
|
|
108
|
-
# check for
|
|
108
|
+
# check for DID presence
|
|
109
109
|
raise exception.UnsupportedOperation('%s for %s:%s cannot be updated' % (key, scope, name))
|
|
110
110
|
|
|
111
111
|
session.query(models.DataIdentifierAssociation).filter_by(child_scope=scope, child_name=name, child_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
@@ -114,7 +114,7 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
114
114
|
elif key == 'bytes':
|
|
115
115
|
rowcount = did_query.filter_by(did_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
116
116
|
if not rowcount:
|
|
117
|
-
# check for
|
|
117
|
+
# check for DID presence
|
|
118
118
|
raise exception.UnsupportedOperation('%s for %s:%s cannot be updated' % (key, scope, name))
|
|
119
119
|
|
|
120
120
|
session.query(models.DataIdentifierAssociation).filter_by(child_scope=scope, child_name=name, child_type=DIDType.FILE).update({key: value}, synchronize_session=False)
|
|
@@ -176,7 +176,7 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
176
176
|
|
|
177
177
|
:param scope: the scope name.
|
|
178
178
|
:param filters: dictionary of attributes by which the results should be filtered.
|
|
179
|
-
:param did_type: the type of the
|
|
179
|
+
:param did_type: the type of the DID: all(container, dataset, file), collection(dataset or container), dataset, container, file.
|
|
180
180
|
:param ignore_case: ignore case distinctions.
|
|
181
181
|
:param limit: limit number.
|
|
182
182
|
:param offset: offset number.
|
|
@@ -281,8 +281,8 @@ class DidColumnMeta(DidMetaPlugin):
|
|
|
281
281
|
"""
|
|
282
282
|
Deletes the metadata stored for the given key.
|
|
283
283
|
|
|
284
|
-
:param scope: The scope of the
|
|
285
|
-
:param name: The name of the
|
|
284
|
+
:param scope: The scope of the DID.
|
|
285
|
+
:param name: The name of the DID.
|
|
286
286
|
:param key: Key of the metadata.
|
|
287
287
|
"""
|
|
288
288
|
raise NotImplementedError('The DidColumnMeta plugin does not currently support deleting metadata.')
|
|
@@ -113,8 +113,8 @@ class DidMetaPlugin(metaclass=ABCMeta):
|
|
|
113
113
|
"""
|
|
114
114
|
Deletes the metadata stored for the given key.
|
|
115
115
|
|
|
116
|
-
:param scope: The scope of the
|
|
117
|
-
:param name: The name of the
|
|
116
|
+
:param scope: The scope of the DID.
|
|
117
|
+
:param name: The name of the DID.
|
|
118
118
|
:param key: Key of the metadata.
|
|
119
119
|
:param session: The database session in use.
|
|
120
120
|
"""
|
|
@@ -139,7 +139,7 @@ class DidMetaPlugin(metaclass=ABCMeta):
|
|
|
139
139
|
|
|
140
140
|
:param scope: the scope name.
|
|
141
141
|
:param filters: dictionary of attributes by which the results should be filtered.
|
|
142
|
-
:param did_type: the type of the
|
|
142
|
+
:param did_type: the type of the DID: all(container, dataset, file), collection(dataset or container), dataset, container, file.
|
|
143
143
|
:param ignore_case: ignore case distinctions.
|
|
144
144
|
:param limit: limit number.
|
|
145
145
|
:param offset: offset number.
|
|
@@ -109,7 +109,7 @@ class ElasticDidMeta(DidMetaPlugin):
|
|
|
109
109
|
:param scope: The scope name
|
|
110
110
|
:param name: The data identifier name
|
|
111
111
|
:param session: The database session in use
|
|
112
|
-
:returns: The metadata for the
|
|
112
|
+
:returns: The metadata for the DID
|
|
113
113
|
:raises DataIdentifierNotFound: If the DID metadata is not found.
|
|
114
114
|
:raises RucioException: If another error occurs during the process.
|
|
115
115
|
"""
|
|
@@ -136,8 +136,8 @@ class ElasticDidMeta(DidMetaPlugin):
|
|
|
136
136
|
"""
|
|
137
137
|
Set single metadata key.
|
|
138
138
|
|
|
139
|
-
:param scope: the scope of
|
|
140
|
-
:param name: the name of the
|
|
139
|
+
:param scope: the scope of DID
|
|
140
|
+
:param name: the name of the DID
|
|
141
141
|
:param key: the key to be added
|
|
142
142
|
:param value: the value of the key to be added
|
|
143
143
|
:param recursive: recurse into DIDs (not supported)
|
|
@@ -159,8 +159,8 @@ class ElasticDidMeta(DidMetaPlugin):
|
|
|
159
159
|
"""
|
|
160
160
|
Bulk set metadata keys.
|
|
161
161
|
|
|
162
|
-
:param scope: the scope of
|
|
163
|
-
:param name: the name of the
|
|
162
|
+
:param scope: the scope of DID
|
|
163
|
+
:param name: the name of the DID
|
|
164
164
|
:param meta: dictionary of metadata keypairs to be added
|
|
165
165
|
:param recursive: recurse into DIDs (not supported)
|
|
166
166
|
:param session: The database session in use
|
|
@@ -201,8 +201,8 @@ class ElasticDidMeta(DidMetaPlugin):
|
|
|
201
201
|
"""
|
|
202
202
|
Delete a key from metadata.
|
|
203
203
|
|
|
204
|
-
:param scope: the scope of
|
|
205
|
-
:param name: the name of the
|
|
204
|
+
:param scope: the scope of DID
|
|
205
|
+
:param name: the name of the DID
|
|
206
206
|
:param key: the key to be deleted
|
|
207
207
|
:raises DataIdentifierNotFound: If the DID is not found.
|
|
208
208
|
:raises RucioException: If an error occurs while setting the metadata.
|