From 8ece21a9954827ef2815c18aed030a0471222ebc Mon Sep 17 00:00:00 2001 From: Rohin Bhasin Date: Sun, 16 Jun 2024 05:29:10 -0400 Subject: [PATCH] Change autostop to use public API. (#894) --- runhouse/servers/autostop_servlet.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/runhouse/servers/autostop_servlet.py b/runhouse/servers/autostop_servlet.py index 33a6a3665..73ffdafc4 100644 --- a/runhouse/servers/autostop_servlet.py +++ b/runhouse/servers/autostop_servlet.py @@ -18,15 +18,8 @@ def set_autostop(self, value=None): autostop_lib.set_autostop(value, None, True) def update_autostop_in_sky_config(self): - import pickle + from sky.skylet.autostop_lib import set_last_active_time_to_now - from sky.skylet import configs as sky_configs - - autostop_mins = pickle.loads( - sky_configs.get_config("autostop_config") - ).autostop_idle_minutes - if autostop_mins > 0 and ( - self._last_register is None or self._last_register < self._last_activity - ): - sky_configs.set_config("autostop_last_active_time", self._last_activity) + if self._last_register is None or self._last_register < self._last_activity: + set_last_active_time_to_now() self._last_register = self._last_activity