Skip to content

feat: add RSS data models (SQLAlchemy + Pydantic)#857

Merged
aldbr merged 5 commits intoDIRACGrid:mainfrom
HeloiseJoffe:feat/rss-data-models
Apr 15, 2026
Merged

feat: add RSS data models (SQLAlchemy + Pydantic)#857
aldbr merged 5 commits intoDIRACGrid:mainfrom
HeloiseJoffe:feat/rss-data-models

Conversation

@HeloiseJoffe
Copy link
Copy Markdown
Contributor

Closes #837

Changes :

  • Add RSS SQLAlchemy 2.0 models for the tables and ResourceStatusDB class
  • Add RSS entry point
  • Add pydantic models and ResourceType enum
  • Add Unit tests

@HeloiseJoffe HeloiseJoffe requested a review from aldbr March 25, 2026 09:33
@fstagni fstagni closed this Mar 26, 2026
@fstagni fstagni reopened this Mar 26, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Mar 26, 2026

Documentation build overview

📚 diracx | 🛠️ Build #32256550 | 📁 Comparing e049282 against latest (ea405cc)

  🔍 Preview build  

No files changed.

@aldbr aldbr force-pushed the feat/rss-data-models branch from dee80c6 to bf5abcb Compare March 26, 2026 18:26
@HeloiseJoffe HeloiseJoffe force-pushed the feat/rss-data-models branch from 59514d8 to 036cb9c Compare March 30, 2026 08:35
@DIRACGridBot DIRACGridBot marked this pull request as draft March 31, 2026 08:59
@HeloiseJoffe HeloiseJoffe force-pushed the feat/rss-data-models branch 2 times, most recently from cb53ac5 to 87c7b68 Compare April 2, 2026 06:37
@HeloiseJoffe HeloiseJoffe marked this pull request as ready for review April 2, 2026 06:39
@HeloiseJoffe HeloiseJoffe force-pushed the feat/rss-data-models branch from 87c7b68 to 5c3f59d Compare April 8, 2026 09:29
@HeloiseJoffe HeloiseJoffe requested a review from aldbr April 8, 2026 12:06

metadata = RSSBase.metadata

async def get_site_status(self, name: str, vo: str = "all") -> tuple[str, str]:
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.

@fstagni out of curiosity, shouldn't we (not now but later) transition from this magic all to NULL in the DB?
If not VO is set, then we assume it's for all of them.
Unless I miss something?

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 would agree with you

async def get_resource_status(
self,
name: str,
statustypes: list[str] = ["all"],
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.

Beware of https://docs.astral.sh/ruff/rules/mutable-argument-default/
It's fine here because we don't mutate status_types but we should be careful.

@fstagni same here, should we transition from all for VO and StatusType to NULL at some point?

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 would agree to this one too.

@DIRACGridBot DIRACGridBot marked this pull request as draft April 9, 2026 16:36

metadata = RSSBase.metadata

async def get_site_status(self, name: str, vo: str = "all") -> tuple[str, str]:
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 would agree with you

async def get_resource_status(
self,
name: str,
statustypes: list[str] = ["all"],
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 would agree to this one too.

)


class ResourceNotFoundError(DiracError):
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 am really wondering if we need this one at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used to use a raise ValueError to handle missing sites and resources, but Alexandre advised me to use a ResourceNotFoundError in diracx/core/exceptions.py instead.
Do you think we should handle it differently ?

@HeloiseJoffe HeloiseJoffe force-pushed the feat/rss-data-models branch from 5c3f59d to e049282 Compare April 14, 2026 13:15
@aldbr aldbr marked this pull request as ready for review April 15, 2026 07:16
@aldbr aldbr merged commit d8805ea into DIRACGrid:main Apr 15, 2026
29 checks passed
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.

RSS data models (SQLAlchemy + Pydantic)

3 participants