Skip to content

Commit f5f5b15

Browse files
committed
remove termination
1 parent dab1c9a commit f5f5b15

File tree

2 files changed

+0
-43
lines changed
  • scripts/maintenance/computational-clusters/autoscaled_monitor

2 files changed

+0
-43
lines changed

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,5 @@ def check_database_connection() -> None:
209209
asyncio.run(api.check_database_connection(state))
210210

211211

212-
@app.command()
213-
def terminate_instances(
214-
user_id: Annotated[int, typer.Option(help="the user ID")],
215-
wallet_id: Annotated[
216-
Optional[int | None], # noqa: UP007 # typer does not understand | syntax
217-
typer.Option(help="the wallet ID"),
218-
] = None,
219-
*,
220-
force: Annotated[bool, typer.Option(help="will not ask for confirmation")] = False,
221-
) -> None:
222-
"""this will terminate the instance(s) used for the given user/wallet"""
223-
asyncio.run(api.terminate_instances(state, user_id, wallet_id, force=force))
224-
225-
226212
if __name__ == "__main__":
227213
app()

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -776,32 +776,3 @@ async def trigger_cluster_termination(
776776

777777
async def check_database_connection(state: AppState) -> None:
778778
await db.check_db_connection(state)
779-
780-
781-
async def terminate_instances(
782-
state: AppState, user_id: int | None, wallet_id: int | None, *, force: bool
783-
) -> None:
784-
assert state.ec2_resource_autoscaling
785-
dynamic_instances = await ec2.list_dynamic_instances_from_ec2(
786-
state, user_id, wallet_id
787-
)
788-
789-
dynamic_autoscaled_instances = await _parse_dynamic_instances(
790-
state, dynamic_instances, state.ssh_key_path, user_id, wallet_id
791-
)
792-
793-
if not dynamic_autoscaled_instances:
794-
rich.print("no instances found")
795-
raise typer.Exit(0)
796-
797-
for instance in dynamic_autoscaled_instances:
798-
rich.print(
799-
f"terminating instance {instance.ec2_instance.instance_id} with name {utils.get_instance_name(instance.ec2_instance)}"
800-
)
801-
if force is True or typer.confirm(
802-
f"Are you sure you want to terminate instance {instance.ec2_instance.instance_id}?"
803-
):
804-
instance.ec2_instance.terminate()
805-
rich.print(f"terminated instance {instance.ec2_instance.instance_id}")
806-
else:
807-
rich.print("not terminating anything")

0 commit comments

Comments
 (0)