-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Current Behavior
The name_filter parameter currently only supports simple string matching:
# Current functionality - simple string containment matching
flow.update_maker_kwargs(settings, name_filter="relax")This basic matching is implemented using string containment (name_filter in job.name), which limits filtering capabilities to substring matching only.
Proposed Enhancement
Extend the name_filter functionality to support:
- List-based filtering for multiple patterns:
# Match jobs containing either "relax" or "static"
flow.update_maker_kwargs(settings, name_filter=["relax", "static"])- Negative filtering (exclusion):
# Match jobs that don't contain "relax"
flow.update_maker_kwargs(settings, name_filter="!relax")
# Or alternatively with explicit parameter
flow.update_maker_kwargs(settings, name_filter="relax", exclude=True)Implementation Suggestion
def update_maker_kwargs(
self,
settings: dict,
name_filter: Union[str, List[str], None] = None,
exclude: bool = False,
...
) -> Flow:
def matches_filter(job_name: str) -> bool:
if name_filter is None:
return True
if isinstance(name_filter, list):
# For list filters, any match satisfies (OR logic)
matches = any(nf in job_name for nf in name_filter)
else:
# For string filters, simple containment
matches = name_filter in job_name
# Handle exclusion
return not matches if exclude else matchesBenefits
- More flexible job filtering patterns
- Ability to update multiple job types in one operation
- Support for exclusion patterns
- Maintains backward compatibility with existing code
Questions for Discussion
- Should we support AND logic for list filters (matching all patterns) in addition to OR logic?
- Should we consider supporting regex patterns for more advanced matching?
- For negative filtering, which approach is preferred:
- Prefix notation (
!pattern) - Explicit parameter (
exclude=True)
- Prefix notation (
Related Work
- Current implementation in
jobflow/core/job.py - Similar filtering patterns in other workflow management systems
Let me know your thoughts on the proposed enhancements and implementation approach.
Metadata
Metadata
Assignees
Labels
No labels