(subparsers)
| 727 | |
| 728 | |
| 729 | def initialize_rebalance_subcommand(subparsers): |
| 730 | command_help = """ |
| 731 | Sometimes you may wish to spread out the workers for a running topology. |
| 732 | For example, let's say you have a 10 node cluster running |
| 733 | 4 workers per node, and then let's say you add another 10 nodes to |
| 734 | the cluster. You may wish to have Storm spread out the workers for the |
| 735 | running topology so that each node runs 2 workers. One way to do this |
| 736 | is to kill the topology and resubmit it, but Storm provides a "rebalance" |
| 737 | command that provides an easier way to do this. |
| 738 | |
| 739 | Rebalance will first deactivate the topology for the duration of the |
| 740 | message timeout (overridable with the -w flag) make requested adjustments to the topology |
| 741 | and let the scheduler try to find a better scheduling based off of the |
| 742 | new situation. The topology will then return to its previous state of activation |
| 743 | (so a deactivated topology will still be deactivated and an activated |
| 744 | topology will go back to being activated). |
| 745 | """ |
| 746 | sub_parser = subparsers.add_parser( |
| 747 | "rebalance", help=command_help, formatter_class=SortingHelpFormatter |
| 748 | ) |
| 749 | |
| 750 | sub_parser.add_argument( |
| 751 | "-w", "--wait-time-secs", |
| 752 | help="time to wait before starting to rebalance", |
| 753 | default=None, type=check_non_negative |
| 754 | ) |
| 755 | |
| 756 | sub_parser.add_argument( |
| 757 | "-n", "--num-workers", default=None, |
| 758 | help="change the number of requested workers", type=check_positive |
| 759 | ) |
| 760 | |
| 761 | sub_parser.add_argument( |
| 762 | "-e", "--executor", action="append", default=[], |
| 763 | help="change the number of executors for a given component e.g. --executor component_name=6" |
| 764 | ) |
| 765 | |
| 766 | sub_parser.add_argument( |
| 767 | "-r", "--resources", default=None, |
| 768 | help=""" |
| 769 | change the resources each component is requesting as used by the resource aware scheduler |
| 770 | e.g '{"component1": {"resource1": new_amount, "resource2": new_amount, ... }*}' |
| 771 | """ |
| 772 | ) |
| 773 | |
| 774 | sub_parser.add_argument( |
| 775 | "-t", "--topology-conf", default=None, |
| 776 | help="change the topology conf" |
| 777 | ) |
| 778 | |
| 779 | sub_parser.add_argument("topology-name") |
| 780 | |
| 781 | sub_parser.set_defaults(func=rebalance) |
| 782 | add_common_options(sub_parser) |
| 783 | |
| 784 | |
| 785 | def initialize_get_errors_subcommand(subparsers): |
no test coverage detected