1
2
3 from starcluster import exception
4 from starcluster.balancers import sge
5
6 from completers import ClusterCompleter
7
8
10 """
11 loadbalance <cluster_tag>
12
13 Start the SGE Load Balancer.
14
15 Example:
16
17 $ starcluster loadbalance mycluster
18
19 This command will endlessly attempt to monitor and load balance 'mycluster'
20 based on the current SGE load. You can also have the load balancer plot the
21 various stats it's monitoring over time using the --plot-stats option:
22
23 $ starcluster loadbalance -p mycluster
24
25 If you just want the stats data and not the plots use the --dump-stats
26 option instead:
27
28 $ starcluster loadbalance -d mycluster
29
30 See "starcluster loadbalance --help" for more details on the '-p' and '-d'
31 options as well as other options for tuning the SGE load balancer
32 algorithm.
33 """
34
35 names = ['loadbalance', 'bal']
36
38 parser.add_option("-d", "--dump-stats", dest="dump_stats",
39 action="store_true", default=False,
40 help="Output stats to a csv file at each iteration")
41 parser.add_option("-D", "--dump-stats-file", dest="stats_file",
42 action="store", default=None,
43 help="File to dump stats to (default: %s)" %
44 sge.DEFAULT_STATS_FILE % "<cluster_tag>")
45 parser.add_option("-p", "--plot-stats", dest="plot_stats",
46 action="store_true", default=False,
47 help="Plot usage stats at each iteration")
48 parser.add_option("-P", "--plot-output-dir", dest="plot_output_dir",
49 action="store", default=None,
50 help="Output directory for stats plots "
51 "(default: %s)" % sge.DEFAULT_STATS_DIR %
52 "<cluster_tag>")
53 parser.add_option("-i", "--interval", dest="interval",
54 action="store", type="int", default=None,
55 help="Polling interval for load balancer")
56 parser.add_option("-m", "--max_nodes", dest="max_nodes",
57 action="store", type="int", default=None,
58 help="Maximum # of nodes in cluster")
59 parser.add_option("-w", "--job_wait_time", dest="wait_time",
60 action="store", type="int", default=None,
61 help=("Maximum wait time for a job before "
62 "adding nodes, seconds"))
63 parser.add_option("-a", "--add_nodes_per_iter", dest="add_pi",
64 action="store", type="int", default=None,
65 help="Number of nodes to add per iteration")
66 parser.add_option("-k", "--kill_after", dest="kill_after",
67 action="store", type="int", default=None,
68 help="Minutes after which a node can be killed")
69 parser.add_option("-s", "--stabilization_time", dest="stab",
70 action="store", type="int", default=None,
71 help="Seconds to wait before cluster stabilizes")
72 parser.add_option("-l", "--lookback_window", dest="lookback_win",
73 action="store", type="int", default=None,
74 help="Minutes to look back for past job history")
75 parser.add_option("-n", "--min_nodes", dest="min_nodes",
76 action="store", type="int", default=None,
77 help="Minimum number of nodes in cluster")
78 parser.add_option("-K", "--kill-master", dest="allow_master_kill",
79 action="store_true", default=None,
80 help="Allow the master to be killed when "
81 "the queue is empty (EXPERIMENTAL).")
82
92