-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement mongodb query syntax for task filters #258
Conversation
karton/core/query.py
Outdated
regular_filter, negative_filter = [], [] | ||
negative_filter = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated negative_filter
definition
regular_filter, negative_filter = [], [] | |
negative_filter = [] | |
regular_filter, negative_filter = [], [] |
closes #245 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall: it would be nice to have an entry in documentation about new syntax and its limitations.
This adopts code from https://github.com/kapouille/mongoquery to implement a mongodb-like syntax for task filtering in karton.
As mentioned in the code, there are some pitfalls since the old negative matching works in three-state logic and can't be translated to the new query syntax literally. For a short example:
will match all non-linux non-windows samples, as was probably intended, but:
is wrong - this means literally
task.headers["platform"] != "win32" or task.headers["platform"] != "linux"
and hence will match every task.To get equivalent behaviour with mongo syntax, you should use:
See #246 for original reasoning behind the old-style behaviour.
Background compatibility considerations
"platform": {"$or": ["win*", "linux*"]}
will only work for awin*
literal, for example.