Skip to content

[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

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

bruntib
Copy link
Contributor

@bruntib bruntib commented May 22, 2024

This script can query all reports for all products from a CodeChecker server.

@bruntib bruntib added this to the release 6.24.0 milestone May 22, 2024
@bruntib bruntib requested a review from vodorok as a code owner May 22, 2024 12:07
@dkrupp dkrupp modified the milestones: release 6.24.0, release 6.24.1 Jun 13, 2024
@bruntib bruntib force-pushed the query_checkers_script branch 6 times, most recently from 1893732 to 5179211 Compare August 1, 2024 09:03
def result_getter(args: argparse.Namespace):
def get_results(product_run: Tuple[str, str]):
product, run = product_run
print(product, run)
Copy link
Collaborator

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?

Comment on lines +106 to +111
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))
Copy link
Collaborator

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.

Comment on lines 30 to 50
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()
Copy link
Collaborator

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?

@bruntib bruntib force-pushed the query_checkers_script branch from 5179211 to 9efaf77 Compare August 9, 2024 06:19
@bruntib bruntib requested a review from cservakt August 9, 2024 06:20
This script can query all reports for all products from a CodeChecker
server.
@bruntib bruntib force-pushed the query_checkers_script branch from 9efaf77 to 591495c Compare August 9, 2024 09:36
Copy link
Collaborator

@cservakt cservakt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cservakt cservakt merged commit 22cada3 into Ericsson:master Aug 9, 2024
8 checks passed
@bruntib bruntib deleted the query_checkers_script branch August 13, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants