Manish Maheshwari created YARN-11972:
----------------------------------------
Summary: Support comma-separated usernames in Capacity Scheduler
user placement rules
Key: YARN-11972
URL: https://issues.apache.org/jira/browse/YARN-11972
Project: Hadoop YARN
Issue Type: Improvement
Reporter: Manish Maheshwari
h2. Summary
Support multiple discrete usernames in a *single* Capacity Scheduler placement
rule by accepting a comma-separated list in the {{matches}} field (e.g.
{{alice,bob,charlie}}), so administrators can route many named users to one
queue without creating 1:1 rules or relying on LDAP group mapping.
h2. Problem
User-type placement rules currently match *exactly one username* (or {{*}} for
all users). The {{matches}} value is passed verbatim to {{createUserMatcher()}}
in {{MappingRuleCreator}}.
Entering {{"matches": "a,b,c,d"}} only matches a user literally named
{{a,b,c,d}} — not users {{a}}, {{b}}, {{c}}, or {{d}} individually.
{{OrMatcher}} already exists in {{MappingRuleMatchers}} but is not wired into
rule creation.
h2. Proposed Solution
When {{type=user}}, parse {{matches}} as a comma-separated list (trim
whitespace):
* *One username* → {{createUserMatcher(name)}} (unchanged)
* *Multiple usernames* → {{OrMatcher}} over per-user matchers
* *Entire string is {{*}}* → {{createAllMatcher()}} (unchanged; no split)
Apply the same logic in legacy {{MappingRule.createLegacyRule()}} for {{u:}}
mappings (e.g. {{u:alice,bob:queue1}}).
*Out of scope (v1):* comma-separated groups, per-user wildcards, JSON array
syntax, Fair Scheduler.
h2. Acceptance Criteria
*AC-1:* JSON rule with {{"matches": "alice,bob,charlie"}} matches users
{{alice}}, {{bob}}, {{charlie}}; does not match {{dave}}.
*AC-2:* Whitespace tolerance — {{" alice , bob "}} behaves same as
{{"alice,bob"}}.
*AC-3:* Single-user and wildcard unchanged. {{*}} as match-all applies only
when the entire string is {{*}} (not {{*,alice}}).
*AC-4:* Legacy {{yarn.scheduler.capacity.queue-mappings=u:alice,bob:queue1}}
places {{alice}} and {{bob}} in {{queue1}}. Existing
{{u:user1:queue1,u:user2:queue2}} (comma separates rules) unchanged.
*AC-5:* Capacity Scheduler UI accepts comma-separated usernames in Match
Pattern; help text updated.
*AC-6:* CS UI round-trip — comma-separated list saved and reloaded as one rule
row.
*AC-7:* {{type=group}} and {{type=application}} — comma in {{matches}} remains
literal (no split in v1).
h2. Minimal Patch Outline
All under {{hadoop-yarn-project/}}:
*Phase 1 — RM engine (required)*
# {{MappingRuleMatchers.java}} — add {{createUserMatcherFromMatches(String)}}
# {{MappingRuleCreator.java}} — use new factory for USER case
# {{MappingRule.java}} — same in {{createLegacyRule()}}
# {{MappingRulesDescription.json}} — document comma-separated syntax
# {{TestMappingRuleCreator.java}}, {{TestCSMappingPlacementRule.java}},
{{TestMappingRuleMatchers.java}} — tests
*Phase 2 — CS UI + docs (recommended)*
# {{PlacementRuleForm.tsx}} — update placeholder/help text
# {{placement-rule-schema.ts}} — reject empty tokens after split
# {{CapacityScheduler.md}} — document multi-user syntax
h2. Edge Cases
* Empty entry {{alice,,bob}} — reject at parse with clear error
* Username containing comma — not supported in v1; document limitation
* Very long lists (500+ users) — engine OK; UI usability separate concern
h2. Alternatives Considered
* UI expands one row → N JSON rules at save — works today; config bloat
* Group mapping — not acceptable where explicit user lists are required
* JSON array syntax — defer to v2
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]