appmesh 1.2.4__py3-none-any.whl → 1.2.5__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 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.__client = client
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
- return self.__client.run_async_wait(self, stdout_print, timeout)
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: appmesh
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: Client SDK for App Mesh
5
5
  Home-page: https://github.com/laoshanxi/app-mesh
6
6
  Author: laoshanxi
@@ -0,0 +1,6 @@
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,,
@@ -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,,