request-vm-on-golem 0.1.24__py3-none-any.whl → 0.1.26__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {request_vm_on_golem-0.1.24.dist-info → request_vm_on_golem-0.1.26.dist-info}/METADATA +11 -9
- request_vm_on_golem-0.1.26.dist-info/RECORD +24 -0
- {request_vm_on_golem-0.1.24.dist-info → request_vm_on_golem-0.1.26.dist-info}/WHEEL +1 -1
- requestor/api/main.py +59 -0
- requestor/cli/commands.py +213 -256
- requestor/config.py +36 -2
- requestor/db/sqlite.py +33 -41
- requestor/run.py +4 -2
- requestor/services/__init__.py +6 -0
- requestor/services/database_service.py +91 -0
- requestor/services/provider_service.py +265 -0
- requestor/services/ssh_service.py +121 -0
- requestor/services/vm_service.py +209 -0
- request_vm_on_golem-0.1.24.dist-info/RECORD +0 -18
- {request_vm_on_golem-0.1.24.dist-info → request_vm_on_golem-0.1.26.dist-info}/entry_points.txt +0 -0
@@ -1,33 +1,35 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: request-vm-on-golem
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.26
|
4
4
|
Summary: VM on Golem Requestor CLI - Create and manage virtual machines on the Golem Network
|
5
5
|
Keywords: golem,vm,cloud,decentralized,cli
|
6
6
|
Author: Phillip Jensen
|
7
7
|
Author-email: phillip+vm-on-golem@golemgrid.com
|
8
|
-
Requires-Python: >=3.
|
8
|
+
Requires-Python: >=3.13,<4.0
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
10
10
|
Classifier: Environment :: Console
|
11
11
|
Classifier: Intended Audience :: Developers
|
12
12
|
Classifier: Intended Audience :: System Administrators
|
13
13
|
Classifier: Operating System :: OS Independent
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
19
15
|
Classifier: Programming Language :: Python :: 3.13
|
20
16
|
Classifier: Topic :: System :: Distributed Computing
|
21
17
|
Classifier: Topic :: System :: Systems Administration
|
22
|
-
Requires-Dist: aiohttp (>=3.
|
18
|
+
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
|
23
19
|
Requires-Dist: aiosqlite (>=0.17.0,<0.18.0)
|
24
20
|
Requires-Dist: asyncssh (>=2.7.0,<3.0.0)
|
25
21
|
Requires-Dist: click (>=8.0.1,<9.0.0)
|
26
|
-
Requires-Dist: colorlog (>=6.
|
22
|
+
Requires-Dist: colorlog (>=6.8.0,<7.0.0)
|
27
23
|
Requires-Dist: cryptography (>=3.4.7,<4.0.0)
|
28
|
-
Requires-Dist:
|
24
|
+
Requires-Dist: fastapi (>=0.103.0,<0.104.0)
|
25
|
+
Requires-Dist: golem-base-sdk (==0.1.0)
|
26
|
+
Requires-Dist: httptools (>=0.6.0,<0.7.0)
|
27
|
+
Requires-Dist: pydantic (>=2.4.0,<3.0.0)
|
28
|
+
Requires-Dist: pydantic-settings (>=2.1.0,<3.0.0)
|
29
29
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
30
|
+
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
30
31
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
32
|
+
Requires-Dist: uvicorn[standard] (>=0.35.0,<0.36.0)
|
31
33
|
Project-URL: Homepage, https://github.com/cryptobench/vm-on-golem
|
32
34
|
Project-URL: Repository, https://github.com/cryptobench/vm-on-golem
|
33
35
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,24 @@
|
|
1
|
+
requestor/__init__.py,sha256=OqSUAh1uZBMx7GW0MoSMg967PVdmT8XdPJx3QYjwkak,116
|
2
|
+
requestor/api/main.py,sha256=7utCzFNbh5Ol-vsBWeSwT4lXeHD7zdA-GFZuS3rHMWc,2180
|
3
|
+
requestor/cli/__init__.py,sha256=e3E4oEGxmGj-STPtFkQwg_qIWhR0JAiAQdw3G1hXciU,37
|
4
|
+
requestor/cli/commands.py,sha256=x-O7QJmNniTMRtzQ8K0w8IvBAls3mZQ9VnpmwpA30ZM,23388
|
5
|
+
requestor/config.py,sha256=KfAvoAL6jktxTOaJyua5JWGHj7HBHFSrMYSLXl7mRE0,3371
|
6
|
+
requestor/db/__init__.py,sha256=Gm5DfWls6uvCZZ3HGGnyRHswbUQdeA5OGN8yPwH0hc8,88
|
7
|
+
requestor/db/sqlite.py,sha256=l5pWbx2qlHuar1N_a0B9tVnmumLJY1w5rp3yZ7jmsC0,4146
|
8
|
+
requestor/errors.py,sha256=wVpHBuYgQx5pTe_SamugfK-k768noikY1RxvPOjQGko,665
|
9
|
+
requestor/provider/__init__.py,sha256=fmW23aYUVciF8-gmBZkG-PLhn22upmcDzdPfAOLHG6g,103
|
10
|
+
requestor/provider/client.py,sha256=OUP7CoOCCtKD6DB9eqFkOXK6A2BLFdM4DWSkoulJQxg,3213
|
11
|
+
requestor/run.py,sha256=3w9oTitu8ZESwU5ss5rB3OldqZPfwiY-OPKY7EwIDBo,1609
|
12
|
+
requestor/services/__init__.py,sha256=1qSn_6RMn0KB0A7LCnY2IW6_tC3HBQsdfkFeV-h94eM,172
|
13
|
+
requestor/services/database_service.py,sha256=GlSrzzzd7PSYQJNup00sxkB-B2PMr1__04K8k5QSWvs,2996
|
14
|
+
requestor/services/provider_service.py,sha256=CxDGD6OaneOHbexv16dFlRJZYXOyJ0lulF-nKhIi-wQ,9849
|
15
|
+
requestor/services/ssh_service.py,sha256=bhbZ6g_-e7hrK6tytGfWFuNen_G8Ph4H1Rn-TvphKfY,4010
|
16
|
+
requestor/services/vm_service.py,sha256=bbw-q3ZiAyHJX62WuYbUjQYPwCrXxzPd_qSDqm2fXq4,6479
|
17
|
+
requestor/ssh/__init__.py,sha256=hNgSqJ5s1_AwwxVRyFjUqh_LTBpI4Hmzq0F-f_wXN9g,119
|
18
|
+
requestor/ssh/manager.py,sha256=h-93AXFJqzGo2lNTG2u-q4ivU9cCFeNDhYN55skPLBo,6566
|
19
|
+
requestor/utils/logging.py,sha256=oFNpO8pJboYM8Wp7g3HOU4HFyBTKypVdY15lUiz1a4I,3721
|
20
|
+
requestor/utils/spinner.py,sha256=PUHJdTD9jpUHur__01_qxXy87WFfNmjQbD_sLG-KlGo,2459
|
21
|
+
request_vm_on_golem-0.1.26.dist-info/METADATA,sha256=S1Vl70hOO3rqmyJtHmYtFkEcBGwmHxz6wZl48O5LV10,9128
|
22
|
+
request_vm_on_golem-0.1.26.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
23
|
+
request_vm_on_golem-0.1.26.dist-info/entry_points.txt,sha256=Z-skRNpJ8aZcIl_En9mEm1ygkp9FKy0bzQoL3zO52-0,44
|
24
|
+
request_vm_on_golem-0.1.26.dist-info/RECORD,,
|
requestor/api/main.py
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
import logging
|
2
|
+
from fastapi import FastAPI, HTTPException
|
3
|
+
from contextlib import asynccontextmanager
|
4
|
+
|
5
|
+
from ..services.database_service import DatabaseService
|
6
|
+
from ..config import config
|
7
|
+
from ..errors import DatabaseError
|
8
|
+
|
9
|
+
logger = logging.getLogger(__name__)
|
10
|
+
|
11
|
+
# Global variable to hold the database service instance
|
12
|
+
db_service: DatabaseService = None
|
13
|
+
|
14
|
+
@asynccontextmanager
|
15
|
+
async def lifespan(app: FastAPI):
|
16
|
+
# Startup: Initialize database service
|
17
|
+
global db_service
|
18
|
+
logger.info(f"Initializing DatabaseService with db_path: {config.db_path}")
|
19
|
+
# Ensure parent directory exists
|
20
|
+
config.db_path.parent.mkdir(parents=True, exist_ok=True)
|
21
|
+
db_service = DatabaseService(config.db_path)
|
22
|
+
try:
|
23
|
+
await db_service.init()
|
24
|
+
logger.info("DatabaseService initialized successfully.")
|
25
|
+
except DatabaseError as e:
|
26
|
+
logger.error(f"Failed to initialize database during startup: {e}")
|
27
|
+
# Depending on requirements, you might want to prevent the app from starting
|
28
|
+
# raise RuntimeError(f"Database initialization failed: {e}") from e
|
29
|
+
yield
|
30
|
+
# Shutdown: Cleanup (if needed)
|
31
|
+
logger.info("Shutting down API.")
|
32
|
+
# No explicit cleanup needed for aiosqlite connection usually
|
33
|
+
|
34
|
+
app = FastAPI(lifespan=lifespan)
|
35
|
+
|
36
|
+
@app.get("/vms")
|
37
|
+
async def list_vms():
|
38
|
+
"""
|
39
|
+
Endpoint to list all virtual machines stored in the database.
|
40
|
+
"""
|
41
|
+
if db_service is None:
|
42
|
+
logger.error("Database service not initialized.")
|
43
|
+
raise HTTPException(status_code=500, detail="Database service unavailable")
|
44
|
+
|
45
|
+
try:
|
46
|
+
vms = await db_service.list_vms()
|
47
|
+
logger.info(f"Retrieved {len(vms)} VMs from database.")
|
48
|
+
return vms
|
49
|
+
except DatabaseError as e:
|
50
|
+
logger.error(f"API Error fetching VMs: {e}")
|
51
|
+
raise HTTPException(status_code=500, detail=f"Failed to retrieve VM list: {str(e)}")
|
52
|
+
except Exception as e:
|
53
|
+
logger.error(f"Unexpected API error: {e}", exc_info=True)
|
54
|
+
raise HTTPException(status_code=500, detail="An unexpected error occurred")
|
55
|
+
|
56
|
+
# Example of another endpoint (can be removed if not needed)
|
57
|
+
@app.get("/")
|
58
|
+
async def read_root():
|
59
|
+
return {"message": "Golem Requestor API"}
|