feat(tasks): support both diracx-tasks and diracx-task-run (phase 1, #975) - #1010
feat(tasks): support both diracx-tasks and diracx-task-run (phase 1, #975)#1010mmascher wants to merge 9 commits into
Conversation
* move DiracHttpResponseError from core exceptions to diracx-routers * update imports in router factory and auth token router * keep app-level custom exception handling behavior unchanged * document error-boundary/fallback intent in coding conventions * normalize remaining e.args[0] usage to str(e) for consistency
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Remove local ignored file Co-authored-by: aldbr <aldbr@outlook.com>
* return JSONResponse directly for authorization_pending
…ponse in token flow
Documentation build overview
13 files changed ·
|
There was a problem hiding this comment.
Pull request overview
This PR primarily implements Phase 1 of the CLI rename/migration for the tasks subsystem by introducing diracx-tasks while keeping diracx-task-run working, and updates local tooling + documentation to prefer the new name. It also includes a separate set of changes to HTTP/domain exception handling in the routers/core.
Changes:
- Add
diracx-tasksas an additional console script entry point while keepingdiracx-task-run. - Update local launcher scripts, pixi tasks, and documentation to use
diracx-tasks(with explicit compatibility notes in key docs). - Refactor exception handling by removing
DiracHttpResponseErrorand adjusting router behavior for some auth flows.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| run_local.sh | Switch local scheduler/worker invocations to diracx-tasks. |
| run_local_tasks.sh | Switch local wrapper to exec diracx-tasks. |
| pixi.toml | Update pixi task description to reference diracx-tasks. |
| docs/dev/reference/tasks.md | Update CLI reference example to diracx-tasks. |
| docs/dev/reference/pixi-tasks.md | Update pixi task docs to diracx-tasks. |
| docs/dev/reference/coding-conventions.md | Document exception-handling boundaries between layers. |
| docs/dev/how-to/add-a-task.md | Update interactive task execution examples to diracx-tasks call. |
| docs/dev/explanations/tasks/index.md | Update CLI naming and add migration alias note. |
| docs/dev/explanations/tasks/class-details.md | Update interactive mode mention to diracx-tasks call. |
| docs/admin/how-to/tasks/run-task-manually.md | Update operational docs to diracx-tasks + add alias note. |
| docs/admin/how-to/tasks/configure.md | Update operational examples to diracx-tasks + add alias note. |
| docs/admin/explanations/tasks.md | Update lifecycle explanation to reference diracx-tasks call. |
| diracx-tasks/src/diracx/tasks/task_run.py | Update CLI docstring to prefer diracx-tasks and mention alias. |
| diracx-tasks/pyproject.toml | Add diracx-tasks console script alongside diracx-task-run. |
| diracx-routers/src/diracx/routers/factory.py | Remove DiracHttpResponseError handler and adjust DiracError handling. |
| diracx-routers/src/diracx/routers/auth/token.py | Return a JSON OAuth-style error payload for pending device authorization. |
| diracx-routers/src/diracx/routers/auth/device_flow.py | Use str(e) for HTTPException detail construction. |
| diracx-core/src/diracx/core/exceptions.py | Remove DiracHttpResponseError and simplify DiracError shape. |
Suppressed comments (1)
diracx-routers/src/diracx/routers/factory.py:33
- The PR is scoped (title/description) to introducing the new
diracx-tasksCLI alias, but it also removesDiracHttpResponseErrorand changes application-level exception handling behavior. This is a significant, user-facing HTTP error-handling change that should either be called out explicitly in the PR description/release notes or split into a separate PR to keep the migration work isolated.
from diracx.core.config import ConfigSource
from diracx.core.exceptions import DiracError, NotReadyError
from diracx.core.extensions import DiracEntryPoint, select_from_extension
from diracx.core.settings import FactorySettings, ServiceSettingsBase
from diracx.core.sources import AsyncCacheableSource
from diracx.db.exceptions import DBUnavailableError
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| except PendingAuthorizationError: | ||
| return JSONResponse( | ||
| status_code=HTTPStatus.BAD_REQUEST, | ||
| data={"error": "authorization_pending"}, | ||
| ) from e | ||
| content={"error": "authorization_pending"}, | ||
| ) |
| def __init__(self, detail: str = "Unknown"): | ||
| self.detail = detail |
|
I did the PR from a dirty branch, the correct PR is #1011 |
Summary
This PR implements Phase 1 of issue #975 by introducing the new CLI name while preserving backward compatibility with the old one.
What changed
diracx-tasks.diracx-task-run.diracx-tasks.diracx-task-runremains supported during migration.Migration plan context (3 phases)
Support both names in diracx so current deployments and charts do not break.
Switch charts to only use
diracx-tasksafter Phase 1 is merged/released.Remove the old alias
diracx-task-runonce chart migration is complete and safe.Why this is safe
diracx-task-runwithout changing this release.Rollback safety note
If any environment is still wired to
diracx-task-run, it will continue to function in Phase 1.In case of operational issues with the new command name rollout, usage can be temporarily reverted to
diracx-task-runwith no packaging change required in this PR.Validation
diracx-tasks.Closes
Fixes #975