Skip to content

Commit b626c64

Browse files
authored
Pcf 634 new stats analysis (mozilla#8944)
* rebased in master * update serializer, handle review comments * update serializer to remove duplicates * update serializer, results * remove flatten * fix serializer * remove unused serializer * add test and fix code to handle errors and exceptions * smooth out minor issues * fix spacing * handle undeclared variable * minor stats grouping * fix variables * fix more changes need reasignment * update functions * update variables names to not be confusing * clean up seralizer, fixed bugs * fix minor text interpretation cleanup * fix endpoint shape and handle nan values * minor restructure * remove print statements * swap back comments * remove redundant values * add ks_p value * use python 3.10 * Delete -u * remove google proxy file * add google cloud proxy file to gitignore * fixing dev.txt compile issue * add the same scipy and numpy as in current treeherder common.txt * remove specifications * Update dev.txt remove changes to numpy and scipy * Update dev.txt Remove kdepy and cliffs-delta from dev * Update dev.in Remove kdepy and cliffsdelta from dev
1 parent e65d87a commit b626c64

File tree

8 files changed

+1207
-59
lines changed

8 files changed

+1207
-59
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ docs.egg-info
5555
mcp-servers/
5656
.claude
5757
CLAUDE.md
58+
59+
#Cloud SQL Auth Proxy
60+
cloud-sql-proxy

requirements/common.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ inflection==0.5.1
5252

5353
# Change detection tooling
5454
mozdetect==0.0.9
55+
56+
# Statistical methods for performance analysis
57+
cliffs-delta==1.0.0
58+
KDEpy==1.1.12

requirements/common.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ click-repl==0.3.0 \
377377
--hash=sha256:17849c23dba3d667247dc4defe1757fff98694e90fe37474f3feebb69ced26a9 \
378378
--hash=sha256:fb7e06deb8da8de86180a33a9da97ac316751c094c6899382da7feeeeb51b812
379379
# via celery
380+
cliffs-delta==1.0.0 \
381+
--hash=sha256:2ec087e8254861204aab79e222b2e863a79f3d6f35d69e14f8b188fb6c5b048f \
382+
--hash=sha256:909595ceaf051390fc82e662fdefb5ccca2cd3f49bb23531d903a53ae9f07e43
383+
# via -r requirements/common.in
380384
crashtest==0.4.1 \
381385
--hash=sha256:80d7b1f316ebfbd429f648076d6275c877ba30ba48979de4191714a75266f0ce \
382386
--hash=sha256:8d23eac5fa660409f57472e3851dab7ac18aba459a8d19cbbba86d3d5aecd2a5
@@ -692,6 +696,45 @@ jsonschema-specifications==2023.12.1 \
692696
--hash=sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc \
693697
--hash=sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c
694698
# via jsonschema
699+
kdepy==1.1.12 \
700+
--hash=sha256:0834ff21a74fbd85ee748a8e9ff0edc886e0dd2c9a7011d4f69a943029a61e3d \
701+
--hash=sha256:0fe3784dd2bfaa4d6278f2fcc5e0140dae0b643f0ad9b15c5bed35d3e368c7a4 \
702+
--hash=sha256:1089bbdc007c0495556d6409f7c9235abfc79071c7147781ca6f644aad4e5eb4 \
703+
--hash=sha256:2b00d31897ce5c88362149a5651048e594a5c0f7db7b85f0ace7767604bf004f \
704+
--hash=sha256:34ba64f462127e2dc6a1de9ae4a742785cc97acf9fc9922a1378e3087e19c494 \
705+
--hash=sha256:35bdfc7f046014b6bdf83d6d14b2adbd8f08c1d3b83d63a91d74970dc8085972 \
706+
--hash=sha256:3bd8bff8b5d18ccc253c22dcfa6ab1aa8098df62fbb8899fa6d25579f0ff0b8f \
707+
--hash=sha256:3d9a4ffcf155f4fa7e45e3ff33a8436e16a8e405fa8bd610803a697dc0dd6392 \
708+
--hash=sha256:4f7deb921bbe944247bf8c4d2b2078dd67be8130d3be4a32f947766daed60095 \
709+
--hash=sha256:562d1d7a63e61209a9c2852e0de67090abe90def2e47deaf7d4bd935d36ba67b \
710+
--hash=sha256:64a837b0c552d681ef7bdfa5b0e18bbbc66e3d5dac7ad7fc9919c881e0f16498 \
711+
--hash=sha256:6e22ea5a38278e86be531e87da07026a7aaa0450fdf7b8f6e8813ef9c04e5de0 \
712+
--hash=sha256:6e5d59f51dd1797b7729e09993986f2920f45e62609c3704c5946aa5f05171f1 \
713+
--hash=sha256:78f319dbaafe44d8583e5f1ff3dcff14124d9718ff5bdf5b38128180fbbe4c06 \
714+
--hash=sha256:878cfcfefa32dfd464b0a87b2ecc90239ade075528285ba8893b3c559dc6e132 \
715+
--hash=sha256:8f26a6a8deeed57a0f52a35fbf0033acedb5935c3a9ae028209a3758bc45d86e \
716+
--hash=sha256:8fd2a55b71e07aac63b8c8614a8f3e44268eabb9d4282e7bb78a11e840b20268 \
717+
--hash=sha256:94b555ec63d953ea3fb3b5a00fe7e7efadd7881cc6fe817551df913d38796de2 \
718+
--hash=sha256:9e5115b65531d36ab48b9e9dd952221bb7789999f95c7b44564367f885f5ade5 \
719+
--hash=sha256:aaa900fbf3fe66bb30a6e1069bd90940f00a02abc15fd6217b63df2fd07204a5 \
720+
--hash=sha256:aea3587396e458b53c63c8a070505bcd7fd7e60756f99d3390ee344e22d08f41 \
721+
--hash=sha256:b0cf62dc5a255075a5813965a58ac16b8b1144d538760bccf06ac529720db61e \
722+
--hash=sha256:b2f04a95a6d706ab6fcfba104c49b97e4b6ade40212bcface291e4ab6747eed0 \
723+
--hash=sha256:c5fdc115c212df1a622997a9d8ff9c1bae8179562cc8f2e9710adced96abfd20 \
724+
--hash=sha256:c7c5b091e3034d026bcf718a5efecbe2a1eee5100d1328621387d7fadb164dd8 \
725+
--hash=sha256:d3839f95cfd45084901a0d9c98b4ac83a5eb57449a6be7004d422cf29d9eedff \
726+
--hash=sha256:df4335cac2eb387265ec93911a1fcf6520d5a6d2a7762cb00e134e6c3beae18d \
727+
--hash=sha256:e0c5a22798499154e1aef0378fbeb04f8832dd74d05246fcdbb5438e3c4424e1 \
728+
--hash=sha256:e1928bf44c9ee7f78239461d5670e8515f5d4a201eff5622547967c7c20fa82d \
729+
--hash=sha256:e62facb46ea6d6eff92a0f8ad054bdf4b5a84ec66444b5cae9d5af1f828b07b7 \
730+
--hash=sha256:e9ffa424aa96988a9b7f0154168c17cf64cba46ad691a556e77e51cae7992864 \
731+
--hash=sha256:eb3a62abc5a982f5a30ec0a3560e2f9cbd3d19bc4f721b2ebbde06949d52af61 \
732+
--hash=sha256:f3fccc80e33e291752d2cee7686628c19f066806b9b3f62d7d007c09c252c8fc \
733+
--hash=sha256:f64b740a61f60076630cfcdd1ff011c70d1ce1a7ceab05b14763d95163140e46 \
734+
--hash=sha256:f6a98453558eb39fe093601dea19769ebb13e371e11a212be516b27b4f059a55 \
735+
--hash=sha256:ff27b711d3e914da68a80bdd8044d7992a9a48be090378be246f6b39d91b6e46 \
736+
--hash=sha256:ff6a4db7b40a63b9accde48ebfd25e664138f37eda56ad1be34fe37f60ce3d84
737+
# via -r requirements/common.in
695738
kombu==5.5.2 \
696739
--hash=sha256:2dd27ec84fd843a4e0a7187424313f87514b344812cb98c25daddafbb6a7ff0e \
697740
--hash=sha256:40f3674ed19603b8a771b6c74de126dbf8879755a0337caac6602faa82d539cd
@@ -1048,6 +1091,7 @@ numpy==1.26.4 \
10481091
--hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f
10491092
# via
10501093
# db-dtypes
1094+
# kdepy
10511095
# moz-measure-noise
10521096
# pandas
10531097
# scipy
@@ -1781,6 +1825,7 @@ scipy==1.15.1 \
17811825
--hash=sha256:f735bc41bd1c792c96bc426dece66c8723283695f02df61dcc4d0a707a42fc54 \
17821826
--hash=sha256:f82fcf4e5b377f819542fbc8541f7b5fbcf1c0017d0df0bc22c781bf60abc4d8
17831827
# via
1828+
# kdepy
17841829
# moz-measure-noise
17851830
# mozdetect
17861831
simplejson==3.20.2 \

tests/perf/test_stats.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# from treeherder.model.models import Push
2+
from treeherder.perf.stats import interpret_silverman_kde
3+
4+
# p-value threshold to use throughout
5+
PVALUE_THRESHOLD = 0.05
6+
7+
# def test_split_per_mode():
8+
9+
10+
def test_interpret_silverman_kde():
11+
mock_base = [2.74]
12+
mock_new = [2.65]
13+
lower_is_better = False
14+
(
15+
silverman_kde,
16+
is_regression,
17+
is_improvement,
18+
more_runs_are_needed,
19+
warning_msgs,
20+
performance_intepretation,
21+
) = interpret_silverman_kde(mock_base, mock_new, lower_is_better)
22+
assert silverman_kde["bandwidth"] == "Silverman"
23+
assert warning_msgs == []

tests/webapp/api/test_perfcompare_api.py

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,3 +1044,114 @@ def get_expected(
10441044
new_sig.has_subtests if new_sig else False
10451045
)
10461046
return response
1047+
1048+
1049+
def test_perfcompare_results_with_mann_witney_u_against_no_base(
1050+
client,
1051+
create_signature,
1052+
create_perf_datum,
1053+
test_perf_signature,
1054+
test_repository,
1055+
try_repository,
1056+
eleven_jobs_stored,
1057+
test_perfcomp_push,
1058+
test_perfcomp_push_2,
1059+
test_linux_platform,
1060+
test_option_collection,
1061+
):
1062+
perf_jobs = Job.objects.filter(pk__in=range(1, 11)).order_by("push__time").all()
1063+
1064+
test_perfcomp_push.time = FOUR_DAYS_AGO
1065+
test_perfcomp_push.repository = try_repository
1066+
test_perfcomp_push.save()
1067+
test_perfcomp_push_2.time = datetime.datetime.now()
1068+
test_perfcomp_push_2.save()
1069+
1070+
suite = "a11yr"
1071+
test = "dhtml.html"
1072+
extra_options = "e10s fission stylo webrender"
1073+
measurement_unit = "ms"
1074+
base_application = "firefox"
1075+
new_application = "firefox"
1076+
1077+
base_sig = create_signature(
1078+
signature_hash=(20 * "t1"),
1079+
extra_options=extra_options,
1080+
platform=test_linux_platform,
1081+
measurement_unit=measurement_unit,
1082+
suite=suite,
1083+
test=test,
1084+
test_perf_signature=test_perf_signature,
1085+
repository=try_repository,
1086+
application=base_application,
1087+
)
1088+
1089+
base_perf_data_values = [32.4]
1090+
new_perf_data_values = [40.2]
1091+
1092+
job = perf_jobs[0]
1093+
job.push = test_perfcomp_push
1094+
job.save()
1095+
perf_datum = PerformanceDatum.objects.create(
1096+
value=base_perf_data_values[0],
1097+
push_timestamp=job.push.time,
1098+
job=job,
1099+
push=job.push,
1100+
repository=try_repository,
1101+
signature=base_sig,
1102+
)
1103+
perf_datum.push.time = job.push.time
1104+
perf_datum.push.save()
1105+
1106+
new_sig = create_signature(
1107+
signature_hash=(20 * "t2"),
1108+
extra_options=extra_options,
1109+
platform=test_linux_platform,
1110+
measurement_unit=measurement_unit,
1111+
suite=suite,
1112+
test=test,
1113+
test_perf_signature=test_perf_signature,
1114+
repository=test_repository,
1115+
application=new_application,
1116+
)
1117+
1118+
job = perf_jobs[1]
1119+
job.push = test_perfcomp_push_2
1120+
job.save()
1121+
perf_datum = PerformanceDatum.objects.create(
1122+
value=new_perf_data_values[0],
1123+
push_timestamp=job.push.time,
1124+
job=job,
1125+
push=job.push,
1126+
repository=job.repository,
1127+
signature=new_sig,
1128+
)
1129+
perf_datum.push.time = job.push.time
1130+
perf_datum.push.save()
1131+
1132+
response = get_expected(
1133+
base_sig,
1134+
new_sig,
1135+
extra_options,
1136+
test_option_collection,
1137+
new_perf_data_values,
1138+
base_perf_data_values,
1139+
)
1140+
1141+
query_params = (
1142+
"?base_repository={}&new_repository={}&new_revision={}&framework={"
1143+
"}&interval={}&no_subtests=true&test_version={}".format(
1144+
try_repository.name,
1145+
test_repository.name,
1146+
test_perfcomp_push_2.revision,
1147+
test_perf_signature.framework_id,
1148+
604800, # seven days in milliseconds
1149+
"mann-whitney-u",
1150+
)
1151+
)
1152+
1153+
response = client.get(reverse("perfcompare-results") + query_params)
1154+
1155+
assert response.status_code == 200
1156+
assert response.json()[0]["base_parent_signature"] is None
1157+
assert response.json()[0]["new_parent_signature"] is None

0 commit comments

Comments
 (0)