abst
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: abst | ||
| Version: 2.3.57 | ||
| Version: 2.3.58 | ||
| Summary: CLI Command making OCI Bastion and kubernetes usage simple and fast | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/jiri-otoupal/abst |
@@ -13,3 +13,3 @@ """ | ||
| __version__ = "2.3.57" | ||
| __version__ = "2.3.58" | ||
| __author__ = "Jiri Otoupal" | ||
@@ -32,4 +32,3 @@ __author_email__ = "jiri-otoupal@ips-database.eu" | ||
| __change_log__ = """ | ||
| * 'abst ssh' will show screen with available instances for ssh from all abst processes\n | ||
| * moved old ssh to pod from 'abst ssh' to 'abst pod ssh' | ||
| * Deleting sessions now happens in parallel \n | ||
| """ |
@@ -0,1 +1,2 @@ | ||
| from concurrent.futures import ThreadPoolExecutor | ||
| from pathlib import Path | ||
@@ -102,3 +103,3 @@ from threading import Thread | ||
| cls.__display(console) | ||
| sleep(1.5) | ||
| sleep(1) | ||
@@ -169,2 +170,12 @@ @classmethod | ||
| @classmethod | ||
| def kill_session(cls, sess, index, total): | ||
| try: | ||
| rich.print(f"[red]Killing[/red] {sess.bid}") | ||
| Bastion.current_status = "deleting" | ||
| sess.kill() | ||
| Bastion.delete_bastion_session(sess.bid, sess.region) | ||
| except Exception: | ||
| pass | ||
| @classmethod | ||
| def kill_all(cls, a=None, b=None, c=None): | ||
@@ -174,12 +185,15 @@ # This should be only executed in running state | ||
| blist_copy = list(cls.session_list) | ||
| for i, sess in enumerate(blist_copy): | ||
| try: | ||
| rich.print(f"[red]Killing[/red] {sess.bid}") | ||
| Bastion.current_status = "deleting" | ||
| sess.kill() | ||
| Bastion.delete_bastion_session(sess.bid, sess.region) | ||
| except Exception: | ||
| pass | ||
| finally: | ||
| print(f"Deleting {i + 1}/{len(blist_copy)}") | ||
| total_sessions = len(blist_copy) | ||
| deleted = 0 | ||
| with ThreadPoolExecutor() as executor: | ||
| futures = [executor.submit(cls.kill_session, sess, i + 1, total_sessions) | ||
| for i, sess in enumerate(blist_copy)] | ||
| # Optionally, wait for all futures to complete if you need synchronization | ||
| for future in futures: | ||
| future.result() # This will re-raise any exceptions caught during the session killings | ||
| deleted += 1 | ||
| print(f"Deleting {deleted}/{total_sessions}") | ||
| exit(0) | ||
@@ -186,0 +200,0 @@ |
@@ -119,3 +119,3 @@ import datetime | ||
| except ServiceError: | ||
| sleep(1) | ||
| sleep(0.1) | ||
| except Exception as ex: | ||
@@ -122,0 +122,0 @@ logging.info(f"Exception while trying to delete session {ex}") |
@@ -50,3 +50,3 @@ from time import sleep | ||
| bastion.create_forward_loop(shell=shell) | ||
| sleep(1) | ||
| sleep(0.1) | ||
| except FileNotFoundError: | ||
@@ -88,3 +88,3 @@ rich.print("[red]No such context found[/red]") | ||
| sleep(1) | ||
| sleep(0.1) | ||
| except FileNotFoundError: | ||
@@ -91,0 +91,0 @@ rich.print("[red]No such context found[/red]") |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: abst | ||
| Version: 2.3.57 | ||
| Version: 2.3.58 | ||
| Summary: CLI Command making OCI Bastion and kubernetes usage simple and fast | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/jiri-otoupal/abst |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
114971
0.37%2187
0.41%