Skip to content

Commit dae50b1

Browse files
committed
added return value
1 parent 32b2588 commit dae50b1

File tree

2 files changed

+12
-2
lines changed
  • scripts/maintenance/computational-clusters/autoscaled_monitor

2 files changed

+12
-2
lines changed

scripts/maintenance/computational-clusters/autoscaled_monitor/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def summary(
113113
114114
"""
115115

116-
asyncio.run(api.summary(state, user_id or None, wallet_id or None))
116+
if not asyncio.run(api.summary(state, user_id or None, wallet_id or None)):
117+
raise typer.Exit(1)
117118

118119

119120
@app.command()

scripts/maintenance/computational-clusters/autoscaled_monitor/core.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async def _parse_dynamic_instances(
414414
return dynamic_instances
415415

416416

417-
async def summary(state: AppState, user_id: int | None, wallet_id: int | None) -> None:
417+
async def summary(state: AppState, user_id: int | None, wallet_id: int | None) -> bool:
418418
# get all the running instances
419419
assert state.ec2_resource_autoscaling
420420
dynamic_instances = await ec2.list_dynamic_instances_from_ec2(
@@ -429,6 +429,12 @@ async def summary(state: AppState, user_id: int | None, wallet_id: int | None) -
429429
state.ec2_resource_autoscaling.meta.client.meta.region_name,
430430
)
431431

432+
dynamic_services_in_error = False
433+
for instance in dynamic_autoscaled_instances:
434+
for service in instance.running_services:
435+
if service.needs_manual_intervention:
436+
dynamic_services_in_error = True
437+
432438
assert state.ec2_resource_clusters_keeper
433439
computational_instances = await ec2.list_computational_instances_from_ec2(
434440
state, user_id, wallet_id
@@ -442,6 +448,9 @@ async def summary(state: AppState, user_id: int | None, wallet_id: int | None) -
442448
state.ec2_resource_clusters_keeper.meta.client.meta.region_name,
443449
)
444450

451+
if dynamic_services_in_error:
452+
return False
453+
445454

446455
def _print_computational_tasks(
447456
user_id: int,

0 commit comments

Comments
 (0)