Skip to content

Add category id cache.#787

Merged
riga merged 1 commit intomasterfrom
feat/category_id_cache
Mar 11, 2026
Merged

Add category id cache.#787
riga merged 1 commit intomasterfrom
feat/category_id_cache

Conversation

@riga
Copy link
Member

@riga riga commented Mar 9, 2026

This PR adds a persistent caching mechanism for category ids by category name, and adjusts the add_category() and create_category_combinations() config utils to use it.

With that, the pattern of adding categories can become

from columnflow.config_util import CategoryIDCache, add_category

id_cache = CategoryIDCache(config_inst).open()

add_category(name="etau", selection="cat_etau", id=id_cache)  # users might use partial :)
...  # more categories here

id_cache.close()

The cache makes sure to use an increasing id for yet unseen category names, and the previously seen id otherwise. Upon close(), the cache is saved to a common location.

@riga riga requested a review from mafrahm March 9, 2026 13:38
@riga riga self-assigned this Mar 9, 2026
@riga riga added enhancement New feature or request priority-medium Medium priority stuff labels Mar 9, 2026
@riga riga moved this to In Progress in columnflow v0.3.1 Mar 9, 2026
@riga riga merged commit 0af5029 into master Mar 11, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in columnflow v0.3.1 Mar 11, 2026
@riga riga deleted the feat/category_id_cache branch March 11, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority-medium Medium priority stuff

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants