villebro opened a new pull request, #43435:
URL: https://github.com/apache/superset/pull/43435

   ### SUMMARY
   
   Small, additive ergonomics improvement to the coordination service, part of 
the [GAQ→GTF epic](https://github.com/apache/superset/pull/43407) (targets 
`gaq-to-gtf`).
   
   `CoordinationService.get_value` / `set_value` / `delete_value` previously 
took a plain `key: str`, so every caller had to build the key string eagerly. 
For parity with Superset's other cache-key helpers (e.g. 
`memoized_func(key=...)`), the KV ops now also accept a `() -> str` **key 
generator**, resolved at call time via a shared `_resolve_key` helper. A 
literal string still passes through unchanged, so the change is 
backward-compatible and purely additive; `delete_value(*keys)` accepts a mix of 
literals and generators.
   
   ```python
   KeyLike = Union[str, Callable[[], str]]
   ```
   
   A generator that returns a non-string raises `TypeError` (fail fast, before 
touching the backend).
   
   **Scope note:** this is intentionally limited to the general-purpose 
coordinator KV. The GTF **`task_key` stays a fixed literal** — it is the dedup 
identity resolved synchronously at submit time (it feeds the dedup lock + 
`dedup_key`), so it must not become callable/mutable.
   
   ### TESTING INSTRUCTIONS
   
   - `pytest tests/unit_tests/coordination/test_service.py 
tests/unit_tests/distributed_lock/` — 27 passed. New coverage: a callable key 
resolved per-op for get/set/delete (incl. a literal+callable mix), and the 
non-string-key `TypeError` guard.
   - `mypy` / `ruff` / `pylint` clean on changed files.
   - Backward compatibility: existing string-key callers (the distributed lock) 
unchanged and green.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to