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)
Testing
General
Tracking
(firefox42 fixed)
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: jgriffin, Assigned: jgriffin)
References
Details
Attachments
(3 files, 4 obsolete files)
1000.63 KB,
patch
|
ahal
:
review+
|
Details | Diff | Splinter Review |
4.31 KB,
patch
|
ahal
:
review+
|
Details | Diff | Splinter Review |
1012 bytes,
patch
|
ahal
:
review+
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•10 years ago
|
||
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.
Assignee | ||
Comment 2•10 years ago
|
||
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.
Assignee | ||
Comment 3•10 years ago
|
||
New runtimes for all jobs in new format.
Assignee | ||
Updated•10 years ago
|
Attachment #8630593 -
Flags: review?(ahalberstadt)
Assignee | ||
Comment 4•10 years ago
|
||
Oops, missed a file in the last patch
Attachment #8631099 -
Flags: review?(ahalberstadt)
Assignee | ||
Updated•10 years ago
|
Attachment #8630593 -
Attachment is obsolete: true
Attachment #8630593 -
Flags: review?(ahalberstadt)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8631100 -
Flags: review?(ahalberstadt)
Assignee | ||
Updated•10 years ago
|
Attachment #8631098 -
Attachment is obsolete: true
Comment 6•10 years ago
|
||
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 7•10 years ago
|
||
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?
Assignee | ||
Comment 8•10 years ago
|
||
(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.
Updated•10 years ago
|
Attachment #8631100 -
Flags: review?(ahalberstadt) → review+
Comment 9•10 years ago
|
||
you may consider json.dumps(... sort_keys=True) for ordered output
Assignee | ||
Comment 10•10 years ago
|
||
(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 11•10 years ago
|
||
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-
Assignee | ||
Comment 12•10 years ago
|
||
Attachment #8631293 -
Flags: review?(ahalberstadt)
Assignee | ||
Updated•10 years ago
|
Attachment #8631100 -
Attachment is obsolete: true
Assignee | ||
Comment 13•10 years ago
|
||
And the script patch, in case you want to review again.
Attachment #8631295 -
Flags: review?(ahalberstadt)
Assignee | ||
Updated•10 years ago
|
Attachment #8631099 -
Attachment is obsolete: true
Updated•10 years ago
|
Attachment #8631293 -
Flags: review?(ahalberstadt) → review+
Updated•10 years ago
|
Attachment #8631295 -
Flags: review?(ahalberstadt) → review+
Comment 14•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Assignee | ||
Comment 16•10 years ago
|
||
Still need to land the actual runtimes changes, which were backed out.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 17•10 years ago
|
||
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 18•10 years ago
|
||
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+
Comment 19•10 years ago
|
||
Comment 20•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6376e51185e8
https://hg.mozilla.org/mozilla-central/rev/9b7107f5d99e
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•