Skip to content

Commit

Permalink
start cluster checks thread without delay (#1131)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandra Belousov <sashabelousovrh@Alexandras-MacBook-Pro.local>
  • Loading branch information
BelSasha and Alexandra Belousov committed Aug 11, 2024
1 parent e7692ed commit a6a4981
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion runhouse/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,4 @@
SERVER_LOGS_FILE_NAME = "server.log"
DEFAULT_SURFACED_LOG_LENGTH = 20
# Constants for schedulers
SCHEDULERS_DELAY = 2 * MINUTE
INCREASED_INTERVAL = 1 * HOUR
4 changes: 1 addition & 3 deletions runhouse/servers/cluster_servlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
DEFAULT_STATUS_CHECK_INTERVAL,
INCREASED_INTERVAL,
INCREASED_STATUS_CHECK_INTERVAL,
SCHEDULERS_DELAY,
SERVER_LOGFILE,
SERVER_LOGS_FILE_NAME,
)
Expand Down Expand Up @@ -240,8 +239,7 @@ async def save_status_metrics_to_den(
async def aperiodic_cluster_checks(self):
"""Periodically check the status of the cluster, gather metrics about the cluster's utilization & memory,
and save it to Den."""
# Delay the start of post_status_thread, so we'll finish the cluster startup properly
await asyncio.sleep(SCHEDULERS_DELAY)

cluster_config = await self.aget_cluster_config()
interval_size = cluster_config.get(
"status_check_interval", DEFAULT_STATUS_CHECK_INTERVAL
Expand Down
1 change: 0 additions & 1 deletion tests/test_resources/test_clusters/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ def test_status_scheduler_basic_flow(self, cluster):
cluster.save()
# the scheduler start running in a delay of 1 min, so the cluster startup will finish properly.
# Therefore, the test needs to sleep for a while.
time.sleep(60)
cluster_logs = cluster.run([f"cat {SERVER_LOGFILE_PATH}"], stream_logs=False)[
0
][1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def test_status_cluster_rh_daemon_stopped(self, cluster):
@pytest.mark.level("minimal")
def test_logs_surfacing_scheduler_basic_flow(self, cluster):

time.sleep(120)
cluster_uri = rh.globals.rns_client.format_rns_address(cluster.rns_address)
headers = rh.globals.rns_client.request_headers()
api_server_url = rh.globals.rns_client.api_server_url
Expand Down

0 comments on commit a6a4981

Please sign in to comment.