Closed
Bug 768123
Opened 12 years ago
Closed 12 years ago
server- and client-side resiliency for tooltool
Categories
(Release Engineering :: General, defect)
Release Engineering
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dustin, Assigned: sbruno)
References
Details
(Whiteboard: [reit])
Attachments
(5 files, 5 obsolete files)
(deleted),
patch
|
rail
:
review+
rail
:
checked-in+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
rail
:
review+
rail
:
checked-in+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
rail
:
review+
rail
:
checked-in+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
rail
:
review+
rail
:
checked-in+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
rail
:
review+
rail
:
checked-in+
|
Details | Diff | Splinter Review |
We should
* make the tooltool client able to query multiple sources for its builds, in case one is down
* build multiple sources for it to query (maybe just relengweb2)
Reporter | ||
Updated•12 years ago
|
Assignee: server-ops-releng → dustin
Reporter | ||
Comment 1•12 years ago
|
||
The second part of this is the relops part, and is in progress with bug 774354.
The first part is a releng task. See also, bug 768879.
Once the script is modified, we can build a way for it to access the webheads directly when the zeus-backed access method (http://tooltool.*.build.mozilla.org) fails (so punt the bug back to me for that).
Assignee: dustin → nobody
Component: Server Operations: RelEng → Release Engineering: Developer Tools
QA Contact: arich → hwine
Updated•12 years ago
|
Updated•12 years ago
|
Assignee: nobody → sbruno
Assignee | ||
Comment 2•12 years ago
|
||
Progress can be tracked here: https://github.com/simone-mozilla/tooltool/tree/bug_768123
Some more testing is needed before uploading a patch.
The proposed implementation is designed to be fully backward compatible with the previous version of tooltool, which supported a single url.
More than one URLs can now be provided as input to tooltool via command line using multiple --url arguments, e.g.:
--url <url1> --url <url2> --url <url3>
If no --url argument is provided via command line, urls are read in the config file, where alternative urls can be specified as in the following example:
base_url=<default url>
alternative_base_url_1=<first alternative, in case base_url is not accessible>
alternative_base_url_2=<second alternative>
...
Some notes:
- the base_url key is still a valid key for the sake of backward compatibility
- additional urls can be specified adding a key for each alternative url in the format "alternative_base_url_<number>"; tooltool will try to access them in the order explicitly specified by the number in the key itself (the order in which they are written in the config file is irrelevant).
Reporter | ||
Comment 3•12 years ago
|
||
Sounds good!
Assignee | ||
Comment 4•12 years ago
|
||
The diff is against revision 5aa22f53a78ac3011508c91eb52d69c1c60f57ce in repository https://github.com/jhford/tooltool/commit/master.
Assignee | ||
Comment 5•12 years ago
|
||
The attached examples of usage, kind of rudimentary manual tests, document the changes in the tooltool interface and show the resulting output. These commands have been run in the exact order they appear in the attachment file.
Assignee | ||
Comment 6•12 years ago
|
||
Comment on attachment 733604 [details] [diff] [review]
Patch to add management of multiple urls to tooltool
Hi Rail!
Can you please review my patch?
I selected you as a reviewer since I noticed you already landed tooltool related bugs in the past (namely, in the puppet repositories).
Thanks a lot!
Simone
Attachment #733604 -
Flags: review?(rail)
Comment 7•12 years ago
|
||
Comment on attachment 733604 [details] [diff] [review]
Patch to add management of multiple urls to tooltool
Review of attachment 733604 [details] [diff] [review]:
-----------------------------------------------------------------
First of all, thanks a lot for grabbig this outstanding bug!
I have some comments, mostly PEP8 related. I'll be happy to review the next patch. ;) BTW, feel free to pep8tify this file.
And feel free to poke me on IRC.
::: tooltool.py
@@ +35,5 @@
>
> log = logging.getLogger(__name__)
>
> +SUPPORTED_CONFIG_FILES=['/etc/tooltool', os.path.expanduser('~/.tooltool'),
> + os.path.join(os.getcwd(), '.tooltool')]
Use spaces around "=", align the second line properly.
No, let's just remove it. See my comments below.
@@ +379,4 @@
> # Let's bail!
> return False
>
> +
Trailing space, please delete.
@@ +405,5 @@
> + if size != file_record.size:
> + log.error("transfer from %s to %s failed due to a difference of %d bytes" % (url,
> + file_record.filename, file_record.size - size))
> + else:
> + log.info("Success! File %s fetched from %s" % (file_record.filename,base_url ))
A space after coma, no space after base_url.
@@ +409,5 @@
> + log.info("Success! File %s fetched from %s" % (file_record.filename,base_url ))
> + return True
> + except (urllib2.URLError, urllib2.HTTPError, ValueError) as e:
> + log.info("..failed to fetch '%s' from %s" % (file_record.filename, base_url),
> + exc_info=False)
exc_info is False by default. Less code, faster reviews. :)
@@ +414,5 @@
> + log.debug("%s" % e)
> + except IOError:
> + log.info("failed to write to '%s'" % file_record.filename,
> + exc_info=True)
> + return False
Trailing space.
@@ +469,4 @@
> elif cmd == 'add':
> return add_files(options['manifest'], options['algorithm'], cmd_args)
> elif cmd == 'fetch':
> +
trailing space.
@@ +469,5 @@
> elif cmd == 'add':
> return add_files(options['manifest'], options['algorithm'], cmd_args)
> elif cmd == 'fetch':
> +
> + if not options.has_key('base_url') or options.get('base_url') is None or len(options.get('base_url'))==0:
"if not options.get('base_url'):" replaces all 3 conditions.
@@ +470,5 @@
> return add_files(options['manifest'], options['algorithm'], cmd_args)
> elif cmd == 'fetch':
> +
> + if not options.has_key('base_url') or options.get('base_url') is None or len(options.get('base_url'))==0:
> + log.critical('fetch command requires at least one url provided using the url option in the command line, or specifying urls in one of the supported config files %s' % str(SUPPORTED_CONFIG_FILES))
Can you wrap the line at 79? str() is redundant because of %s.
@@ +495,5 @@
> + try:
> + hmap=dict(cfg_file.items(section))
> + except ConfigParser.NoSectionError as e:
> + log.debug("%s in config file" % e, exc_info=True)
> + return [hmap[key] for key in sorted([key for key in hmap.keys() if p.match(key) ], key=lambda x: int(p.match(x).group(1))) ]
I'm not going to decrypt the line above. :)
That reminds me. I'd prefer to drop support of configuration files since we have never used them. The code wil be much more readable ana maintainable.
Let's doo eet! :)
BTW, if you have more than 2 empty lines, I'm going to point you to http://www.python.org/dev/peps/pep-0008/ :)
@@ +524,5 @@
> # Set up logging, for now just to the console
> + import sys
> +
> + log.setLevel(logging.DEBUG)
> + ch = logging.StreamHandler(sys.stdout)
Why do you need to log to stdout? Using stderr is quite common.
@@ +569,5 @@
>
> +
> +
> +
> + # read main base_url from config file if not provided in command line, then adds any alternative_base_url provided
trailing spaces and too many empty lines ^^
@@ +583,5 @@
> + options['base_url'].append(main_url)
> + options['base_url'].extend(read_alternative_base_urls(cfg_file, log))
> +
> + else:
> + log.error("skipping config files")
Let's just remove this block to get rid of config support.
Attachment #733604 -
Flags: review?(rail) → review-
Comment 8•12 years ago
|
||
(In reply to Rail Aliiev [:rail] from comment #7)
> Comment on attachment 733604 [details] [diff] [review]
> Patch to add management of multiple urls to tooltool
>
> Review of attachment 733604 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> First of all, thanks a lot for grabbig this outstanding bug!
>
> I have some comments, mostly PEP8 related. I'll be happy to review the next
> patch. ;) BTW, feel free to pep8tify this file.
> And feel free to poke me on IRC.
I'll just say, the "run through autopep8 /pep8ify" suggestion I'd like to be a functionally separate patch, whether that is prior to the actual functional changes or after doesn't matter to me, just makes blame/comprehension of diffs in future 20x better!
I'm also not sold on completely removing the config-file support, but I don't care enough to [try to] block's rail's opinion.
Comment 9•12 years ago
|
||
(In reply to Justin Wood (:Callek) from comment #8)
> I'll just say, the "run through autopep8 /pep8ify" suggestion I'd like to be
> a functionally separate patch, whether that is prior to the actual
> functional changes or after doesn't matter to me, just makes
> blame/comprehension of diffs in future 20x better!
Yeah, having 2 commits would be better. However, the patch shouldn't introduce new PEP8 violations.
> I'm also not sold on completely removing the config-file support, but I
> don't care enough to [try to] block's rail's opinion.
If the code is not used it should die. If we really want to use configs, I'd say use JSON instead to avoid dirty hacks to support lists in INI files.
Assignee | ||
Comment 10•12 years ago
|
||
Thanks a lot Rail and Callek!
I am going to upload three patches to:
- pep8tify tooltool
- apply the other non pep8 changes suggested by Rail
- remove support for config files (in case this will need to be added again in the future, I agree with Rail's proposal to use JSON )
Assignee | ||
Comment 11•12 years ago
|
||
Existing violations of the E501 recommendation (line too long) have not been fixed (yet).
This patch has been created with the command:
git diff e15684dbee5840d90787246eef776c098d61ae12 e6934e3786d770b37dd96bbe912f54a7c67bfdbb > bug_768123_pep8.diff
The mentioned commit ids have been pushed to https://github.com/simone-mozilla/tooltool/tree/bug_768123
Attachment #733794 -
Flags: review?(rail)
Assignee | ||
Comment 12•12 years ago
|
||
This patch has been created with the command:
git diff e6934e3786d770b37dd96bbe912f54a7c67bfdbb 2256e5069c30f510cacb53292f50fdceee739b6f > bug_768123_miscellaneous.diff
The mentioned commit ids have been pushed to https://github.com/simone-mozilla/tooltool/tree/bug_768123
Attachment #733796 -
Flags: review?(rail)
Assignee | ||
Updated•12 years ago
|
Attachment #733796 -
Attachment is patch: true
Assignee | ||
Comment 13•12 years ago
|
||
This patch has been created with the command:
git diff 2256e5069c30f510cacb53292f50fdceee739b6f 8a5d67620dc90f260ef7e53ae2b2fc70f79a58e7 > bug_768123_removed_configfile_support.diff
The mentioned commit ids have been pushed to https://github.com/simone-mozilla/tooltool/tree/bug_768123
Attachment #733797 -
Flags: review?(rail)
Comment 14•12 years ago
|
||
Woo! I'll review the patches in a bit. For the future, can you use "git diff -U8" to include more context. It's not an issue right now because I can regenerate the patches using your git repo. See also https://developer.mozilla.org/en-US/docs/Installing_Mercurial#Configuration for Mozilla's recommended hg configuration.
Comment 15•12 years ago
|
||
The patches look good. But they can't be applied without the one I r-'ed. How are you going to land the patches? I'd say use git rebase and squash some commits, but since the pep8 patch was applied in the middle of changes, it'll be hard to separate it from other changes...
Also, can you incorporate this fix to make the unittests work (they are broken even without your patch). Evil mutable [] as a default!
--- a/tooltool.py
+++ b/tooltool.py
@@ -172,8 +172,8 @@ class Manifest(object):
valid_formats = ('json',)
- def __init__(self, file_records=[]):
- self.file_records = file_records
+ def __init__(self, file_records=None):
+ self.file_records = file_records or []
def __eq__(self, other):
if self is other:
Comment 16•12 years ago
|
||
Also, I wonder if we should use https://github.com/mozilla/build-tooltool (404 now) as an official repo.
Comment 17•12 years ago
|
||
(In reply to Rail Aliiev [:rail] from comment #16)
> Also, I wonder if we should use https://github.com/mozilla/build-tooltool
> (404 now) as an official repo.
I'd be ok with this, I'd also be happy[ier] if we use hal's tool to mirror it to our hg.m.o (even if RoR stays on github since it started there).
Comment 18•12 years ago
|
||
https://github.com/mozilla/build-tooltool is the new location. I'll file a bug to mirror it to hg and update wiki with the new URL.
Updated•12 years ago
|
Attachment #733794 -
Flags: review?(rail)
Updated•12 years ago
|
Attachment #733796 -
Flags: review?(rail)
Comment 19•12 years ago
|
||
Comment on attachment 733797 [details] [diff] [review]
Incremental patch to remove support for config files
We talked on IRC with Simone. He is going to resubmit the patches: one for real changes and one for pep8.
Attachment #733797 -
Flags: review?(rail)
Assignee | ||
Comment 20•12 years ago
|
||
git diff -U8 5aa22f53a78ac3011508c91eb52d69c1c60f57ce 68a8b74b8ca337e0c54633c7d80bee043c0ef7a1 >patch1.diff
These commit ids have been pushed to https://github.com/simone-mozilla/tooltool/tree/bug_768123
Attachment #733604 -
Attachment is obsolete: true
Attachment #733794 -
Attachment is obsolete: true
Attachment #733796 -
Attachment is obsolete: true
Attachment #733797 -
Attachment is obsolete: true
Attachment #733877 -
Flags: review?(rail)
Assignee | ||
Comment 21•12 years ago
|
||
git diff -U8 68a8b74b8ca337e0c54633c7d80bee043c0ef7a1 205d849bd9b577cdc822bcc473d121947ae242f2 >patch2.diff
The mentioned commit Ids have been pushed to https://github.com/simone-mozilla/tooltool/commits/bug_768123
Attachment #733605 -
Attachment is obsolete: true
Attachment #733878 -
Flags: review?(rail)
Updated•12 years ago
|
Attachment #733877 -
Flags: review?(rail) → review+
Comment 22•12 years ago
|
||
Comment on attachment 733878 [details] [diff] [review]
Enabled multiple urls via command line, removed support for config files and other minor changes
Review of attachment 733878 [details] [diff] [review]:
-----------------------------------------------------------------
R= with the following comments need to be addressed:
::: tooltool.py
@@ +435,2 @@
>
> +# TODO: write tests for this function
This TODO is related to the next function, can you move it down?
@@ +497,5 @@
> return False
>
> +
> +
> +
Please, don't add new empty lines for no reason.
@@ +520,5 @@
>
>
> def main():
> # Set up logging, for now just to the console
> + log.setLevel(logging.DEBUG)
Please drop this hunk. You have -v for this.
Attachment #733878 -
Flags: review?(rail) → review+
Assignee | ||
Comment 23•12 years ago
|
||
git diff -U8 54448bb0347d81fc9aa08e5eec31a7eeb8b80ef7 3bb9a01b97b0c487c73e3a9702a32d5f6f65111b > patch4.diff
Now the pep8 cleanup should be completed (apart from E501):
Simones-MacBook-Pro:tooltool sbruno$ /usr/local/share/python/pep8 tooltool.py --statistics -qq
42 E501 line too long (80 > 79 characters)
Simones-MacBook-Pro:tooltool sbruno$
Attachment #733923 -
Flags: review?(rail)
Assignee | ||
Comment 24•12 years ago
|
||
Log levels cleanup as recommended by Rail - hunk removed!
git diff -U8 54448bb0347d81fc9aa08e5eec31a7eeb8b80ef7 3bb9a01b97b0c487c73e3a9702a32d5f6f65111b > patch4.diff
Attachment #733927 -
Flags: review?(rail)
Updated•12 years ago
|
Attachment #733927 -
Flags: review?(rail) → review+
Updated•12 years ago
|
Attachment #733923 -
Flags: review?(rail) → review+
Reporter | ||
Comment 25•12 years ago
|
||
Just as a reminder to myself, tooltool in production is still using http://runtime-binaries.pvt.build.mozilla.org/tooltool, and this work is blocking moving tooltool off of that hostname.
Comment 26•12 years ago
|
||
Comment on attachment 733877 [details] [diff] [review]
Patch to pep8tify tooltool.
https://github.com/mozilla/build-tooltool/commit/199ae0a6c77702176ffed8fc762ba199a8d5d7c9
Attachment #733877 -
Flags: checked-in+
Comment 27•12 years ago
|
||
Comment on attachment 733878 [details] [diff] [review]
Enabled multiple urls via command line, removed support for config files and other minor changes
https://github.com/mozilla/build-tooltool/commit/fdcf3c88717da9e2a37b3671cf1b1c37bbacbfb4
Attachment #733878 -
Flags: checked-in+
Comment 28•12 years ago
|
||
Comment on attachment 733923 [details] [diff] [review]
Further pep8tification
https://github.com/mozilla/build-tooltool/commit/8c9cd3936feb00491ead9f256a4e50e8c292798d
Attachment #733923 -
Flags: checked-in+
Comment 29•12 years ago
|
||
Comment on attachment 733927 [details] [diff] [review]
Log levels cleanup
https://github.com/mozilla/build-tooltool/commit/86cd1b89e3d6493076499f22ea85774b511f7bd1
Attachment #733927 -
Flags: checked-in+
Assignee | ||
Comment 30•12 years ago
|
||
The patches for the two repos puppet and puppet-manifests are identical, so I am attaching only one.
This patch will sync the tooltool version in those repos with https://github.com/mozilla/build-tooltool/commit/86cd1b89e3d6493076499f22ea85774b511f7bd1 (apart from the shebang line)
Attachment #743675 -
Flags: review?(rail)
Comment 31•12 years ago
|
||
Comment on attachment 743675 [details] [diff] [review]
Patch to port the changes to both puppet and puppet-manifests repositories
Let's deploy it tomorrow?
Attachment #743675 -
Flags: review?(rail) → review+
Assignee | ||
Comment 32•12 years ago
|
||
Hi Rail, tomorrow (May 1st) is holiday in Germany so I will not be at work.
Comment 33•12 years ago
|
||
OK. Thursday then?
Comment 34•12 years ago
|
||
Comment on attachment 743675 [details] [diff] [review]
Patch to port the changes to both puppet and puppet-manifests repositories
https://hg.mozilla.org/build/puppet-manifests/rev/22b8f942937e
https://hg.mozilla.org/build/puppet/rev/66a869e5d7c1
Attachment #743675 -
Flags: checked-in+
Comment 35•12 years ago
|
||
Deployed on the prehistorical puppet masters.
Assignee | ||
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 36•11 years ago
|
||
AIUI, in production this is still using runtime-binaries.pvt.b.m.o. So, so far tooltool is *capable* of more resiliency, but not actually resilient. Is there a bug to switch it to use a wider set of URLs?
Reporter | ||
Comment 37•11 years ago
|
||
Now there is: bug 882712.
Updated•11 years ago
|
Product: mozilla.org → Release Engineering
Updated•8 years ago
|
Component: Tools → General
You need to log in
before you can comment on or make changes to this bug.
Description
•