appmesh 1.2.5__py3-none-any.whl → 1.2.9__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.
- appmesh/appmesh_client.py +12 -11
- {appmesh-1.2.5.dist-info → appmesh-1.2.9.dist-info}/METADATA +4 -4
- appmesh-1.2.9.dist-info/RECORD +6 -0
- {appmesh-1.2.5.dist-info → appmesh-1.2.9.dist-info}/WHEEL +1 -1
- appmesh-1.2.5.dist-info/RECORD +0 -6
- {appmesh-1.2.5.dist-info → appmesh-1.2.9.dist-info}/top_level.txt +0 -0
appmesh/appmesh_client.py
CHANGED
@@ -13,7 +13,7 @@ import uuid
|
|
13
13
|
from enum import Enum, unique
|
14
14
|
from datetime import datetime
|
15
15
|
from http import HTTPStatus
|
16
|
-
from typing import Optional
|
16
|
+
from typing import Optional, Tuple
|
17
17
|
from urllib import parse
|
18
18
|
|
19
19
|
import aniso8601
|
@@ -31,7 +31,7 @@ _SSL_CA_PEM_FILE = "/opt/appmesh/ssl/ca.pem"
|
|
31
31
|
_SSL_CLIENT_PEM_FILE = "/opt/appmesh/ssl/client.pem"
|
32
32
|
_SSL_CLIENT_PEM_KEY_FILE = "/opt/appmesh/ssl/client-key.pem"
|
33
33
|
HTTP_USER_AGENT_HEADER_NAME = "User-Agent"
|
34
|
-
HTTP_USER_AGENT = "
|
34
|
+
HTTP_USER_AGENT = "appmesh/python"
|
35
35
|
|
36
36
|
|
37
37
|
def _get_str_item(data: dict, key):
|
@@ -296,7 +296,7 @@ class App(object):
|
|
296
296
|
return output
|
297
297
|
|
298
298
|
|
299
|
-
class
|
299
|
+
class AppRun(object):
|
300
300
|
"""
|
301
301
|
Application run object indicate to a remote run from run_async()
|
302
302
|
"""
|
@@ -657,19 +657,19 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
657
657
|
exit_code = int(resp.headers["Exit-Code"]) if "Exit-Code" in resp.headers else None
|
658
658
|
return AppOutput(status_code=resp.status_code, output=resp.text, out_position=out_position, exit_code=exit_code)
|
659
659
|
|
660
|
-
def app_health(self, app_name: str) ->
|
660
|
+
def app_health(self, app_name: str) -> bool:
|
661
661
|
"""Get application health status, 0 is health.
|
662
662
|
|
663
663
|
Args:
|
664
664
|
app_name (str): the application name.
|
665
665
|
|
666
666
|
Returns:
|
667
|
-
|
667
|
+
bool: healthy or not
|
668
668
|
"""
|
669
669
|
resp = self._request_http(AppMeshClient.Method.GET, path=f"/appmesh/app/{app_name}/health")
|
670
670
|
if resp.status_code != HTTPStatus.OK:
|
671
671
|
raise Exception(resp.text)
|
672
|
-
return int(resp.text)
|
672
|
+
return int(resp.text) == 0
|
673
673
|
|
674
674
|
########################################
|
675
675
|
# Application manage
|
@@ -1241,13 +1241,13 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1241
1241
|
)
|
1242
1242
|
if resp.status_code != HTTPStatus.OK:
|
1243
1243
|
raise Exception(resp.text)
|
1244
|
-
return
|
1244
|
+
return AppRun(self, resp.json()["name"], resp.json()["process_uuid"])
|
1245
1245
|
|
1246
|
-
def run_async_wait(self, run:
|
1246
|
+
def run_async_wait(self, run: AppRun, stdout_print: bool = True, timeout: int = 0) -> int:
|
1247
1247
|
"""Wait for an async run to be finished
|
1248
1248
|
|
1249
1249
|
Args:
|
1250
|
-
run (
|
1250
|
+
run (AppRun): asyncrized run result from run_async().
|
1251
1251
|
stdout_print (bool, optional): print remote stdout to local or not.
|
1252
1252
|
timeout (int, optional): wait max timeout seconds and return if not finished, 0 means wait until finished
|
1253
1253
|
|
@@ -1282,7 +1282,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1282
1282
|
stdout_print: bool = True,
|
1283
1283
|
max_time_seconds=DEFAULT_RUN_APP_TIMEOUT_SECONDS,
|
1284
1284
|
life_cycle_seconds=DEFAULT_RUN_APP_LIFECYCLE_SECONDS,
|
1285
|
-
) -> int:
|
1285
|
+
) -> Tuple[int, str]:
|
1286
1286
|
"""Block run a command remotely, 'name' attribute in app_json dict used to run an existing application
|
1287
1287
|
The synchronized run will block the process until the remote run is finished then return the result from HTTP response
|
1288
1288
|
|
@@ -1294,6 +1294,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1294
1294
|
|
1295
1295
|
Returns:
|
1296
1296
|
int: process exit code, return None if no exit code.
|
1297
|
+
str: stdout text
|
1297
1298
|
"""
|
1298
1299
|
path = "/appmesh/app/syncrun"
|
1299
1300
|
resp = self._request_http(
|
@@ -1310,7 +1311,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1310
1311
|
exit_code = int(resp.headers.get("Exit-Code"))
|
1311
1312
|
elif stdout_print:
|
1312
1313
|
print(resp.text)
|
1313
|
-
return exit_code
|
1314
|
+
return exit_code, resp.text
|
1314
1315
|
|
1315
1316
|
def _request_http(self, method: Method, path: str, query: dict = None, header: dict = None, body=None) -> requests.Response:
|
1316
1317
|
"""REST API
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.9
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -43,7 +43,7 @@ Cloud native | Schedule cloud-level applications to run on multiple hosts with r
|
|
43
43
|
Micro service application | ⚡️ [Consul micro-service cluster management](https://app-mesh.readthedocs.io/en/latest/CONSUL.html)
|
44
44
|
Extra Features | Collect host/app resource usage <br> Remote shell command execution <br> File upload/download interface <br> Hot-update support `systemctl reload appmesh` <br> Bash completion <br> Reverse proxy <br> [Web GUI](https://github.com/laoshanxi/app-mesh-ui)
|
45
45
|
Platform support | X86_64 <br> ARM32 <br> ARM64
|
46
|
-
SDK | [Python](https://app-mesh.readthedocs.io/en/latest/api/appmesh_client.html) <br> [Golang](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/go/appmesh_client.go) <br> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
46
|
+
SDK | [Python](https://app-mesh.readthedocs.io/en/latest/api/appmesh_client.html) <br> [Golang](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/go/appmesh_client.go) <br> [JavaScript](https://www.npmjs.com/package/appmesh) <br> [Java](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/java/) <br> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
47
47
|
|
48
48
|
## Getting started
|
49
49
|
|
@@ -94,9 +94,9 @@ Refer to the [Installation doc](https://app-mesh.readthedocs.io/en/latest/Instal
|
|
94
94
|
|
95
95
|
---
|
96
96
|
|
97
|
-
###
|
97
|
+
### Mind diagram
|
98
98
|
|
99
|
-

|
100
100
|
|
101
101
|
---
|
102
102
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
+
appmesh/appmesh_client.py,sha256=12PXzQY1MTh48XR5XaCLQ3Lvs1g7lLD2KE9QcrNhPgw,62480
|
3
|
+
appmesh-1.2.9.dist-info/METADATA,sha256=k4BdUChQq2Ts5YwEJwPGolTy1jpYpZdWnm6SmEtLrKo,11041
|
4
|
+
appmesh-1.2.9.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
5
|
+
appmesh-1.2.9.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
+
appmesh-1.2.9.dist-info/RECORD,,
|
appmesh-1.2.5.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
-
appmesh/appmesh_client.py,sha256=vPC9L3hkvGuYRPHyzx6N6zbISKoSLah5PtbiE1Ktpv4,62419
|
3
|
-
appmesh-1.2.5.dist-info/METADATA,sha256=5EqsWLxfTX4CVSKJ1RhroBlR53G-5fxQlMeZ5-3suI8,10927
|
4
|
-
appmesh-1.2.5.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
5
|
-
appmesh-1.2.5.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
-
appmesh-1.2.5.dist-info/RECORD,,
|
File without changes
|