| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Tools for gradually enabling a feature on a deterministic set of machines. | 5 """Tools for gradually enabling a feature on a deterministic set of machines. |
| 6 | 6 |
| 7 Add a flag to your program to control the percentage of machines that a new | 7 Add a flag to your program to control the percentage of machines that a new |
| 8 feature should be enabled on:: | 8 feature should be enabled on:: |
| 9 | 9 |
| 10 def add_argparse_options(self, parser): | 10 def add_argparse_options(self, parser): |
| 11 parser.add_argument('--myfeature-percent', type=int, default=0) | 11 parser.add_argument('--myfeature-percent', type=int, default=0) |
| 12 | 12 |
| 13 def main(self, opts): | 13 def main(self, opts): |
| (...skipping 22 matching lines...) Expand all Loading... |
| 36 def is_active_for_host(experiment_name, percent): | 36 def is_active_for_host(experiment_name, percent): |
| 37 ret = _is_active({ | 37 ret = _is_active({ |
| 38 'name': experiment_name, | 38 'name': experiment_name, |
| 39 'host': socket.getfqdn(), | 39 'host': socket.getfqdn(), |
| 40 }, percent) | 40 }, percent) |
| 41 | 41 |
| 42 if ret: | 42 if ret: |
| 43 logging.info('Experiment "%s" is active', experiment_name) | 43 logging.info('Experiment "%s" is active', experiment_name) |
| 44 | 44 |
| 45 return ret | 45 return ret |
| OLD | NEW |