<#1327 Add status filter to App.listall() and --st...
# flyte-github
a
#1327 Add status filter to App.listall() and --status flag to flyte get apps Pull request opened by AdilFayyaz Motivation There was no way to filter apps by deployment status server-side. App.listall() only accepted created_by_subject, sort_by, and limit, even though the underlying list_pb2.ListRequest supports arbitrary filters — users had to fetch everything and filter client-side on app.pb2.status.deployment_status. Summary SDK (src/flyte/remote/_app.py) • App.listall() accepts a new optional in_status: str | Tuple[str, ...] | None parameter, e.g. in_status="active" or in_status=("active", "failed"). • Status names are case-insensitive and accepted with or without the DEPLOYMENT_STATUS_ prefix; unknown names raise ValueError. • A single status produces an EQUAL filter, multiple statuses produce VALUE_IN, passed through the existing filtering() helper. CLI (src/flyte/cli/_get.py) • flyte get apps gains a --status flag with choices generated from the proto enum (unassigned, assigned, pending, stopped, started, failed, active, scaling_up, scaling_down, deploying). • Single-value for now, matching the existing --in-phase precedent; the SDK API already accepts tuples so multiple=True can be added later. flyte get apps --status active flyte get apps --status failed --only-mine Wire contract (verified against a live backend) The backend's app list endpoint filters on field="status_phase" and matches by enum name (e.g. "DEPLOYMENT_STATUS_ACTIVE"), not the integer enum value. This differs from the Action.listall phase filter, which sends stringified integers — integer values silently return zero rows here, and alternative field names (deployment_status, status) are rejected by the backend. Both EQUAL and VALUE_IN were verified to return exact matches. Testing • New TestAppListallStatusFilter unit tests mock app_service.list and assert the exact filter protos sent: no filter when omitted, EQUAL/VALUE_IN shapes, case-insensitivity, prefixed names, invalid-value error, and combination with created_by_subject. • Live smoke test: flyte get apps --status active returns only ACTIVE apps; server-side results match client-side filtering on deployment_status. • ruff and mypy clean. flyteorg/flyte-sdk