Commit b06de62
committed
refactor(admin): replace dynamic subquery with explicit join (#772)
The `reana-admin retention-rules-apply` command selected
candidate retention rules either from `workflow.retention_rules`
(a query object, under the old `lazy="dynamic"` setting on
`Workflow.retention_rules`) or by joining onto
`user.workflows.subquery()` (a subquery built from the dynamic
`User.workflows` query).
After dropping `lazy="dynamic"` in reana-db so these
relationships return regular lists, the previous code no longer
works: lists have neither a `.subquery()` method nor the
follow-up `.filter(...)` chain that the rest of the function
relies on.
Replace both branches with explicit queries on
`WorkspaceRetentionRule`: filter by `workflow_id` for the
single-workflow case, and join `Workflow` filtered by
`owner_id` for the per-user case. Result is the same set of
rows, but expressed through standard `Session.query(...)`
calls.1 parent 429f279 commit b06de62
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
764 | 764 | | |
765 | 765 | | |
766 | 766 | | |
767 | | - | |
| 767 | + | |
768 | 768 | | |
769 | | - | |
770 | | - | |
| 769 | + | |
| 770 | + | |
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| |||
0 commit comments