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

Side by Side Diff: third_party/gsutil/gslib/addlhelp/throttling.py

Issue 1380943003: Roll version of gsutil to 4.15. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright 2015 Google Inc. All Rights Reserved. 2 # Copyright 2015 Google Inc. All Rights Reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, 11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and 13 # See the License for the specific language governing permissions and
14 # limitations under the License. 14 # limitations under the License.
15 """Additional help text for throttling gsutil.""" 15 """Additional help text for throttling gsutil."""
16 16
17 from __future__ import absolute_import 17 from __future__ import absolute_import
18 18
19 from gslib.help_provider import HelpProvider 19 from gslib.help_provider import HelpProvider
20 20
21 _DETAILED_HELP_TEXT = (""" 21 _DETAILED_HELP_TEXT = ("""
22 <B>OVERVIEW</B> 22 <B>OVERVIEW</B>
23 Particularly when used with the -m (multi-threading) option, gsutil can 23 Particularly when used with the -m (multi-threading) option, gsutil can
24 consume a significant amount of network bandwidth. In some cases this can 24 consume a significant amount of network bandwidth. In some cases this can
25 cause problems, for example if you start a large rsync operation over a 25 cause problems, for example if you start a large rsync operation over a
26 network connection used by a number of other important production tasks. 26 network link that's also used by a number of other important jobs.
27 27
28 While gsutil has no built-in support for throttling requests, there are 28 While gsutil has no built-in support for throttling requests, there are
29 various tools available on Linux and MacOS that can be used to throttle 29 various tools available on Linux and MacOS that can be used to throttle
30 gsutil requests. 30 gsutil requests.
31 31
32 One tool is `trickle<http://monkey.org/~marius/pages/?page=trickle>`_ 32 One tool is `trickle<http://monkey.org/~marius/pages/?page=trickle>`_
33 (available via apt-get on Ubuntu systems), which will let you limit how much 33 (available via apt-get on Ubuntu systems), which will let you limit how much
34 bandwidth gsutil consumes. For example, the following command would limit 34 bandwidth gsutil consumes. For example, the following command would limit
35 upload and download bandwidth consumed by gsutil rsync to 100 KBps: 35 upload and download bandwidth consumed by gsutil rsync to 100 KBps:
36 36
37 trickle -d 100 -u 100 gsutil -m rsync -r ./dir gs://some bucket 37 trickle -d 100 -u 100 gsutil -m rsync -r ./dir gs://some bucket
38 38
39 Another tool is 39 Another tool is
40 `ionice<http://www.tutorialspoint.com/unix_commands/ionice.htm>`_ (built 40 `ionice<http://www.tutorialspoint.com/unix_commands/ionice.htm>`_ (built
41 in to many Linux systems), which will let you limit how much I/O capacity 41 in to many Linux systems), which will let you limit how much I/O capacity
42 gsutil consumes (e.g., to avoid letting it monopolize your local disk). For 42 gsutil consumes (e.g., to avoid letting it monopolize your local disk). For
43 example, the following command would reduce I/O priority of gsutil so it 43 example, the following command would reduce I/O priority of gsutil so it
44 doesn't monopolize your local disk: 44 doesn't monopolize your local disk:
45 45
46 ionice -c 2 -n 7 gsutil gsutil -m rsync -r ./dir gs://some bucket 46 ionice -c 2 -n 7 gsutil -m rsync -r ./dir gs://some bucket
47 """) 47 """)
48 48
49 49
50 class CommandOptions(HelpProvider): 50 class CommandOptions(HelpProvider):
51 """Additional help text for throttling gsutil.""" 51 """Additional help text for throttling gsutil."""
52 52
53 # Help specification. See help_provider.py for documentation. 53 # Help specification. See help_provider.py for documentation.
54 help_spec = HelpProvider.HelpSpec( 54 help_spec = HelpProvider.HelpSpec(
55 help_name='throttling', 55 help_name='throttling',
56 help_name_aliases=['bandwidth', 'limit', 'nice'], 56 help_name_aliases=['bandwidth', 'limit', 'nice'],
57 help_type='additional_help', 57 help_type='additional_help',
58 help_one_line_summary='Throttling gsutil', 58 help_one_line_summary='Throttling gsutil',
59 help_text=_DETAILED_HELP_TEXT, 59 help_text=_DETAILED_HELP_TEXT,
60 subcommand_help_text={}, 60 subcommand_help_text={},
61 ) 61 )
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/addlhelp/subdirs.py ('k') | third_party/gsutil/gslib/addlhelp/versions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698