Skip to content

Commit 4574613

Browse files
committed
nodewatcher: fetch instance type only at start-up
Since the compute node cannot change its instance type it makes no sense to dynamically fetch this value in the nodewatcher loop. This change reduces the calls to DescribeStack API which allows a relatively low TPS Signed-off-by: Francesco De Martino <[email protected]>
1 parent c3e20a3 commit 4574613

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

nodewatcher/nodewatcher.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,20 +296,13 @@ def _poll_instance_status(config, scheduler_module, asg_name, hostname, instance
296296
_terminate_if_down(scheduler_module, config, asg_name, instance_id, INITIAL_TERMINATE_TIMEOUT)
297297

298298
idletime = _init_idletime()
299-
instance_type = None
299+
instance_type = get_compute_instance_type(config.region, config.proxy_config, config.stack_name)
300+
instance_properties = get_instance_properties(config.region, config.proxy_config, instance_type)
300301
while True:
301302
time.sleep(60)
302303
_store_idletime(idletime)
303304
_terminate_if_down(scheduler_module, config, asg_name, instance_id, TERMINATE_TIMEOUT)
304305

305-
# Get instance properties
306-
new_instance_type = get_compute_instance_type(
307-
config.region, config.proxy_config, config.stack_name, fallback=instance_type
308-
)
309-
if new_instance_type != instance_type:
310-
instance_type = new_instance_type
311-
instance_properties = get_instance_properties(config.region, config.proxy_config, instance_type)
312-
313306
has_jobs = _has_jobs(scheduler_module, hostname)
314307
if has_jobs:
315308
log.info("Instance has active jobs.")

0 commit comments

Comments
 (0)