Closed Bug 1179292 Opened 10 years ago Closed 10 years ago

Write new runtime data only if sufficiently different from the existing values

Categories

(Testing :: General, defect)

defect
Not set
normal

Tracking

(firefox42 fixed)

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: jgriffin, Assigned: jgriffin)

References

Details

Attachments

(3 files, 4 obsolete files)

I recently landed a script to generate runtime JSON files in bug 1173039. However, the runtime files it generates are relatively large, and will completely change each time the script is run. It might be better to write the files using pretty print, and to only change values that have drifted from the current value by some percentage. This would reduce a lot of low-value churn, and also make differences easy to spot.
In order to provide sensible diffs, I'll also need to change the format of the runtimes JSON files. The current files use a big dict, with non-deterministic test ordering; I'll switch to using a list, so ordering can be preserved.
This uses a new format for runtime files that preserves test ordering, so we can write only values that have changed significantly. ActiveData is unhappy atm; I'll upload new runtimes files when that's back up.
Attached patch Update runtimes files, (obsolete) — Splinter Review
New runtimes for all jobs in new format.
Attachment #8630593 - Flags: review?(ahalberstadt)
Oops, missed a file in the last patch
Attachment #8631099 - Flags: review?(ahalberstadt)
Attachment #8630593 - Attachment is obsolete: true
Attachment #8630593 - Flags: review?(ahalberstadt)
Attached patch Update runtimes files, (obsolete) — Splinter Review
Attachment #8631100 - Flags: review?(ahalberstadt)
Attachment #8631098 - Attachment is obsolete: true
Comment on attachment 8631099 [details] [diff] [review] Write new runtime data only if changed, Review of attachment 8631099 [details] [diff] [review]: ----------------------------------------------------------------- I'm a bit on the fence about this, we're trading accuracy and file size (which is a limiting factor on accuracy) for readable diffs. Readable diffs are definitely nice to have, but are they necessary? I won't stand in the way though. We can at least try it out and see how it works. r+ with comments addressed. ::: testing/mozbase/manifestparser/manifestparser/filters.py @@ +280,5 @@ > # runtimes file will be assigned `default_runtime`. > self.runtimes = defaultdict(lambda: default_runtime) > + if isinstance(runtimes, list): > + for testcase in runtimes: > + self.runtimes[testcase[0]] = testcase[1] self.runtimes.update(dict(runtimes)) ::: testing/runtimes/writeruntimes.py @@ +51,5 @@ > + in_path = os.path.join(indir, dirname) > + outfilename = os.path.join(out_path, "%s.runtimes.json" % suite) > + infilename = os.path.join(in_path, "%s.runtimes.json" % suite) > + if not os.path.exists(out_path): > + os.mkdir(out_path) This should be os.makedirs() in case there's more than one that needs to be created. @@ +63,5 @@ > + # convert to dict for easy manipulation > + runtimes = {} > + for testcase_data in indata: > + runtimes[testcase_data[0]] = testcase_data[1] > + indata = runtimes indata = dict(indata) @@ +77,4 @@ > > # split the durations into two groups; excluded and specified > ommitted = [] > + specified = indata if indata else {} Might as well just make indata default to {} above and not create a new variable. @@ +89,5 @@ > + elif duration >= threshold and test != "automation.py": > + original = specified.get(test, 0) > + if not original or abs(original - duration) > (original/20): > + # only write new data if it's > 20% different than original > + specified[test] = duration 20% seems kind of high, but we can tweak it later if needed. @@ +115,2 @@ > with open(outfilename, 'w') as f: > + f.write(json.dumps(results, indent=2)) This will increase the file sizes a bit, probably not too bad though.
Attachment #8631099 - Flags: review?(ahalberstadt) → review+
Comment on attachment 8631100 [details] [diff] [review] Update runtimes files, Review of attachment 8631100 [details] [diff] [review]: ----------------------------------------------------------------- Any idea why there's whitespace after each line? Also how much bigger does this make the files?
(In reply to Andrew Halberstadt [:ahal] from comment #7) > Comment on attachment 8631100 [details] [diff] [review] > Update runtimes files, > > Review of attachment 8631100 [details] [diff] [review]: > ----------------------------------------------------------------- > > Any idea why there's whitespace after each line? Also how much bigger does > this make the files? That seems to be what json.dumps() does by default (at least with indent=2). > @@ +115,2 @@ > > with open(outfilename, 'w') as f: > > + f.write(json.dumps(results, indent=2)) > > This will increase the file sizes a bit, probably not too bad though. So the real reason to do this is not for readability, but so when we rev the files the next time, only the runtimes that have changed more than 20% get modified, and most of the file should remain unchanged (unless there's been across-the-board deterioration in runtimes). We can't do that if we emit the entire JSON on one line. Theoretically, this should reduce the size of future diffs.
Attachment #8631100 - Flags: review?(ahalberstadt) → review+
you may consider json.dumps(... sort_keys=True) for ordered output
(In reply to Kyle Lahnakoski [:ekyle] from comment #9) > you may consider json.dumps(... sort_keys=True) for ordered output Nice, I didn't know about that trick. I can simplify this code a bit more then.
Comment on attachment 8631100 [details] [diff] [review] Update runtimes files, Review of attachment 8631100 [details] [diff] [review]: ----------------------------------------------------------------- Nice, I didn't know about sort_keys either. Yeah, a dict is much nicer to look at than a list of lists.
Attachment #8631100 - Flags: review+ → review-
Attached patch Update runtimes,Splinter Review
Attachment #8631293 - Flags: review?(ahalberstadt)
Attachment #8631100 - Attachment is obsolete: true
And the script patch, in case you want to review again.
Attachment #8631295 - Flags: review?(ahalberstadt)
Attachment #8631099 - Attachment is obsolete: true
Attachment #8631293 - Flags: review?(ahalberstadt) → review+
Attachment #8631295 - Flags: review?(ahalberstadt) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Still need to land the actual runtimes changes, which were backed out.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Verifies this fixes the problem I had updating runtimes, with a green try run to show: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8043b90096f1
Attachment #8633786 - Flags: review?(ahalberstadt)
Comment on attachment 8633786 [details] [diff] [review] Make mozinfo recognize linux64-asan as a distinct platform, Review of attachment 8633786 [details] [diff] [review]: ----------------------------------------------------------------- Thanks, lgtm! ::: python/mozbuild/mozbuild/mozinfo.py @@ +108,5 @@ > if d['buildapp'] == 'mulet': > p = '{}-mulet'.format(p) > + > + if d['asan']: > + p += "-asan" nit: '{}-asan'.format(p) to be consistent with above
Attachment #8633786 - Flags: review?(ahalberstadt) → review+
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
Depends on: 1184930
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: