You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The name_filter parameter currently only supports simple string matching:
# Current functionality - simple string containment matchingflow.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 parameterflow.update_maker_kwargs(settings, name_filter="relax", exclude=True)
Implementation Suggestion
defupdate_maker_kwargs(
self,
settings: dict,
name_filter: Union[str, List[str], None] =None,
exclude: bool=False,
...
) ->Flow:
defmatches_filter(job_name: str) ->bool:
ifname_filterisNone:
returnTrueifisinstance(name_filter, list):
# For list filters, any match satisfies (OR logic)matches=any(nfinjob_namefornfinname_filter)
else:
# For string filters, simple containmentmatches=name_filterinjob_name# Handle exclusionreturnnotmatchesifexcludeelsematches
Benefits
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)
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.
The text was updated successfully, but these errors were encountered:
hongyi-zhao
changed the title
Enhancement: Extended name filtering capabilities for update_maker_kwargs and related methods.
Enhancement: Extended name filtering capabilities for the name_filter method.
Nov 2, 2024
Thanks very much for the suggestion. I wonder whether an alternative option is to allow a filter function. This could the be extremely flexible about how the filtering is performed.
For example:
List-based filtering for multiple patterns:
# Match jobs containing either "relax" or "static"flow.update_maker_kwargs(settings, filter_func=lambdajob: job.namein ["relax", "static"])
Negative filtering (exclusion):
# Match jobs that don't contain "relax"flow.update_maker_kwargs(settings, filter_func=lambdajob: "relax"notinjob.name)
Current Behavior
The
name_filter
parameter currently only supports simple string matching: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:Implementation Suggestion
Benefits
Questions for Discussion
!pattern
)exclude=True
)Related Work
jobflow/core/job.py
Let me know your thoughts on the proposed enhancements and implementation approach.
The text was updated successfully, but these errors were encountered: