Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Issue 2400283003: [Findit] Add skeleton code for delta test script. (Closed)

Created:
4 years, 2 months ago by Sharu Jiang
Modified:
4 years, 1 month ago
CC:
chromium-reviews, infra-reviews+infra_chromium.org, inferno
Target Ref:
refs/heads/master
Project:
infra
Visibility:
Public.

Description

[Findit] Add skeleton code for delta test script. Skeleton code for delta test, the logic is the same as delta test in clusterfuzz. BUG=605369 Committed: https://chromium.googlesource.com/infra/infra/+/6cb32efbba33bf0bd0fe76a14f80a7d5172a3bb5

Patch Set 1 #

Total comments: 15

Patch Set 2 : Address comments. #

Patch Set 3 : seperate --date arguments and some renames. #

Total comments: 32

Patch Set 4 : Address comments. #

Patch Set 5 : Rebase. #

Total comments: 28

Patch Set 6 : Address comments. #

Total comments: 3

Patch Set 7 : Update doc strings. #

Patch Set 8 : Rename run-azalea to run-predator #

Patch Set 9 : Rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+541 lines, --1 lines) Patch
M appengine/findit/crash/findit_for_chromecrash.py View 1 chunk +4 lines, -0 lines 0 comments Download
M appengine/findit/crash/test/findit_for_chromecrash_test.py View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
A + appengine/findit/util_scripts/crash_queries/delta_test/__init__.py View 0 chunks +-1 lines, --1 lines 0 comments Download
A appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py View 1 2 3 4 5 6 7 1 chunk +211 lines, -0 lines 0 comments Download
A appengine/findit/util_scripts/crash_queries/delta_test/delta_util.py View 1 2 3 4 5 1 chunk +101 lines, -0 lines 0 comments Download
A appengine/findit/util_scripts/crash_queries/delta_test/run-delta-test.py View 1 2 3 4 5 6 1 chunk +160 lines, -0 lines 0 comments Download
A appengine/findit/util_scripts/crash_queries/delta_test/run-predator.py View 1 2 3 4 5 6 7 1 chunk +60 lines, -0 lines 0 comments Download

Messages

Total messages: 41 (17 generated)
Sharu Jiang
PTAL :)
4 years, 2 months ago (2016-10-08 01:04:28 UTC) #7
wrengr
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py File appengine/findit/common/cache_decorator.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py#newcode140 appengine/findit/common/cache_decorator.py:140: func (function): An abitrary function. was correct before: "arbitrary" ...
4 years, 2 months ago (2016-10-11 22:57:44 UTC) #8
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py File appengine/findit/common/cache_decorator.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py#newcode140 appengine/findit/common/cache_decorator.py:140: func (function): An abitrary function. On 2016/10/11 22:57:43, wrengr ...
4 years, 2 months ago (2016-10-12 01:18:20 UTC) #9
wrengr
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py File appengine/findit/crash/findit_for_chromecrash.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py#newcode28 appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self): On 2016/10/12 01:18:20, sharu jiang wrote: > ...
4 years, 2 months ago (2016-10-12 20:15:17 UTC) #10
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py File appengine/findit/crash/findit_for_chromecrash.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py#newcode28 appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self): On 2016/10/12 20:15:17, wrengr wrote: > On ...
4 years, 2 months ago (2016-10-12 22:58:27 UTC) #11
stgao
https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode120 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:120: # TODO(katesoina): Implement run-azalea.py. Is the TODO still valid? ...
4 years, 2 months ago (2016-10-14 01:40:40 UTC) #12
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode120 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:120: # TODO(katesoina): Implement run-azalea.py. On 2016/10/14 01:40:40, stgao wrote: ...
4 years, 2 months ago (2016-10-15 01:24:47 UTC) #14
Sharu Jiang
Ping
4 years, 2 months ago (2016-10-18 17:28:09 UTC) #15
stgao
Look good after comments are addressed. I'm fine with such util scripts having no tests, ...
4 years, 2 months ago (2016-10-20 01:40:20 UTC) #17
lijeffrey
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py File appengine/findit/common/cache_decorator.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/common/cache_decorator.py#newcode140 appengine/findit/common/cache_decorator.py:140: func (function): An abitrary function. nit: the previous spelling ...
4 years, 2 months ago (2016-10-20 15:52:15 UTC) #18
Sharu Jiang
Sure, the script has been tested. https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode121 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:121: command = 'python ...
4 years, 2 months ago (2016-10-20 22:39:07 UTC) #20
stgao
lgtm https://codereview.chromium.org/2400283003/diff/160001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/160001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode134 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:134: with open(result_path) as f: On 2016/10/20 22:39:06, sharu ...
4 years, 2 months ago (2016-10-21 01:41:39 UTC) #21
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/160001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/160001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode134 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:134: with open(result_path) as f: On 2016/10/21 01:41:39, stgao wrote: ...
4 years, 2 months ago (2016-10-21 18:45:53 UTC) #22
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/200001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/200001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode136 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:136: args = ['python', 'run-azalea.py', result_path, '--client', client_id] On 2016/10/21 ...
4 years, 2 months ago (2016-10-21 18:59:06 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2400283003/260001
4 years, 2 months ago (2016-10-21 19:05:00 UTC) #27
wrengr
https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode183 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:183: for git_hash in [git_hash1, git_hash2]: On 2016/10/15 01:24:47, sharu ...
4 years, 1 month ago (2016-10-24 17:30:36 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2400283003/300001
4 years, 1 month ago (2016-10-24 17:55:53 UTC) #33
wrengr
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py File appengine/findit/crash/findit_for_chromecrash.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py#newcode28 appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self): On 2016/10/12 22:58:27, sharu jiang wrote: > ...
4 years, 1 month ago (2016-10-24 18:09:07 UTC) #34
commit-bot: I haz the power
Committed patchset #9 (id:300001) as https://chromium.googlesource.com/infra/infra/+/6cb32efbba33bf0bd0fe76a14f80a7d5172a3bb5
4 years, 1 month ago (2016-10-24 18:10:42 UTC) #36
stgao
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py File appengine/findit/crash/findit_for_chromecrash.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py#newcode28 appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self): On 2016/10/24 18:09:06, wrengr wrote: > On ...
4 years, 1 month ago (2016-10-24 18:17:26 UTC) #37
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py File appengine/findit/crash/findit_for_chromecrash.py (right): https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/findit_for_chromecrash.py#newcode28 appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self): On 2016/10/24 18:17:26, stgao wrote: > On ...
4 years, 1 month ago (2016-10-24 18:50:20 UTC) #38
Sharu Jiang
https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py (right): https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py#newcode183 appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py:183: for git_hash in [git_hash1, git_hash2]: On 2016/10/24 17:30:36, wrengr ...
4 years, 1 month ago (2016-10-24 19:14:32 UTC) #39
wrengr
On 2016/10/24 19:14:32, sharu jiang wrote: > https://codereview.chromium.org/2400283003/diff/100001/appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py > File appengine/findit/util_scripts/crash_queries/delta_test/delta_test.py > (right): > > ...
4 years, 1 month ago (2016-10-24 20:48:08 UTC) #40
wrengr
4 years, 1 month ago (2016-10-24 21:22:57 UTC) #41
Message was sent while issue was closed.
https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/...
File appengine/findit/crash/findit_for_chromecrash.py (right):

https://codereview.chromium.org/2400283003/diff/40001/appengine/findit/crash/...
appengine/findit/crash/findit_for_chromecrash.py:28: def fields(self):
On 2016/10/24 18:50:20, sharu jiang wrote:
> On 2016/10/24 18:17:26, stgao wrote:
> > On 2016/10/24 18:09:06, wrengr wrote:
> > > On 2016/10/12 22:58:27, sharu jiang wrote:
> > > > On 2016/10/12 20:15:17, wrengr wrote:
> > > > > On 2016/10/12 01:18:20, sharu jiang wrote:
> > > > > > On 2016/10/11 22:57:43, wrengr wrote:
> > > > > > > What's the purpose of this? Since _fields is a private member of
> > > > namedtuple,
> > > > > > it
> > > > > > > make sense to leave it private so that it's clear when callers are
> > > > depending
> > > > > > on
> > > > > > > the internals of this class in ways they shouldn't be (i.e., which
> are
> > > > > > fragile).
> > > > > > 
> > > > > > This is used in delta test, and later may used to drop empty field
in
> > > > Culprit.
> > > > > 
> > > > > I still don't understand. Why can't delta use _fields directly? If all
> we
> > > need
> > > > > is to compare one Culprit to another, then we should provide the
> > appropriate
> > > > > comparison functions rather than having client code rely on internals.
> > > > > 
> > > > > This class serves as the API for the library to pass information to
the
> > > > > application; thus, it needs to serve the purposes of the library first
> and
> > > > > foremost. I assume you want to drop fields because of serializing to
> JSON,
> > > but
> > > > > that's an application concern not a library concern. The library
> shouldn't
> > > > have
> > > > > to care at all about how the application decides to serialize things.
> > > > 
> > > > shouldn't _fields supposed to be private and not used directly? This is
> not
> > > for
> > > > comparison. 
> > > > 
> > > > For "that's an application concern not a library concern", in this case,
I
> > > think
> > > > the serialization part should be in clients' code (findit_for_*) instead
> of
> > > > Culprit, to do that, the "fields" may still be needed.
> > > 
> > > (FWIW, whenever I talk about "client code" or "clients (of X)", I mean any
> > code
> > > that uses X; as distinct from "users", i.e. humans, who use X. I do not
> > > specifically mean the AppEngine applications. I believe this has been a
> source
> > > of confusion, so I will avoid the word "client" below.)
> > > 
> > > If we're going to be turning Culprit objects into anonymous dicts, then
that
> > > should be done in/by the Culprit class itself. That way, code using the
> class
> > > isn't forced to muck around with the innards of the class— thereby
becoming
> > > fragile to changes in/to the class. If code using the class can simply
call
> a
> > > ToDict method (or similar) and expect that the method will return some
sort
> of
> > > JSON-serializable dictionary, then the code using the class becomes
> > independent
> > > of how the class is implemented; which in turn frees us up to change the
> > > internal representation of Culprit objects without needing to change all
the
> > > code that uses the Culprit class.
> > > 
> > > If we're serializing Culprit objects into JSON, then we surely want to
> > serialize
> > > them in the same way regardless of which AppEngine application happens to
be
> > > working with that serialized format. Thus, serialization is not
> > > application-specific, so it should not be implemented by/in application
> code.
> > It
> > > is much less fragile for application code to assume that objects already
> know
> > > how to serialize *themselves*, and then just ask them to do so (by calling
> the
> > > ToDict method) whenever necessary. Yes, in terms of execution control
flow,
> > the
> > > application code is where the request for serialization is made, but that
> > > doesn't mean that's where the implementation of serialization should live.
> > 
> > +1 for Wren's suggestion here
> 
> I agree on what you said about the serializing culprit object into JSON,
however
> I still have one question, should I just use _fields directly in delta test?
> Shouldn't _smth be private?

Things with a single underscore are generally "protected" in the Java
terminology, whereas things with two underscores are "private" in the Java sense
(though double underscore is also used to refer to builtins, so there's some
confusion here. Also, I don't know whether Google follows the one- vs
two-underscore tradition of the Python community at large).

As far as the Delta class goes, there are two salient approaches to take. We can
either make the class specific to being a delta of Culprit objects, or we can
try to make it generic for some large class of values (e.g., JSON-serializable
things).

If we make it Culprit-specific, then the Delta class is a "friend" in the C++
terminology, so the fact that it accesses the internals of the Culprit class
isn't unexpected. Whenever we update the Culprit class we'll have to make sure
Delta is kept in sync; but if Delta is the only "friend" of Culprit, then it's
cleaner to have Delta depend directly on the innards of Culprit rather than
setting up a bunch of boilerplate for other potential "friend" classes which
don't actually exist.

On the other hand, if we want Delta to be generic over a large class of values,
then it makes more sense IMO to define Delta to operate over dict (and list,
set, etc; i.e., Python built-in types, or JSON-serializable types, or something
similar). In this case we'd call ToDict before computing the delta, and so Delta
doesn't need to know what fields the Culprit object itself has (it can query the
dict for its keys). Of course, if we only ever use Delta for the deltas of
Culprits, then being generic over all dicts(etc) may make things unnecessarily
complicated. (I'm guessing in our case it wouldn't actually be too complicated,
but the concern is still worth mentioning.)

(A third option is to be generic over types which provide certain helper
functions. This would allow avoiding the conversion to Dict, while still letting
the Delta class remain agnostic to the internals of the classes it operates
over. The idea here is to generalize the notion of "delta" or "equality" to the
notion of "zipping" two structures together. My MSE thesis was on how to do this
cleanly and efficiently, so if we want to pursue this path I already know how to
go about it; but that may be like using a cannon as a flyswatter.)

Powered by Google App Engine
This is Rietveld 408576698