Skip to content

feat: add RSS read adapter - #8733

Draft
Loxeris wants to merge 1 commit into
DIRACGrid:integrationfrom
Loxeris:read-adapter-rss
Draft

feat: add RSS read adapter#8733
Loxeris wants to merge 1 commit into
DIRACGrid:integrationfrom
Loxeris:read-adapter-rss

Conversation

@Loxeris

@Loxeris Loxeris commented Aug 5, 2026

Copy link
Copy Markdown
Member

closes #8685

  • new self-contained module dedicated to the rss read adapter.

BEGINRELEASENOTES
*RssReadAdapter
NEW: add RssReadAdapter module
ENDRELEASENOTES

@Loxeris

Loxeris commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

A few points/issues about the current state:

  • ResourceStatus expects VO in the data it uses to refresh the cache, but it's not provided by the RSS API, should I use a default value (currently None) or make changes to the RSS API output data ?
  • There is currently no way to specify we want all the VOs from the RSS API as it is inferred from the credentials.
  • There's probably a lot to change in the tests.

@fstagni fstagni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding your questions: I would suggest expanding/modifying DIRAC"s RSS to match DiracX way of doing things.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some code de-duplication that can be achieved in this module, at the same time maybe reducing readability. Up to you.



def get_fts_status() -> list[tuple]:
"""Get merged FTS server status from all VOs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "merged"?

Comment on lines +140 to +156
def _translate_resource_status(status: AllowedStatus | BannedStatus) -> str:
"""Translate a single resource status from diracx format to legacy format.

Args:
status: ResourceStatus (AllowedStatus or BannedStatus)

Returns:
Legacy status string - only "Active" or "Banned" as per DIRAC streamlining

"""
if isinstance(status, AllowedStatus):
# DIRAC is being streamlined to only use Active/Banned states
# All allowed statuses (including Degraded) are mapped to Active
return "Active"
else: # BannedStatus
# All banned statuses are mapped to Banned
return "Banned"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HeloiseJoffe is going to make a small utility that you will be able to reuse.


from typing import Dict

from diracx.core.models.rss import (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it working knowing that we get results from autorest models?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't add RssReadAdapter here.
src/DIRAC only contains systems, here you have a specific RSS client so that should ideally go somewhere in /src/DIRAC/ResourceStatusSystem/Client.

In this context, I think you can get rid of this init file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about merging ResponseTranslation and Statuses into a single file under src/DIRAC/ResourceStatusSystem/Client?

List of tuples in legacy format: (name, element_type, status_type, status, vo)

"""
with DiracXClient() as client:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pass the client as an argument of the functions? So that a same one can be reused if needed

)


def get_storage_element_status() -> list[tuple]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you would just need to have 1 function that would have almost the same form as ResourceStatusClient.selectStatusElement.
And in the next PR that would be used in SiteStatus.__updateRssCache and ResourceStatus.__updateRssCache IIUC.

@aldbr

aldbr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

A few points/issues about the current state:

  • ResourceStatus expects VO in the data it uses to refresh the cache, but it's not provided by the RSS API, should I use a default value (currently None) or make changes to the RSS API output data ?
  • There is currently no way to specify we want all the VOs from the RSS API as it is inferred from the credentials.
  • There's probably a lot to change in the tests.

True, may be we would need to rethink the DiracX RSS API? @fstagni any opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read adapter: diracx RSS calls + response translation

3 participants