From 470dbde34adbb93a86a9274fc7a3c81009c8f7db Mon Sep 17 00:00:00 2001 From: Hasan Ozturk Date: Thu, 4 Jul 2024 15:39:07 +0200 Subject: [PATCH] Patch cms specific PFN to scope:name translation function --- docker/rucio-daemons/Dockerfile | 6 +++--- src/policy/CMSRucioPolicy/__init__.py | 5 ++++- .../CMSRucioPolicy/algorithms/pfn2scope_name.py | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/policy/CMSRucioPolicy/algorithms/pfn2scope_name.py diff --git a/docker/rucio-daemons/Dockerfile b/docker/rucio-daemons/Dockerfile index 211374c..3c54967 100644 --- a/docker/rucio-daemons/Dockerfile +++ b/docker/rucio-daemons/Dockerfile @@ -27,9 +27,9 @@ RUN rmdir /etc/grid-security/certificates && ln -s /cvmfs/grid.cern.ch/etc/grid- ADD docker/rucio-daemons/cms-entrypoint.sh / # Cannot make patch directory unless there are patches -#RUN mkdir -p /patch +RUN mkdir -p /patch -# Patch for auto approve plugin rucio/pull/6215 -#ADD https://github.com/rucio/rucio/pull/6215.patch /patch/6215.patch +# Patch for pfn to scope:name translation +ADD https://patch-diff.githubusercontent.com/raw/haozturk/rucio/pull/1.patch /patch/6817.patch ENTRYPOINT ["/cms-entrypoint.sh"] diff --git a/src/policy/CMSRucioPolicy/__init__.py b/src/policy/CMSRucioPolicy/__init__.py index f086772..91fbfa2 100644 --- a/src/policy/CMSRucioPolicy/__init__.py +++ b/src/policy/CMSRucioPolicy/__init__.py @@ -2,7 +2,7 @@ # # Eric Vaandering , 2022 -from CMSRucioPolicy.algorithms import lfn2pfn, auto_approve +from CMSRucioPolicy.algorithms import lfn2pfn, auto_approve, pfn2scope_name SUPPORTED_VERSION = ["32", "33", "34"] @@ -17,5 +17,8 @@ def get_algorithms(): }, 'auto_approve': { 'global': auto_approve.global_approval, + }, + 'pfn2scope_name': { + 'cms': pfn2scope_name.cms_pfn2scope_name, } } diff --git a/src/policy/CMSRucioPolicy/algorithms/pfn2scope_name.py b/src/policy/CMSRucioPolicy/algorithms/pfn2scope_name.py new file mode 100644 index 0000000..6a41b16 --- /dev/null +++ b/src/policy/CMSRucioPolicy/algorithms/pfn2scope_name.py @@ -0,0 +1,15 @@ +""" +PFN to scope:name translation algorithm for CMS Rucio policy +""" +from collections.abc import Mapping + +def cms_pfn2scope_name(parsed_pfn: Mapping[str, str]) -> tuple[str, str]: + """ + TODO: Write a description + """ + # Ignore user scopes for now + scope = "cms" + name = parsed_pfn['path'] + parsed_pfn['name'] + print("Inside cms function") + print(f"name: {name}") + return name, scope \ No newline at end of file