Closed MadinaB closed 5 years ago
adr skipped_tests --from today-week
optional_arguments:
['suite', 'platform']
Query before update:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': {'$eval': 'suite'}}}, {'eq': {'build.platform': {'$eval': 'platform'}}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': {'$eval': 'from_date'}}}}, {'lte': {'run.stats.end_time': {'date': {'$eval': 'to_date'}}}}]}, 'limit': 100, 'format': 'table'}
Query after update:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': {'$eval': 'from_date'}}}}, {'lte': {'run.stats.end_time': {'date': {'$eval': 'to_date'}}}}]}, 'limit': 100, 'format': 'table'}
Query after render:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': 'today-week'}}}, {'lte': {'run.stats.end_time': {'date': 'eod'}}}]}, 'limit': 100, 'format': 'table'}
adr skipped_tests --from today-week --suite xpcshell --platform maxosx64
optional_arguments:
['suite', 'platform']
Query before update:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': {'$eval': 'suite'}}}, {'eq': {'build.platform': {'$eval': 'platform'}}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': {'$eval': 'from_date'}}}}, {'lte': {'run.stats.end_time': {'date': {'$eval': 'to_date'}}}}]}, 'limit': 100, 'format': 'table'}
Query after update:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': {'$eval': 'suite'}}}, {'eq': {'build.platform': {'$eval': 'platform'}}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': {'$eval': 'from_date'}}}}, {'lte': {'run.stats.end_time': {'date': {'$eval': 'to_date'}}}}]}, 'limit': 100, 'format': 'table'}
Query after render:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': 'xpcshell'}}, {'eq': {'build.platform': 'maxosx64'}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': 'today-week'}}}, {'lte': {'run.stats.end_time': {'date': 'eod'}}}]}, 'limit': 100, 'format': 'table'}
Upper snippets is an output result after updating run_query
in query.py
for query in load_query(name):
....
print("Query before update:")
print(query)
update_query(query, context, optional_arguments)
print("Query after update:")
print(query)
query = jsone.render(query, context)
print("Query after render:")
print(query)
....
They show how does query provided in PR #69 change via passed filters
On the contrary without this PR, PR #69 does not change and passes None for filters which are not present:
adr skipped_tests --from today-week
Query before update:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': {'$eval': 'suite'}}}, {'eq': {'build.platform': {'$eval': 'platform'}}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': {'$eval': 'from_date'}}}}, {'lte': {'run.stats.end_time': {'date': {'$eval': 'to_date'}}}}]}, 'limit': 100, 'format': 'table'}
Query after render:
{'from': 'unittest', 'select': [{'aggregate': 'count'}], 'groupby': [{'value': 'result.test'}, {'value': 'run.suite.fullname'}], 'where': {'and': [{'eq': {'run.suite.fullname': None}}, {'eq': {'build.platform': None}}, {'eq': {'repo.branch.name': 'mozilla-central'}}, {'eq': {'result.status': 'SKIP'}}, {'gte': {'run.stats.end_time': {'date': 'today-week'}}}, {'lte': {'run.stats.end_time': {'date': 'eod'}}}]}, 'limit': 100, 'format': 'table'}
Thanks for your work here! I believe this issue has been resolved another way (plus it has a lot of bitrot), so closing. Thanks for your understanding.
I have been working on this trying to solve this task given in here
This update helps to create query with any optional filters which user can either pass or not pass. At first, general query should be created and saved in 'some_query_name'.query file which contains all possible filters. Then optional filters (getting rid of which will not affect the code) should be saved in optional_arguments and passed to run_query as:
So the code will update the query by deleting filters which rely on arguments which were not passed