-
Notifications
You must be signed in to change notification settings - Fork 408
[script] Script for querying all reports #4245
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
Conversation
1893732
to
5179211
Compare
def result_getter(args: argparse.Namespace): | ||
def get_results(product_run: Tuple[str, str]): | ||
product, run = product_run | ||
print(product, run) |
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.
Is it necessary to print these values here?
for product in args.products: | ||
f = functools.partial(lambda p, r: (p, r), product) | ||
with subprocess.Popen([ | ||
'CodeChecker', 'cmd', 'runs', | ||
'--url', f'{args.url}/{product}', | ||
'-o', 'json'], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE | ||
) as proc: | ||
runs = list(__get_keys_from_list(proc.stdout.read())) | ||
|
||
with Pool(args.jobs) as p: | ||
p.map(result_getter(args), map(f, runs)) |
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.
I am just wondering wouldn't be better to have this section in a helper function.
result1 = json.load(args.result1) | ||
result2 = json.load(args.result2) | ||
|
||
result1.sort(key=lambda report: report['bugHash'] + str(report['reportId'])) | ||
result2.sort(key=lambda report: report['bugHash'] + str(report['reportId'])) | ||
|
||
found_mismatch = False | ||
|
||
for report in result1: | ||
if report not in result2: | ||
print("Report not found in result2:") | ||
print(json.dumps(report, indent=4)) | ||
found_mismatch = True | ||
|
||
for report in result2: | ||
if report not in result1: | ||
print("Report not found in result1:") | ||
print(json.dumps(report, indent=4)) | ||
found_mismatch = True | ||
|
||
args.result1.close() | ||
args.result2.close() |
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.
I think there is a code duplication here. Could you create a function to avoid it?
5179211
to
9efaf77
Compare
This script can query all reports for all products from a CodeChecker server.
9efaf77
to
591495c
Compare
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.
LGTM
This script can query all reports for all products from a CodeChecker server.