Skip to content
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

Add resources-diff.py. Run script on FastTimerService resources.json output of PR versus IB release. #2343

Merged
merged 20 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions pr_testing/resources-diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /usr/bin/env python3

import sys
import json


def diff_from(metrics, data, dest):
dest["events"] -= data["events"]
for metric in metrics:
dest[metric] -= data[metric]


if len(sys.argv) == 1:
print(
"""Usage: resources-diff.py FILE1 FILE2
Diff the content of two "resources.json" files and print the result to standard output."""
)
sys.exit(1)

with open(sys.argv[1]) as f:
output = json.load(f)

metrics = [label for resource in output["resources"] for label in resource]

datamap = {module["type"] + "|" + module["label"]: module for module in output["modules"]}

for arg in sys.argv[2:]:
with open(arg) as f:
input = json.load(f)

if output["resources"] != input["resources"]:
print("Error: input files describe different metrics")
sys.exit(1)

if output["total"]["label"] != input["total"]["label"]:
print("Warning: input files describe different process names")
diff_from(metrics, input["total"], output["total"])

for module in input["modules"]:
key = module["type"] + "|" + module["label"]
if key in datamap:
diff_from(metrics, module, datamap[key])
else:
datamap[key] = module
output["modules"].append(datamap[key])

json.dump(output, sys.stdout, indent=2)
sys.stdout.write("\n")
2 changes: 2 additions & 0 deletions pr_testing/run-pr-profiling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ for PROFILING_WORKFLOW in $WORKFLOWS;do
ls -l $LOCALREL/profiling/${CMSSW_VERSION}/${SCRAM_ARCH}/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/$BASENAME || true
AMP="&"
echo "<li><a href=\"https://cmssdt.cern.ch/circles/web/piechart.php?data_name=profiling${AMP}filter=${CMSSW_VERSION}${AMP}local=false${AMP}dataset=${CMSSW_VERSION}/${SCRAM_ARCH}/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/${BASENAME//.json/}${AMP}resource=time_thread${AMP}colours=default${AMP}groups=reco_PhaseII${AMP}threshold=0\">$BASENAME</a></li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
get_jenkins_artifacts profiling/${CMSSW_VERSION}/${SCRAM_ARCH}/${PROFILING_WORKFLOW}/$f ${CMSSW_VERSION}_$f
$CMS_BOT_DIR/pr_testing/resources-diff.py $f ${CMSSW_VERSION}_$f > ${CMSSW_VERSION}_diff_$f 2>$f.log
gartung marked this conversation as resolved.
Show resolved Hide resolved
done
for f in $(find $PROFILING_WORKFLOW -type f -name '*.log' -o -name '*.txt' -o -name '*.tmp' -o -name '*.heap*') ; do
d=$(dirname $f)
Expand Down
Loading