Skip to content

Commit

Permalink
Merge pull request #845 from haozturk/replica-recoverer-config
Browse files Browse the repository at this point in the history
Add pfn2lfn function to the policy package (PR against `rucio_35` branch)
  • Loading branch information
dynamic-entropy authored Sep 20, 2024
2 parents 5be4eba + e0403ea commit 7c3c3bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/policy/CMSRucioPolicy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Eric Vaandering <[email protected]>, 2022

from CMSRucioPolicy.algorithms import lfn2pfn, auto_approve
from CMSRucioPolicy.algorithms import lfn2pfn, auto_approve, pfn2lfn

SUPPORTED_VERSION = ["32", "33", "34", "35"]

Expand All @@ -17,5 +17,8 @@ def get_algorithms():
},
'auto_approve': {
'global': auto_approve.global_approval,
},
'pfn2lfn': {
'cms_pfn2lfn': pfn2lfn.cms_pfn2lfn,
}
}
14 changes: 14 additions & 0 deletions src/policy/CMSRucioPolicy/algorithms/pfn2lfn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
PFN to scope:name translation algorithm for CMS Rucio policy
"""
from collections.abc import Mapping

def cms_pfn2lfn(parsed_pfn: Mapping[str, str]) -> tuple[str, str]:
"""
This function converts a PFN into scope:name pair.
It ignores user scopes and sets all scopes to cms.
"""
# Ignore user scopes for now
scope = "cms"
name = parsed_pfn['path'] + parsed_pfn['name']
return name, scope

0 comments on commit 7c3c3bf

Please sign in to comment.