Closed
Bug 1131790
Opened 9 years ago
Closed 9 years ago
Move clobbers into a runner task so that they can be batched
Categories
(Release Engineering :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mrrrgn, Assigned: mrrrgn)
References
Details
Attachments
(3 files, 5 obsolete files)
45 bytes,
text/x-github-pull-request
|
Callek
:
review+
|
Details | Review |
24.68 KB,
patch
|
rail
:
review+
mrrrgn
:
checked-in+
|
Details | Diff | Splinter Review |
6.95 KB,
patch
|
rail
:
review+
|
Details | Diff | Splinter Review |
Right now, clobbers happen during a buildbot job. This isn't ideal, since it loses us the ability to batch clobbers. The runner task should, using only the system's hostname, pull down a list of requested clobbers and act on them. This will likely require adding new RelEngAPI-Clobberer endpoints.
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → winter2718
Assignee | ||
Comment 1•9 years ago
|
||
This allows clobberer to work with a new 'lastclobber/all' endpoint and moves support for the old 'lastclobber' endpoint to a legacy mode.
Attachment #8567992 -
Flags: review?(catlee)
Assignee | ||
Updated•9 years ago
|
Attachment #8567992 -
Flags: review?(catlee) → review?(rail)
Assignee | ||
Updated•9 years ago
|
Attachment #8567992 -
Attachment is obsolete: true
Attachment #8567992 -
Flags: review?(rail)
Comment 3•9 years ago
|
||
Comment on attachment 8569268 [details] [diff] [review] clobberer.client.diff Review of attachment 8569268 [details] [diff] [review]: ----------------------------------------------------------------- ::: clobberer/clobberer.py @@ +55,5 @@ > + higher than --build. > + >>>sanitize_builddir('../../abc') > + //abc > + """ > + return builddir.replace('.', '') Hmm, I think this will hurt us with directories with legit dots. sanitize_builddir("a.directory") would be "adirectory". Maybe just: * construct the final absolute path (os.path.join + abspath) * normalize it (normpath + realpath) * compare to basedir (commonprefix?) to figure out if it's under it * fail if it's not Or just get rid of it and file a separate bug. ::: clobberer/test_clobberer.py @@ +80,5 @@ > + fake_data_null = {'result': []} > + fake_data_json_str = json.dumps(fake_data_null) > + urllib2_mock = mock.Mock() > + urllib2_mock.read.side_effect = [fake_data_json_str] > + mock_urlopen.return_value = urllib2_mock I think you can do something like mock_urlopen.return_value.read.return_value = [fake_data_json_str] Can you try it to get rid of the boilerplate? @@ +95,5 @@ > > + fake_data_str = lastclobber_fmt.format(builddir, timestamp, who) > + urllib2_mock = mock.Mock() > + urllib2_mock.read.side_effect = [fake_data_str] > + mock_urlopen.return_value = urllib2_mock the same here @@ +124,5 @@ > # make sure it can handle no data > + fake_data_str = "" > + urllib2_mock = mock.Mock() > + urllib2_mock.read.side_effect = [fake_data_str] > + mock_urlopen.return_value = urllib2_mock and here
Attachment #8569268 -
Flags: review?(rail) → review-
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Rail Aliiev [:rail] from comment #3) > Comment on attachment 8569268 [details] [diff] [review] > clobberer.client.diff > > Review of attachment 8569268 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: clobberer/clobberer.py > @@ +55,5 @@ > > + higher than --build. > > + >>>sanitize_builddir('../../abc') > > + //abc > > + """ > > + return builddir.replace('.', '') > > Hmm, I think this will hurt us with directories with legit dots. > sanitize_builddir("a.directory") would be "adirectory". > > Maybe just: > * construct the final absolute path (os.path.join + abspath) > * normalize it (normpath + realpath) > * compare to basedir (commonprefix?) to figure out if it's under it > * fail if it's not > > Or just get rid of it and file a separate bug. > > ::: clobberer/test_clobberer.py > @@ +80,5 @@ > > + fake_data_null = {'result': []} > > + fake_data_json_str = json.dumps(fake_data_null) > > + urllib2_mock = mock.Mock() > > + urllib2_mock.read.side_effect = [fake_data_json_str] > > + mock_urlopen.return_value = urllib2_mock > > I think you can do something like > > mock_urlopen.return_value.read.return_value = [fake_data_json_str] > > Can you try it to get rid of the boilerplate? > > @@ +95,5 @@ > > > > + fake_data_str = lastclobber_fmt.format(builddir, timestamp, who) > > + urllib2_mock = mock.Mock() > > + urllib2_mock.read.side_effect = [fake_data_str] > > + mock_urlopen.return_value = urllib2_mock > > the same here > > @@ +124,5 @@ > > # make sure it can handle no data > > + fake_data_str = "" > > + urllib2_mock = mock.Mock() > > + urllib2_mock.read.side_effect = [fake_data_str] > > + mock_urlopen.return_value = urllib2_mock > > and here causes: vagrant@vagrant-ubuntu-trusty-64:/tmp/tools/clobberer$ nosetests ..E...... ====================================================================== ERROR: test_get_clobber_times (test_clobberer.TestClobbererClient) ---------------------------------------------------------------------- Traceback (most recent call last): File "build/bdist.linux-x86_64/egg/mock.py", line 1201, in patched return func(*args, **keywargs) File "/tmp/tools/clobberer/test_clobberer.py", line 91, in test_get_clobber_times clobber_dates_return = get_clobber_times('clobberer/lastclobber/all') File "/tmp/tools/clobberer/clobberer.py", line 169, in get_clobber_times data = urllib2.urlopen(clobber_url, timeout=30).read() AttributeError: 'list' object has no attribute 'read' -------------------- >> begin captured logging << -------------------- root: INFO: Checking clobber URL: clobberer/lastclobber/all --------------------- >> end captured logging << ---------------------
Assignee | ||
Comment 5•9 years ago
|
||
So, this refactors the tests to remove a good deal of boiler plate; though it still uses the mock "side effect" method. I also went with catlee's safe_join method, stolen from: https://github.com/mozilla/build-mar/blob/master/mardor/utils.py#L11
Attachment #8569268 -
Attachment is obsolete: true
Attachment #8569393 -
Flags: review?(rail)
Comment 6•9 years ago
|
||
Comment on attachment 8569393 [details] [diff] [review] clobberer.client.diff Ship it! _~ _~ )_)_~ )_))_))_) _!__!__!_ \______t/ ~~~~~~~~~~~~~
Attachment #8569393 -
Flags: review?(rail) → review+
Assignee | ||
Comment 7•9 years ago
|
||
Attachment #8570026 -
Flags: review?(bugspam.Callek)
Updated•9 years ago
|
Attachment #8570026 -
Flags: review?(bugspam.Callek) → review+
Assignee | ||
Comment 8•9 years ago
|
||
So, the lack of argparse (python2.6) turned into whack-a-mole. I put out a bug to explicitly call clobberer with python2.7 in our build scripts; but for the sake of sanity I reverted this version to argopts. It's been tested on python2.6 and should not cause us problems.
Attachment #8569393 -
Attachment is obsolete: true
Attachment #8570595 -
Flags: review?(rail)
Comment 9•9 years ago
|
||
Comment on attachment 8570595 [details] [diff] [review] clobberer.client.diff The interdiff looks good to me
Attachment #8570595 -
Flags: review?(rail) → review+
Assignee | ||
Comment 10•9 years ago
|
||
Assignee | ||
Comment 11•9 years ago
|
||
Tested and working. The new client was checked in very early this morning as well.
Attachment #8570663 -
Attachment is obsolete: true
Attachment #8571651 -
Flags: review?(rail)
Assignee | ||
Updated•9 years ago
|
Attachment #8570595 -
Flags: checked-in+
Comment 12•9 years ago
|
||
Comment on attachment 8571651 [details] [diff] [review] clobber.runner.diff Review of attachment 8571651 [details] [diff] [review]: ----------------------------------------------------------------- ::: manifests/moco-config.pp @@ +236,5 @@ > $runner_env_hg_share_base_dir = '/builds/hg-shared' > $runner_env_git_share_base_dir = '/builds/git-shared' > > $runner_buildbot_slave_dir = '/builds/slave' > + $runner_clobberer_url = 'https://api.pub.build.mozilla.org/clobberer/lastclobber/all' Looks like we are missing all $runner_* configs in http://hg.mozilla.org/build/puppet/file/3b376bb94123/modules/config/manifests/base.pp Can you add them, so other consumers of PuppetAgain can use some sane default values? moco-config.pp overrides the values from modules/config/manifests/base.pp. Otherwise the patch looks good to me.
Attachment #8571651 -
Flags: review?(rail) → review-
Assignee | ||
Comment 13•9 years ago
|
||
Comment on attachment 8571651 [details] [diff] [review] clobber.runner.diff On it, thanks! :)
Assignee | ||
Comment 14•9 years ago
|
||
Attachment #8571651 -
Attachment is obsolete: true
Attachment #8571938 -
Flags: review?(rail)
Updated•9 years ago
|
Attachment #8571938 -
Flags: review?(rail) → review+
Assignee | ||
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: Tools → General
You need to log in
before you can comment on or make changes to this bug.
Description
•