Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for adding spot nodes during load balancing #534

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions starcluster/balancers/sge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ class SGELoadBalancer(LoadBalancer):
def __init__(self, interval=60, max_nodes=None, wait_time=900,
add_pi=1, kill_after=45, stab=180, lookback_win=3,
min_nodes=None, kill_cluster=False, plot_stats=False,
plot_output_dir=None, dump_stats=False, stats_file=None):
plot_output_dir=None, dump_stats=False, stats_file=None,
spot_bid=None):
self._cluster = None
self._keep_polling = True
self._visualizer = None
Expand All @@ -437,6 +438,7 @@ def __init__(self, interval=60, max_nodes=None, wait_time=900,
self.stats_file = stats_file
self.plot_stats = plot_stats
self.plot_output_dir = plot_output_dir
self.spot_bit = spot_bid
if plot_stats:
assert self.visualizer is not None

Expand Down Expand Up @@ -724,7 +726,7 @@ def _eval_add_node(self):
log.warn("Adding %d nodes at %s" %
(need_to_add, str(utils.get_utc_now())))
try:
self._cluster.add_nodes(need_to_add)
self._cluster.add_nodes(need_to_add, spot_bid=self.spot_bid)
self.__last_cluster_mod_time = utils.get_utc_now()
log.info("Done adding nodes at %s" %
str(self.__last_cluster_mod_time))
Expand Down
4 changes: 4 additions & 0 deletions starcluster/commands/loadbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def addopts(self, parser):
parser.add_option("-K", "--kill-cluster", dest="kill_cluster",
action="store_true", default=False,
help="Terminate the cluster when the queue is empty")
parser.add_option("-b", "--bid", dest="spot_bid",
action="callback", type="float", default=None,
callback=self._positive_int,
help="max bid for spot nodes, not used by default")

def execute(self, args):
if not self.cfg.globals.enable_experimental:
Expand Down