moved buttons into a row
This commit is contained in:
66
pdm.lock
generated
66
pdm.lock
generated
@@ -2,11 +2,11 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
groups = ["default"]
|
groups = ["default", "dev"]
|
||||||
cross_platform = true
|
cross_platform = true
|
||||||
static_urls = false
|
static_urls = false
|
||||||
lock_version = "4.3"
|
lock_version = "4.3"
|
||||||
content_hash = "sha256:4f96d5d4f42e83e8d1d1508e6011fca71612d4b23e40596c57b586f245fa8dbf"
|
content_hash = "sha256:53751a8166b5d8d647fa35543e2ccf058fdcd3ebfe6e942cc766a150e23b6948"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aiofiles"
|
name = "aiofiles"
|
||||||
@@ -120,42 +120,42 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "boto3"
|
name = "boto3"
|
||||||
version = "1.28.52"
|
version = "1.28.57"
|
||||||
requires_python = ">= 3.7"
|
requires_python = ">= 3.7"
|
||||||
summary = "The AWS SDK for Python"
|
summary = "The AWS SDK for Python"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"botocore<1.32.0,>=1.31.52",
|
"botocore<1.32.0,>=1.31.57",
|
||||||
"jmespath<2.0.0,>=0.7.1",
|
"jmespath<2.0.0,>=0.7.1",
|
||||||
"s3transfer<0.7.0,>=0.6.0",
|
"s3transfer<0.8.0,>=0.7.0",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "boto3-1.28.52-py3-none-any.whl", hash = "sha256:1d36db102517d62c6968b3b0636303241f56859d12dd071def4882fc6e030b20"},
|
{file = "boto3-1.28.57-py3-none-any.whl", hash = "sha256:5ddf24cf52c7fb6aaa332eaa08ae8c2afc8f2d1e8860680728533dd573904e32"},
|
||||||
{file = "boto3-1.28.52.tar.gz", hash = "sha256:a34fc153cb2f6fb2f79a764286c967392e8aae9412381d943bddc576c4f7631a"},
|
{file = "boto3-1.28.57.tar.gz", hash = "sha256:e2d2824ba6459b330d097e94039a9c4f96ae3f4bcdc731d620589ad79dcd16d3"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "boto3-stubs"
|
name = "boto3-stubs"
|
||||||
version = "1.28.52"
|
version = "1.28.57"
|
||||||
requires_python = ">=3.7"
|
requires_python = ">=3.7"
|
||||||
summary = "Type annotations for boto3 1.28.52 generated with mypy-boto3-builder 7.19.0"
|
summary = "Type annotations for boto3 1.28.57 generated with mypy-boto3-builder 7.19.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"botocore-stubs",
|
"botocore-stubs",
|
||||||
"types-s3transfer",
|
"types-s3transfer",
|
||||||
"typing-extensions>=4.1.0; python_version < \"3.12\"",
|
"typing-extensions>=4.1.0; python_version < \"3.12\"",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "boto3-stubs-1.28.52.tar.gz", hash = "sha256:12d7e5865aeec52e1f73b935b1c6a42e61325538fc2cb83a87a83e41e9485241"},
|
{file = "boto3-stubs-1.28.57.tar.gz", hash = "sha256:61cd792792c2a16d70801d187ebed705c39962a70e90b5dc0f33d04001fb39ae"},
|
||||||
{file = "boto3_stubs-1.28.52-py3-none-any.whl", hash = "sha256:3ea81a225e062f3bcb205467891086ea031519697ad54622e61251b52609b8d6"},
|
{file = "boto3_stubs-1.28.57-py3-none-any.whl", hash = "sha256:b389a693e33d75ed19d38b4a2ba99d25f4f2045a3136f816d7fec4d27a71ddb4"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "boto3-stubs"
|
name = "boto3-stubs"
|
||||||
version = "1.28.52"
|
version = "1.28.57"
|
||||||
extras = ["essential"]
|
extras = ["essential"]
|
||||||
requires_python = ">=3.7"
|
requires_python = ">=3.7"
|
||||||
summary = "Type annotations for boto3 1.28.52 generated with mypy-boto3-builder 7.19.0"
|
summary = "Type annotations for boto3 1.28.57 generated with mypy-boto3-builder 7.19.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boto3-stubs==1.28.52",
|
"boto3-stubs==1.28.57",
|
||||||
"mypy-boto3-cloudformation<1.29.0,>=1.28.0",
|
"mypy-boto3-cloudformation<1.29.0,>=1.28.0",
|
||||||
"mypy-boto3-dynamodb<1.29.0,>=1.28.0",
|
"mypy-boto3-dynamodb<1.29.0,>=1.28.0",
|
||||||
"mypy-boto3-ec2<1.29.0,>=1.28.0",
|
"mypy-boto3-ec2<1.29.0,>=1.28.0",
|
||||||
@@ -165,13 +165,13 @@ dependencies = [
|
|||||||
"mypy-boto3-sqs<1.29.0,>=1.28.0",
|
"mypy-boto3-sqs<1.29.0,>=1.28.0",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "boto3-stubs-1.28.52.tar.gz", hash = "sha256:12d7e5865aeec52e1f73b935b1c6a42e61325538fc2cb83a87a83e41e9485241"},
|
{file = "boto3-stubs-1.28.57.tar.gz", hash = "sha256:61cd792792c2a16d70801d187ebed705c39962a70e90b5dc0f33d04001fb39ae"},
|
||||||
{file = "boto3_stubs-1.28.52-py3-none-any.whl", hash = "sha256:3ea81a225e062f3bcb205467891086ea031519697ad54622e61251b52609b8d6"},
|
{file = "boto3_stubs-1.28.57-py3-none-any.whl", hash = "sha256:b389a693e33d75ed19d38b4a2ba99d25f4f2045a3136f816d7fec4d27a71ddb4"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "botocore"
|
name = "botocore"
|
||||||
version = "1.31.52"
|
version = "1.31.57"
|
||||||
requires_python = ">= 3.7"
|
requires_python = ">= 3.7"
|
||||||
summary = "Low-level, data-driven core of boto 3."
|
summary = "Low-level, data-driven core of boto 3."
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -180,8 +180,8 @@ dependencies = [
|
|||||||
"urllib3<1.27,>=1.25.4",
|
"urllib3<1.27,>=1.25.4",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "botocore-1.31.52-py3-none-any.whl", hash = "sha256:46b0a75a38521aa6a75fddccb1542e002930e609d4e13516f40fef170d32e515"},
|
{file = "botocore-1.31.57-py3-none-any.whl", hash = "sha256:af006248276ff8e19e3ec7214478f6257035eb40aed865e405486500471ae71b"},
|
||||||
{file = "botocore-1.31.52.tar.gz", hash = "sha256:6d09881c5a8be34b497872ca3936f8757d886a6f42f2a8703411928189cfedc0"},
|
{file = "botocore-1.31.57.tar.gz", hash = "sha256:301436174635bec739b225b840fc365ca00e5c1a63e5b2a19ee679d204e01b78"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -588,7 +588,7 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nicegui"
|
name = "nicegui"
|
||||||
version = "1.3.14"
|
version = "1.3.15"
|
||||||
requires_python = ">=3.8,<4.0"
|
requires_python = ">=3.8,<4.0"
|
||||||
summary = "Create web-based user interfaces with Python. The nice way."
|
summary = "Create web-based user interfaces with Python. The nice way."
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -609,8 +609,8 @@ dependencies = [
|
|||||||
"watchfiles<1.0.0,>=0.18.1",
|
"watchfiles<1.0.0,>=0.18.1",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "nicegui-1.3.14-py3-none-any.whl", hash = "sha256:ebc4d8d7a756f5c5c60df9f9f84449d6e277d140f9cf18dcf2f87772763c04d8"},
|
{file = "nicegui-1.3.15-py3-none-any.whl", hash = "sha256:99416e285c276d443d91106ca155e90fc4ade3709a3954a60ad7dbdf2448574b"},
|
||||||
{file = "nicegui-1.3.14.tar.gz", hash = "sha256:d3a872d1a4ae126842be26bc29ab1c0aeb648dac6a44050e987473687f5ca733"},
|
{file = "nicegui-1.3.15.tar.gz", hash = "sha256:551301163cbe0ab2eb3ce977a25c7ca5bbb14259c6582f22e2c3e98fe8daee67"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -829,7 +829,7 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rich"
|
name = "rich"
|
||||||
version = "13.5.3"
|
version = "13.6.0"
|
||||||
requires_python = ">=3.7.0"
|
requires_python = ">=3.7.0"
|
||||||
summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -837,21 +837,31 @@ dependencies = [
|
|||||||
"pygments<3.0.0,>=2.13.0",
|
"pygments<3.0.0,>=2.13.0",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "rich-13.5.3-py3-none-any.whl", hash = "sha256:9257b468badc3d347e146a4faa268ff229039d4c2d176ab0cffb4c4fbc73d5d9"},
|
{file = "rich-13.6.0-py3-none-any.whl", hash = "sha256:2b38e2fe9ca72c9a00170a1a2d20c63c790d0e10ef1fe35eba76e1e7b1d7d245"},
|
||||||
{file = "rich-13.5.3.tar.gz", hash = "sha256:87b43e0543149efa1253f485cd845bb7ee54df16c9617b8a893650ab84b4acb6"},
|
{file = "rich-13.6.0.tar.gz", hash = "sha256:5c14d22737e6d5084ef4771b62d5d4363165b403455a30a1c8ca39dc7b644bef"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "s3transfer"
|
name = "s3transfer"
|
||||||
version = "0.6.2"
|
version = "0.7.0"
|
||||||
requires_python = ">= 3.7"
|
requires_python = ">= 3.7"
|
||||||
summary = "An Amazon S3 Transfer Manager"
|
summary = "An Amazon S3 Transfer Manager"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"botocore<2.0a.0,>=1.12.36",
|
"botocore<2.0a.0,>=1.12.36",
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "s3transfer-0.6.2-py3-none-any.whl", hash = "sha256:b014be3a8a2aab98cfe1abc7229cc5a9a0cf05eb9c1f2b86b230fd8df3f78084"},
|
{file = "s3transfer-0.7.0-py3-none-any.whl", hash = "sha256:10d6923c6359175f264811ef4bf6161a3156ce8e350e705396a7557d6293c33a"},
|
||||||
{file = "s3transfer-0.6.2.tar.gz", hash = "sha256:cab66d3380cca3e70939ef2255d01cd8aece6a4907a9528740f668c4b0611861"},
|
{file = "s3transfer-0.7.0.tar.gz", hash = "sha256:fd3889a66f5fe17299fe75b82eae6cf722554edca744ca5d5fe308b104883d2e"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "setuptools"
|
||||||
|
version = "68.2.2"
|
||||||
|
requires_python = ">=3.8"
|
||||||
|
summary = "Easily download, build, install, upgrade, and uninstall Python packages"
|
||||||
|
files = [
|
||||||
|
{file = "setuptools-68.2.2-py3-none-any.whl", hash = "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a"},
|
||||||
|
{file = "setuptools-68.2.2.tar.gz", hash = "sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ dependencies = [
|
|||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = {text = "MIT"}
|
license = {text = "MIT"}
|
||||||
|
[project.optional-dependencies]
|
||||||
|
dev = [
|
||||||
|
"setuptools>=68.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
extend-select = [
|
extend-select = [
|
||||||
|
|||||||
@@ -9,10 +9,15 @@ from rich.traceback import install
|
|||||||
|
|
||||||
|
|
||||||
class InstanceMode(Enum):
|
class InstanceMode(Enum):
|
||||||
START = (1,)
|
PENDING = 0
|
||||||
|
START = 1
|
||||||
STOP = 2
|
STOP = 2
|
||||||
|
|
||||||
|
|
||||||
|
class InstanceStateHandler:
|
||||||
|
state: int
|
||||||
|
|
||||||
|
|
||||||
install(show_locals=True)
|
install(show_locals=True)
|
||||||
console = Console()
|
console = Console()
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@@ -25,7 +30,9 @@ logging.basicConfig(
|
|||||||
log = logging.getLogger("rich")
|
log = logging.getLogger("rich")
|
||||||
|
|
||||||
|
|
||||||
def aws_launch_ec2(name: str = "foundry", mode: InstanceMode = InstanceMode.START):
|
def aws_launch_ec2(
|
||||||
|
b: ui.button, name: str = "foundry", mode: InstanceMode = InstanceMode.START
|
||||||
|
) -> None:
|
||||||
ec2_resource = boto3.resource("ec2")
|
ec2_resource = boto3.resource("ec2")
|
||||||
for instance in ec2_resource.instances.all():
|
for instance in ec2_resource.instances.all():
|
||||||
for tag_dict in instance.tags:
|
for tag_dict in instance.tags:
|
||||||
@@ -34,15 +41,21 @@ def aws_launch_ec2(name: str = "foundry", mode: InstanceMode = InstanceMode.STAR
|
|||||||
instance.state["Code"] == 80 and mode == InstanceMode.START
|
instance.state["Code"] == 80 and mode == InstanceMode.START
|
||||||
): # stopped
|
): # stopped
|
||||||
log.info(f"Starting instance {instance.id}")
|
log.info(f"Starting instance {instance.id}")
|
||||||
instance.start()
|
log.info(instance.start())
|
||||||
elif instance.state["Code"] == 16 and mode == InstanceMode.STOP:
|
elif instance.state["Code"] == 16 and mode == InstanceMode.STOP:
|
||||||
log.info(f"Stopping instance {instance.id}")
|
log.info(f"Stopping instance {instance.id}")
|
||||||
instance.stop()
|
log.info(instance.stop())
|
||||||
|
|
||||||
|
|
||||||
def nicegui_ui():
|
def nicegui_ui() -> None:
|
||||||
ui.button("Start Foundry AWS Server", on_click=lambda: aws_launch_ec2())
|
with ui.row():
|
||||||
ui.button("Stop Foundry AWS Server", on_click=lambda: aws_launch_ec2(mode=InstanceMode.STOP))
|
start = ui.button(
|
||||||
|
"Start Foundry AWS Server", on_click=lambda: aws_launch_ec2(start)
|
||||||
|
)
|
||||||
|
stop = ui.button(
|
||||||
|
"Stop Foundry AWS Server",
|
||||||
|
on_click=lambda: aws_launch_ec2(stop, mode=InstanceMode.STOP),
|
||||||
|
)
|
||||||
|
|
||||||
ui.run()
|
ui.run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user