Skip to content

feat: add a Resource status source and route#910

Open
Loxeris wants to merge 7 commits into
DIRACGrid:mainfrom
Loxeris:ResourceStatusSource
Open

feat: add a Resource status source and route#910
Loxeris wants to merge 7 commits into
DIRACGrid:mainfrom
Loxeris:ResourceStatusSource

Conversation

@Loxeris
Copy link
Copy Markdown
Member

@Loxeris Loxeris commented May 6, 2026

Closes #839.

The work is not yet finished and tests are currently failing.

The most important problem is detailed in this comment regarding the use of CacheableSource and sync/async incompatibilities.

The sources should also be more likely instantiated in factory.py and router would get values through dependency injection.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 6, 2026

@Loxeris Loxeris force-pushed the ResourceStatusSource branch 3 times, most recently from 62373c2 to 7a6b600 Compare May 26, 2026 13:03
@Loxeris
Copy link
Copy Markdown
Member Author

Loxeris commented May 26, 2026

Integration tests seem to require the addition of ResourceStatusDB to the values of diracx-charts.
I will open a new PR.

@fstagni
Copy link
Copy Markdown
Contributor

fstagni commented May 27, 2026

Integration tests seem to require the addition of ResourceStatusDB to the values of diracx-charts. I will open a new PR.

I merged that PR.

@Loxeris
Copy link
Copy Markdown
Member Author

Loxeris commented May 27, 2026

Thanks! pytest-integration is now working.
I'm not really understanding why client installation in DIRAC Integration tests is failing now. Help would be appreciated.

@aldbr
Copy link
Copy Markdown
Contributor

aldbr commented May 29, 2026

Thanks! pytest-integration is now working. I'm not really understanding why client installation in DIRAC Integration tests is failing now. Help would be appreciated.

There you go:

2026-05-29T03:43:34.5088265Z + uvicorn --factory diracx.routers:create_app --host=0.0.0.0
2026-05-29T03:43:34.5088962Z Traceback (most recent call last):
2026-05-29T03:43:34.5097803Z   File "/app/.pixi/envs/container-services/bin/uvicorn", line 10, in <module>
2026-05-29T03:43:34.5098886Z     sys.exit(main())
2026-05-29T03:43:34.5099466Z              ^^^^^^
2026-05-29T03:43:34.5100380Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/click/core.py", line 1514, in __call__
2026-05-29T03:43:34.5101060Z     return self.main(*args, **kwargs)
2026-05-29T03:43:34.5101339Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5101885Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/click/core.py", line 1435, in main
2026-05-29T03:43:34.5102381Z     rv = self.invoke(ctx)
2026-05-29T03:43:34.5102618Z          ^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5103383Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/click/core.py", line 1298, in invoke
2026-05-29T03:43:34.5103977Z     return ctx.invoke(self.callback, **ctx.params)
2026-05-29T03:43:34.5104515Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5105426Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/click/core.py", line 853, in invoke
2026-05-29T03:43:34.5106207Z     return callback(*args, **kwargs)
2026-05-29T03:43:34.5106477Z            ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5106969Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/main.py", line 441, in main
2026-05-29T03:43:34.5107446Z     run(
2026-05-29T03:43:34.5107882Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/main.py", line 617, in run
2026-05-29T03:43:34.5108489Z     server.run()
2026-05-29T03:43:34.5109079Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/server.py", line 75, in run
2026-05-29T03:43:34.5109869Z     return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
2026-05-29T03:43:34.5110360Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5111265Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/_compat.py", line 30, in asyncio_run
2026-05-29T03:43:34.5111852Z     return runner.run(main)
2026-05-29T03:43:34.5112087Z            ^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5112551Z   File "/app/.pixi/envs/container-services/lib/python3.11/asyncio/runners.py", line 118, in run
2026-05-29T03:43:34.5113384Z     return self._loop.run_until_complete(task)
2026-05-29T03:43:34.5113694Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5114480Z   File "/app/.pixi/envs/container-services/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
2026-05-29T03:43:34.5115034Z     return future.result()
2026-05-29T03:43:34.5115260Z            ^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5115741Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/server.py", line 79, in serve
2026-05-29T03:43:34.5116251Z     await self._serve(sockets)
2026-05-29T03:43:34.5116735Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/server.py", line 86, in _serve
2026-05-29T03:43:34.5117227Z     config.load()
2026-05-29T03:43:34.5117698Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/uvicorn/config.py", line 455, in load
2026-05-29T03:43:34.5118199Z     self.loaded_app = self.loaded_app()
2026-05-29T03:43:34.5118460Z                       ^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5118999Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/diracx/routers/factory.py", line 387, in create_app
2026-05-29T03:43:34.5119557Z     return create_app_inner(
2026-05-29T03:43:34.5119785Z            ^^^^^^^^^^^^^^^^^
2026-05-29T03:43:34.5120480Z   File "/app/.pixi/envs/container-services/lib/python3.11/site-packages/diracx/routers/factory.py", line 263, in create_app_inner
2026-05-29T03:43:34.5121074Z     raise NotImplementedError(
2026-05-29T03:43:34.5121635Z NotImplementedError: Cannot enable system_name='rss' as it requires missing_sql_dbs={<class 'diracx.db.sql.rss.db.ResourceStatusDB'>}
2026-05-29T03:43:34.5122501Z ##[endgroup]

Not sure if it's related to that issue, but don't forget to also adapt the docker-compose file here (it's probably not documented, sorry): https://github.com/DIRACGrid/DIRAC/blob/27f8bc469e6d70e019824e3c44af1cf7b2242d86/tests/CI/docker-compose.yml#L290-L296

@aldbr aldbr force-pushed the ResourceStatusSource branch from 427faeb to 0d64ac1 Compare June 3, 2026 12:06
@Loxeris Loxeris marked this pull request as ready for review June 3, 2026 13:33
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.

ResourceStatusSource + route

3 participants