DIRACGrid / DIRACGrid/DIRAC

[Bug]: RucioFileCatalogClient overrides rucio's builtin configuration for extract_scope mechanism

Open Beginner friendly
#8,741 2 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
126
Forks
191
Avg merge
1d 13h
Merged PRs (30d)
33

Description

### Search before creating an issue

- [x] I have searched existing issues and confirmed this is not a duplicate

### Bug Description

In an installation with a properly configured rucio and rucio policy package the correct `extract_scope` algorithm should be used by default, however, the `RucioFileCatalogClient` overrides this with a value from the dirac configuration system:

https://github.com/DIRACGrid/DIRAC/blob/795b39948bd50cd33127b53513bf9e9ea1007434/src/DIRAC/Resources/Catalog/RucioFileCatalogClient.py#L107

I think it would be better if it relied on the rucio configuration instead, which can register the correct extract_scope algorithm via the policy package.

### Steps to Reproduce

With the CTAO rucio policy installed, which correctly handles this case, but the default configuration is overriden to use the `dirac` scope extraction:

```
❯ dirac-dms-filecatalog-cli
Starting FileCatalog console
FC:/> ls
Traceback (most recent call last):
File "/home/maxnoe/.local/conda/envs/dpps-preprod/bin/dirac-dms-filecatalog-cli", line 7, in
sys.exit(main())
~~~~^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/Core/Base/Script.py", line 74, in __call__
return entrypointFunc._func()
~~~~~~~~~~~~~~~~~~~~^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/DataManagementSystem/scripts/dirac_dms_filecatalog_cli.py", line 89, in main
cli.cmdloop()
~~~~~~~~~~~^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/cmd.py", line 146, in cmdloop
stop = self.onecmd(line)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/cmd.py", line 224, in onecmd
return func(arg)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/DataManagementSystem/Client/FileCatalogClientCLI.py", line 1190, in do_ls
result = self.fc.isFile(path)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/Resources/Catalog/Utilities.py", line 81, in processWithCheckingArguments
result = f(*argTuple, **kwargs)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/Resources/Catalog/RucioFileCatalogClient.py", line 460, in isFile
dids.append(self.__getDidsFromLfn(lfn))
~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/Resources/Catalog/RucioFileCatalogClient.py", line 207, in __getDidsFromLfn
scope = get_scope(lfn, scopes=self.scopes, diracAlgorithm=self.diracScopeAlg)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/DIRAC/Resources/Catalog/RucioFileCatalogClient.py", line 41, in get_scope
scope, _ = extract_scope(did=lfn, scopes=scopes, default_extract=diracAlgorithm)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/rucio/common/utils.py", line 670, in extract_scope
return scope_extraction_algorithms.extract_scope(did, scopes, extract_scope_convention)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/rucio/common/utils.py", line 582, in extract_scope
return fn(did, scopes)
File "/home/maxnoe/.local/conda/envs/dpps-preprod/lib/python3.13/site-packages/rucio/common/utils.py", line 653, in extract_scope_dirac
scope = elem[1]
~~~~^^^
IndexError: list index out of range
```

### Expected Behavior

_No response_

### Actual Behavior

_No response_

### Environment

_No response_

### Relevant Log Output

```shell

```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in src/DIRAC/Resources/Catalog/RucioFileCatalogClient.py, especially the configuration at line 107, get_scope, and __getDidsFromLfn, then reproduce the issue with dirac-dms-filecatalog-cli. Done means the client no longer overrides Rucio's configured extract_scope policy and the file-catalog lookup works with the CTAO policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.