lablup / lablup/backend.ai

Add installedAgents some/every/none nested filter to ImageV2Filter

Open
#13,415 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Add a nested quantifier filter on the installation relation, following the ReplicaNestedFilter pattern (DeploymentFilter.replicas).

Scope:

```
input AgentNestedFilter {
"""Matches images with at least one installed agent satisfying all conditions."""
some: AgentFilter
"""Matches images where every installed agent satisfies all conditions (also true when no agent has the image)."""
every: AgentFilter
"""Matches images with no installed agent satisfying all conditions."""
none: AgentFilter
}

input ImageV2Filter {
# ... 기존 필드 ...
"""Filter by conditions on the agents this image is installed on."""
installedAgents: AgentNestedFilter
}
```

- AgentNestedFilter input with some / every / none quantifiers over AgentFilter, wired into ImageV2Filter as installedAgents.
- Conversion in the image adapter mirrors the replica filter conversion: some maps to a correlated EXISTS subquery over agent_images joined with agents, none to NOT EXISTS, every to NOT EXISTS of the negated condition (images with no installed agent match every vacuously).
- The existing make_correlated_exists helper assumes a single child table; add a join-capable variant (condition factory level, no infrastructure change) since the relation goes through the agent_images junction.
- No flat installed boolean field: installed true equals some with an empty filter, installed false equals none with an empty filter.
- Composes with the existing AND / OR / NOT logic automatically.

Success Criteria
- [ ] some with an empty filter returns exactly the images installed on at least one agent
- [ ] none with an empty filter returns exactly the images installed nowhere
- [ ] some with status equals ALIVE returns only images installed on at least one alive agent
- [ ] every semantics: images with no installed agents match every
- [ ] the nested filter combines correctly under AND / OR / NOT
- [ ] pants test passes for affected packages

JIRA Issue: BA-7166

Contributor guide

Open the contributing guide

Research direction

Start by locating the ImageV2Filter image adapter and the ReplicaNestedFilter conversion used by DeploymentFilter.replicas. Trace the existing correlated EXISTS helper and the agent_images-to-agents relation before adding the join-capable condition conversion. Done means some, every, and none satisfy the listed empty and status filters, compose under AND/OR/NOT, and affected packages pass their Pants tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.