appmesh 1.1.8__py3-none-any.whl → 1.2.0__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 +29 -18
- {appmesh-1.1.8.dist-info → appmesh-1.2.0.dist-info}/METADATA +7 -8
- appmesh-1.2.0.dist-info/RECORD +6 -0
- appmesh-1.1.8.dist-info/RECORD +0 -6
- {appmesh-1.1.8.dist-info → appmesh-1.2.0.dist-info}/WHEEL +0 -0
- {appmesh-1.1.8.dist-info → appmesh-1.2.0.dist-info}/top_level.txt +0 -0
appmesh/appmesh_client.py
CHANGED
@@ -10,9 +10,10 @@ import ssl
|
|
10
10
|
import uuid
|
11
11
|
|
12
12
|
from enum import Enum, unique
|
13
|
+
from datetime import datetime
|
13
14
|
from http import HTTPStatus
|
15
|
+
from typing import Optional
|
14
16
|
from urllib import parse
|
15
|
-
from datetime import datetime
|
16
17
|
|
17
18
|
import aniso8601
|
18
19
|
import requests
|
@@ -48,6 +49,20 @@ def _get_native_item(data: dict, key):
|
|
48
49
|
return copy.deepcopy(data[key]) if (data and key in data and data[key]) else None
|
49
50
|
|
50
51
|
|
52
|
+
class AppOutput(object):
|
53
|
+
"""App output object for app_output() method"""
|
54
|
+
|
55
|
+
def __init__(self, status_code: HTTPStatus, output: str, out_position: Optional[int], exit_code: Optional[int]) -> None:
|
56
|
+
# HTTP status code
|
57
|
+
self.status_code = status_code
|
58
|
+
# HTTP response text
|
59
|
+
self.output = output
|
60
|
+
# Current read position (int or None)
|
61
|
+
self.out_position = out_position
|
62
|
+
# Process exit code (int or None)
|
63
|
+
self.exit_code = exit_code
|
64
|
+
|
65
|
+
|
51
66
|
class App(object):
|
52
67
|
"""
|
53
68
|
App object present an application in App Mesh
|
@@ -539,7 +554,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
539
554
|
apps.append(App(app))
|
540
555
|
return apps
|
541
556
|
|
542
|
-
def app_output(self, app_name: str, stdout_position: int = 0, stdout_index: int = 0, stdout_maxsize: int = 10240, process_uuid: str = "", timeout: int = 0):
|
557
|
+
def app_output(self, app_name: str, stdout_position: int = 0, stdout_index: int = 0, stdout_maxsize: int = 10240, process_uuid: str = "", timeout: int = 0) -> AppOutput:
|
543
558
|
"""Get application stdout/stderr
|
544
559
|
|
545
560
|
Args:
|
@@ -552,10 +567,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
552
567
|
timeout (int, optional): wait for the running process for some time(seconds) to get the output.
|
553
568
|
|
554
569
|
Returns:
|
555
|
-
|
556
|
-
str: output string.
|
557
|
-
int or None: current read position.
|
558
|
-
int or None: process exit code.
|
570
|
+
AppOutput object.
|
559
571
|
"""
|
560
572
|
resp = self._request_http(
|
561
573
|
AppMeshClient.Method.GET,
|
@@ -570,7 +582,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
570
582
|
)
|
571
583
|
out_position = int(resp.headers["Output-Position"]) if "Output-Position" in resp.headers else None
|
572
584
|
exit_code = int(resp.headers["Exit-Code"]) if "Exit-Code" in resp.headers else None
|
573
|
-
return (resp.status_code
|
585
|
+
return AppOutput(status_code=resp.status_code, output=resp.text, out_position=out_position, exit_code=exit_code)
|
574
586
|
|
575
587
|
def app_health(self, app_name: str) -> int:
|
576
588
|
"""Get application health status, 0 is health.
|
@@ -1169,28 +1181,27 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1169
1181
|
Returns:
|
1170
1182
|
int: return exit code if process finished, return None for timeout or exception.
|
1171
1183
|
"""
|
1172
|
-
exit_code = None
|
1173
1184
|
if run:
|
1174
|
-
|
1185
|
+
last_output_position = 0
|
1175
1186
|
start = datetime.now()
|
1176
1187
|
interval = 1 if self.__class__.__name__ == "AppMeshClient" else 1000
|
1177
1188
|
while len(run.proc_uid) > 0:
|
1178
|
-
|
1179
|
-
if output and stdout_print:
|
1180
|
-
print(output, end="")
|
1181
|
-
if
|
1182
|
-
|
1183
|
-
if exit_code is not None:
|
1189
|
+
app_out = self.app_output(app_name=run.app_name, stdout_position=last_output_position, stdout_index=0, process_uuid=run.proc_uid, timeout=interval)
|
1190
|
+
if app_out.output and stdout_print:
|
1191
|
+
print(app_out.output, end="")
|
1192
|
+
if app_out.out_position is not None:
|
1193
|
+
last_output_position = app_out.out_position
|
1194
|
+
if app_out.exit_code is not None:
|
1184
1195
|
# success
|
1185
1196
|
self.app_delete(run.app_name)
|
1186
|
-
|
1187
|
-
if
|
1197
|
+
return app_out.exit_code
|
1198
|
+
if app_out.status_code != HTTPStatus.OK:
|
1188
1199
|
# failed
|
1189
1200
|
break
|
1190
1201
|
if timeout > 0 and (datetime.now() - start).seconds > timeout:
|
1191
1202
|
# timeout
|
1192
1203
|
break
|
1193
|
-
return
|
1204
|
+
return None
|
1194
1205
|
|
1195
1206
|
def run_sync(
|
1196
1207
|
self,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.2.0
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -27,9 +27,9 @@ Requires-Dist: aniso8601
|
|
27
27
|
|
28
28
|
# App Mesh
|
29
29
|
|
30
|
-
App Mesh is a `Multi-Tenant`, `Cloud Native`, `Micro Service` application management platform
|
30
|
+
App Mesh is a `Multi-Tenant`, `Cloud Native`, `Micro Service` application management platform designed to manage, schedule, and monitor applications. Each app can be a specific microservice for service discovery or a standard app with replication. App Mesh ensures all defined applications run on time with the specified behavior and resource requests. The platform supports both standalone and cluster modes and provides REST APIs, a command-line interface, and a web UI.
|
31
31
|
|
32
|
-
App Mesh is similar to Kubernetes but much more lightweight, supporting both
|
32
|
+
App Mesh is similar to Kubernetes but is much more lightweight, supporting both containerized and native applications.
|
33
33
|
|
34
34
|
<div align=center><img src="https://github.com/laoshanxi/app-mesh/raw/main/docs/source/diagram.jpg" align=center /></div>
|
35
35
|
|
@@ -37,18 +37,17 @@ App Mesh is similar to Kubernetes but much more lightweight, supporting both con
|
|
37
37
|
|
38
38
|
Feature | Description
|
39
39
|
---|---
|
40
|
-
Application management | 1. Manage independent applications
|
40
|
+
Application management | 1. Manage independent applications with flexible process control (long/short running, periodic, cron schedule, custom timings, error handling) and comprehensive monitoring (start counts, return codes, error messages, health checks) for both native and Docker applications. <br> 2. Run applications on remote hosts using SDK/CLI with sync/async modes and fetch results to the client. <br> 3. Full control over application lifecycle (cgroup resource limitation, specific OS user for execution). <br> 4. Support interactive application start with specific input data via pipe and environment variables. <br> 5. Access all functionalities via [CLI](https://app-mesh.readthedocs.io/en/latest/CLI.html), [REST](https://app-mesh.readthedocs.io/en/latest/Development.html#rest-apis), [SDK](https://github.com/laoshanxi/app-mesh/tree/main/src/sdk) and [WebGUI](https://github.com/laoshanxi/app-mesh-ui) interface.<br>
|
41
41
|
Security | ⚡️ [JWT authentication](https://app-mesh.readthedocs.io/en/latest/JWT.html) for CLI and REST interface <br> ⚡️ [LDAP support](https://app-mesh.readthedocs.io/en/latest/LDAP.html) <br> ⚡️ [Role based permission control](https://app-mesh.readthedocs.io/en/latest/USER_ROLE.html) <br> ⚡️ [Multi-factor authentication](https://app-mesh.readthedocs.io/en/latest/MFA.html)<br> SSL support (ECDH and secure ciphers) for REST http connection <br> Multi-tenant support
|
42
|
-
Cloud native | Schedule cloud
|
42
|
+
Cloud native | Schedule cloud-level applications to run on multiple hosts with resource size requests. <br> ⚡️ [Prometheus Exporter (build-in)](https://app-mesh.readthedocs.io/en/latest/PROMETHEUS.html) <br> ⚡️ [Grafana SimpleJson datasource](https://app-mesh.readthedocs.io/en/latest/GrafanaDataSource.html) <br> ⚡️ [Grafana Loki](https://app-mesh.readthedocs.io/en/latest/Loki.html) <br>⚡️ [Dockerfile](https://github.com/laoshanxi/app-mesh/blob/main/Dockerfile)
|
43
43
|
Micro service application | ⚡️ [Consul micro-service cluster management](https://app-mesh.readthedocs.io/en/latest/CONSUL.html)
|
44
|
-
Extra Features | Collect host/app resource usage <br> Remote
|
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
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://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml) `https://localhost:6060/swagger`
|
47
47
|
|
48
48
|
## Getting started
|
49
49
|
|
50
|
-
|
51
|
-
to install App Mesh via docker-compose or native way and setup App Mesh cluster.
|
50
|
+
Refer to the [Installation doc](https://app-mesh.readthedocs.io/en/latest/Install.html) to learn how to install App Mesh via Docker Compose or natively and set up an App Mesh cluster.
|
52
51
|
|
53
52
|
## Documentation
|
54
53
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
+
appmesh/appmesh_client.py,sha256=Gpf7pdqijTThDQQWH3gDPSZO7Wfjpdp4h4yUpkdk_aQ,60075
|
3
|
+
appmesh-1.2.0.dist-info/METADATA,sha256=aOLMvUjWhjrg3DzFdUs6luSMZlHo4ZVsksqgYO3Xr20,10928
|
4
|
+
appmesh-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
5
|
+
appmesh-1.2.0.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
+
appmesh-1.2.0.dist-info/RECORD,,
|
appmesh-1.1.8.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
-
appmesh/appmesh_client.py,sha256=8nnB38J3wvS8tguEzX_KTJkilW6uMoA4opKIaDq1lG0,59591
|
3
|
-
appmesh-1.1.8.dist-info/METADATA,sha256=OqL1nsCAHrsQvzDpf4VJGLuLj-Bp-Lsw30a_EXyB30Y,10945
|
4
|
-
appmesh-1.1.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
5
|
-
appmesh-1.1.8.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
-
appmesh-1.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|