appmesh 1.2.4__py3-none-any.whl → 1.2.6__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 +19 -6
- {appmesh-1.2.4.dist-info → appmesh-1.2.6.dist-info}/METADATA +4 -4
- appmesh-1.2.6.dist-info/RECORD +6 -0
- {appmesh-1.2.4.dist-info → appmesh-1.2.6.dist-info}/WHEEL +1 -1
- appmesh-1.2.4.dist-info/RECORD +0 -6
- {appmesh-1.2.4.dist-info → appmesh-1.2.6.dist-info}/top_level.txt +0 -0
appmesh/appmesh_client.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
"""App Mesh Python SDK"""
|
3
3
|
import abc
|
4
4
|
import base64
|
5
|
+
from contextlib import contextmanager
|
5
6
|
import copy
|
6
7
|
import json
|
7
8
|
import os
|
@@ -305,21 +306,33 @@ class Run(object):
|
|
305
306
|
"""application name"""
|
306
307
|
self.proc_uid = process_id
|
307
308
|
"""process_uuid from run_async()"""
|
308
|
-
self.
|
309
|
+
self._client = client
|
309
310
|
"""AppMeshClient object"""
|
311
|
+
self._delegate_host = client.delegate_host
|
312
|
+
"""delegate host indicates the target server for this app run"""
|
313
|
+
|
314
|
+
@contextmanager
|
315
|
+
def delegate_host(self):
|
316
|
+
"""context manager for delegate host override to self._client"""
|
317
|
+
original_value = self._client.delegate_host
|
318
|
+
self._client.delegate_host = self._delegate_host
|
319
|
+
try:
|
320
|
+
yield
|
321
|
+
finally:
|
322
|
+
self._client.delegate_host = original_value
|
310
323
|
|
311
324
|
def wait(self, stdout_print: bool = True, timeout: int = 0) -> int:
|
312
325
|
"""Wait for an async run to be finished
|
313
326
|
|
314
327
|
Args:
|
315
|
-
run (Run): asyncrized run result from run_async().
|
316
328
|
stdout_print (bool, optional): print remote stdout to local or not.
|
317
329
|
timeout (int, optional): wait max timeout seconds and return if not finished, 0 means wait until finished
|
318
330
|
|
319
331
|
Returns:
|
320
332
|
int: return exit code if process finished, return None for timeout or exception.
|
321
333
|
"""
|
322
|
-
|
334
|
+
with self.delegate_host():
|
335
|
+
return self._client.run_async_wait(self, stdout_print, timeout)
|
323
336
|
|
324
337
|
|
325
338
|
class AppMeshClient(metaclass=abc.ABCMeta):
|
@@ -644,19 +657,19 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
644
657
|
exit_code = int(resp.headers["Exit-Code"]) if "Exit-Code" in resp.headers else None
|
645
658
|
return AppOutput(status_code=resp.status_code, output=resp.text, out_position=out_position, exit_code=exit_code)
|
646
659
|
|
647
|
-
def app_health(self, app_name: str) ->
|
660
|
+
def app_health(self, app_name: str) -> bool:
|
648
661
|
"""Get application health status, 0 is health.
|
649
662
|
|
650
663
|
Args:
|
651
664
|
app_name (str): the application name.
|
652
665
|
|
653
666
|
Returns:
|
654
|
-
|
667
|
+
bool: healthy or not
|
655
668
|
"""
|
656
669
|
resp = self._request_http(AppMeshClient.Method.GET, path=f"/appmesh/app/{app_name}/health")
|
657
670
|
if resp.status_code != HTTPStatus.OK:
|
658
671
|
raise Exception(resp.text)
|
659
|
-
return int(resp.text)
|
672
|
+
return int(resp.text) == 0
|
660
673
|
|
661
674
|
########################################
|
662
675
|
# Application manage
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.6
|
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> [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=XJNMUIyBj97JiRfQ3Y11Hk76nQLKtIy6fszUUO-_nmM,62408
|
3
|
+
appmesh-1.2.6.dist-info/METADATA,sha256=3OdzuZkZp3ehs-ng7iVXzBQNh4CGJywiFXyFfynILQM,10966
|
4
|
+
appmesh-1.2.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
5
|
+
appmesh-1.2.6.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
+
appmesh-1.2.6.dist-info/RECORD,,
|
appmesh-1.2.4.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
-
appmesh/appmesh_client.py,sha256=HBAjO77YIsBCLwKl9oM2ajtlR6BuW1ctKBPxvNrZq0w,61947
|
3
|
-
appmesh-1.2.4.dist-info/METADATA,sha256=218Garru27v7El3OqdpKSc94pi4SXr9bxOI-G8IdxuY,10927
|
4
|
-
appmesh-1.2.4.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
5
|
-
appmesh-1.2.4.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
-
appmesh-1.2.4.dist-info/RECORD,,
|
File without changes
|