iris-pex-embedded-python 3.5.6b7__tar.gz → 3.5.6b9__tar.gz

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.
Files changed (98) hide show
  1. {iris_pex_embedded_python-3.5.6b7/src/iris_pex_embedded_python.egg-info → iris_pex_embedded_python-3.5.6b9}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/pyproject.toml +1 -1
  3. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_remote.py +22 -11
  4. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Service/Remote/Rest/v1.cls +39 -13
  5. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9/src/iris_pex_embedded_python.egg-info}/PKG-INFO +1 -1
  6. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/LICENSE +0 -0
  7. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/README.md +0 -0
  8. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/setup.cfg +0 -0
  9. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/setup.py +0 -0
  10. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/__init__.py +0 -0
  11. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
  12. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
  13. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
  14. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
  15. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
  16. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
  17. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
  18. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
  19. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
  20. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
  21. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
  22. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
  23. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
  24. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
  25. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
  26. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
  27. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
  28. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
  29. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
  30. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/cls/Grongier/Service/WSGI.cls +0 -0
  31. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/__init__.py +0 -0
  32. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/__main__.py +0 -0
  33. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/_business_host.py +0 -0
  34. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/_cli.py +0 -0
  35. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/_common.py +0 -0
  36. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/_director.py +0 -0
  37. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/_utils.py +0 -0
  38. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/grongier/pex/wsgi/handlers.py +0 -0
  39. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/__init__.py +0 -0
  40. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/__main__.py +0 -0
  41. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_async_request.py +0 -0
  42. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_business_host.py +0 -0
  43. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_business_operation.py +0 -0
  44. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_business_process.py +0 -0
  45. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_business_service.py +0 -0
  46. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_cli.py +0 -0
  47. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_common.py +0 -0
  48. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_debugpy.py +0 -0
  49. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_decorators.py +0 -0
  50. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_director.py +0 -0
  51. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_dispatch.py +0 -0
  52. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_generator_request.py +0 -0
  53. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_inbound_adapter.py +0 -0
  54. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_iris.py +0 -0
  55. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_local.py +0 -0
  56. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_log_manager.py +0 -0
  57. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_message.py +0 -0
  58. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_message_validator.py +0 -0
  59. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_outbound_adapter.py +0 -0
  60. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_private_session_duplex.py +0 -0
  61. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_private_session_process.py +0 -0
  62. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_serialization.py +0 -0
  63. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/_utils.py +0 -0
  64. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/BusinessOperation.cls +0 -0
  65. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/BusinessProcess.cls +0 -0
  66. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/BusinessService.cls +0 -0
  67. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Common.cls +0 -0
  68. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Director.cls +0 -0
  69. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Duplex/Operation.cls +0 -0
  70. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Duplex/Process.cls +0 -0
  71. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Duplex/Service.cls +0 -0
  72. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Generator/Message/Ack.cls +0 -0
  73. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Generator/Message/Poll.cls +0 -0
  74. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Generator/Message/Start.cls +0 -0
  75. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Generator/Message/StartPickle.cls +0 -0
  76. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Generator/Message/Stop.cls +0 -0
  77. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/InboundAdapter.cls +0 -0
  78. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Message/JSONSchema.cls +0 -0
  79. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Message.cls +0 -0
  80. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/OutboundAdapter.cls +0 -0
  81. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PickleMessage.cls +0 -0
  82. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PrivateSession/Duplex.cls +0 -0
  83. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PrivateSession/Message/Ack.cls +0 -0
  84. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PrivateSession/Message/Poll.cls +0 -0
  85. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PrivateSession/Message/Start.cls +0 -0
  86. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/PrivateSession/Message/Stop.cls +0 -0
  87. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Projection.cls +0 -0
  88. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Service/Remote/Handler.cls +0 -0
  89. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Service/WSGI.cls +0 -0
  90. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Test.cls +0 -0
  91. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Utils.cls +0 -0
  92. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/cls/IOP/Wrapper.cls +0 -0
  93. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iop/wsgi/handlers.py +0 -0
  94. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +0 -0
  95. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  96. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  97. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  98. {iris_pex_embedded_python-3.5.6b7 → iris_pex_embedded_python-3.5.6b9}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.5.6b7
3
+ Version: 3.5.6b9
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "iris_pex_embedded_python"
6
- version = "3.5.6b7"
6
+ version = "3.5.6b9"
7
7
  description = "Iris Interoperability based on Embedded Python"
8
8
  readme = "README.md"
9
9
  authors = [
@@ -16,7 +16,7 @@ import json
16
16
  import os
17
17
  import signal
18
18
  import time
19
- from typing import Any, Dict, List, Optional
19
+ from typing import Any, Dict, List, Optional, Union
20
20
 
21
21
  import requests
22
22
  import urllib3
@@ -50,19 +50,19 @@ class _RemoteDirector:
50
50
  return resp.json()
51
51
 
52
52
  def _post(self, path: str, body: Optional[dict] = None) -> Any:
53
- b = {"namespace": self._namespace, **(body or {})}
54
53
  resp = requests.post(
55
- f"{self._base}{path}", json=b, auth=self._auth,
56
- verify=self._verify, timeout=30,
54
+ f"{self._base}{path}", json=(body or {}),
55
+ params={"namespace": self._namespace},
56
+ auth=self._auth, verify=self._verify, timeout=30,
57
57
  )
58
58
  resp.raise_for_status()
59
59
  return resp.json()
60
60
 
61
61
  def _put(self, path: str, body: Optional[dict] = None) -> Any:
62
- b = {"namespace": self._namespace, **(body or {})}
63
62
  resp = requests.put(
64
- f"{self._base}{path}", json=b, auth=self._auth,
65
- verify=self._verify, timeout=30,
63
+ f"{self._base}{path}", json=(body or {}),
64
+ params={"namespace": self._namespace},
65
+ auth=self._auth, verify=self._verify, timeout=30,
66
66
  )
67
67
  resp.raise_for_status()
68
68
  return resp.json()
@@ -190,18 +190,29 @@ class _RemoteDirector:
190
190
  target: Optional[str],
191
191
  message=None, # ignored remotely — not serialisable over HTTP
192
192
  classname: Optional[str] = None,
193
- body: Optional[str] = None,
193
+ body: Optional[Union[str, dict]] = None,
194
+ restart: bool = True,
194
195
  ) -> dict:
195
- """Returns a dict: {"classname": "...", "body": "...", "truncated": false}"""
196
+ """Returns a dict: {"classname": "...", "body": "...", "truncated": false}.
197
+
198
+ If *restart* is True the target component is stopped and restarted on
199
+ the server before the test message is dispatched.
200
+ """
196
201
  payload: dict = {"target": target or ""}
197
202
  if classname:
198
203
  payload["classname"] = classname
199
- if body:
204
+ if body is not None:
200
205
  payload["body"] = body
206
+ if restart:
207
+ payload["restart"] = True
201
208
  try:
202
209
  return self._check_error(self._post("/test", payload))
203
210
  except requests.exceptions.HTTPError as exc:
204
- raise RuntimeError(str(exc)) from exc
211
+ try:
212
+ err_msg = exc.response.json().get("error", str(exc))
213
+ except Exception:
214
+ err_msg = str(exc)
215
+ raise RuntimeError(err_msg) from exc
205
216
 
206
217
  # ------------------------------------------------------------------
207
218
  # Export
@@ -44,6 +44,15 @@ ClassMethod GetNsParam() As %String [ Internal, Private ]
44
44
  Quit $select(ns="":"USER", 1:ns)
45
45
  }
46
46
 
47
+ /// Return the namespace, preferring a body field over the query parameter.
48
+ ClassMethod ResolveNs(dyna As %DynamicObject = "") As %String [ Internal, Private ]
49
+ {
50
+ Set ns = ""
51
+ If $isobject(dyna) { Set ns = dyna.%Get("namespace") }
52
+ If ns = "" { Set ns = ..GetNsParam() }
53
+ Quit ns
54
+ }
55
+
47
56
  ClassMethod GetStatus() As %Status
48
57
  {
49
58
  Try {
@@ -68,7 +77,7 @@ ClassMethod PostStart() As %Status
68
77
  {
69
78
  Try {
70
79
  Set dyna = {}.%FromJSON(%request.Content)
71
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
80
+ Set ns = ..ResolveNs(dyna)
72
81
  Set production = dyna.%Get("production")
73
82
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
74
83
  If production = "" { Set production = $Get(^Ens.Configuration("csp","LastProduction")) }
@@ -82,8 +91,8 @@ ClassMethod PostStart() As %Status
82
91
  ClassMethod PostStop() As %Status
83
92
  {
84
93
  Try {
85
- Set dyna = {}.%FromJSON(%request.Content)
86
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
94
+ Try { Set dyna = {}.%FromJSON(%request.Content) } Catch { Set dyna = {} }
95
+ Set ns = ..ResolveNs(dyna)
87
96
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
88
97
  $$$ThrowOnError(##class(Ens.Director).StopProduction())
89
98
  Return ..%WriteResponse({"status": "stopped"}.%ToJSON())
@@ -95,8 +104,8 @@ ClassMethod PostStop() As %Status
95
104
  ClassMethod PostKill() As %Status
96
105
  {
97
106
  Try {
98
- Set dyna = {}.%FromJSON(%request.Content)
99
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
107
+ Try { Set dyna = {}.%FromJSON(%request.Content) } Catch { Set dyna = {} }
108
+ Set ns = ..ResolveNs(dyna)
100
109
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
101
110
  $$$ThrowOnError(##class(Ens.Director).StopProduction(10, 1))
102
111
  Return ..%WriteResponse({"status": "killed"}.%ToJSON())
@@ -108,8 +117,8 @@ ClassMethod PostKill() As %Status
108
117
  ClassMethod PostRestart() As %Status
109
118
  {
110
119
  Try {
111
- Set dyna = {}.%FromJSON(%request.Content)
112
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
120
+ Try { Set dyna = {}.%FromJSON(%request.Content) } Catch { Set dyna = {} }
121
+ Set ns = ..ResolveNs(dyna)
113
122
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
114
123
  $$$ThrowOnError(##class(Ens.Director).RestartProduction())
115
124
  Return ..%WriteResponse({"status": "restarted"}.%ToJSON())
@@ -121,8 +130,8 @@ ClassMethod PostRestart() As %Status
121
130
  ClassMethod PostUpdate() As %Status
122
131
  {
123
132
  Try {
124
- Set dyna = {}.%FromJSON(%request.Content)
125
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
133
+ Try { Set dyna = {}.%FromJSON(%request.Content) } Catch { Set dyna = {} }
134
+ Set ns = ..ResolveNs(dyna)
126
135
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
127
136
  $$$ThrowOnError(##class(Ens.Director).UpdateProduction())
128
137
  Return ..%WriteResponse({"status": "updated"}.%ToJSON())
@@ -169,7 +178,7 @@ ClassMethod PutDefault() As %Status
169
178
  {
170
179
  Try {
171
180
  Set dyna = {}.%FromJSON(%request.Content)
172
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
181
+ Set ns = ..ResolveNs(dyna)
173
182
  Set production = dyna.%Get("production")
174
183
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
175
184
  Set ^Ens.Configuration("csp","LastProduction") = production
@@ -241,18 +250,33 @@ ClassMethod GetExport() As %Status
241
250
  }
242
251
 
243
252
  /// POST /test
244
- /// Body: {"target":"Python.MyOp", "classname":"Python.MyMsg", "body":"{}", "namespace":"USER"}
253
+ /// Body: {"target":"Python.MyOp", "classname":"Python.MyMsg", "body":"{}", "namespace":"USER", "restart":true}
254
+ /// If "restart" is true the target component is stopped and restarted before the test message is dispatched. (Default true)
245
255
  /// Returns: {"classname":"...", "body":"...", "session_id":"..."}
246
256
  ClassMethod PostTest() As %Status
247
257
  {
248
258
  Try {
259
+ // Capture output to avoid writing directly to the response stream, which would break the JSON format. We'll include captured output in the response.
260
+ set sc = $$BeginCapture^%SYS.Capture(.msg)
261
+
249
262
  Set dyna = {}.%FromJSON(%request.Content)
250
263
  Set target = dyna.%Get("target")
251
264
  Set classname = dyna.%Get("classname")
252
265
  Set body = dyna.%Get("body")
253
- Set ns = dyna.%Get("namespace") If ns = "" { Set ns = "USER" }
266
+ Set restart = dyna.%Get("restart")
267
+ If restart = "" { Set restart = 1 }
268
+ Set ns = ..ResolveNs(dyna)
254
269
  If ns '= "" { Do ..NamespaceCheck(ns) New $NAMESPACE Set $NAMESPACE = ns }
255
270
 
271
+ // Optionally restart the target component before testing
272
+ If restart {
273
+ $$$ThrowOnError(##class(Ens.Director).EnableConfigItem(target, 0, 1))
274
+ $$$ThrowOnError(##class(Ens.Director).EnableConfigItem(target, 1, 1))
275
+ }
276
+
277
+ // Normalize body: if it arrived as a JSON object, serialize it to a string
278
+ If $isobject(body) { Set body = body.%ToJSON() }
279
+
256
280
  // Build the request message
257
281
  If classname '= "" {
258
282
  Set message = ##class(IOP.Message).%New()
@@ -277,8 +301,10 @@ ClassMethod PostTest() As %Status
277
301
  Set result.classname = ""
278
302
  Set result.body = ""
279
303
  }
304
+ set sc = $$EndCapture^%SYS.Capture(msg,.msgArray)
280
305
  Return ..%WriteResponse(result.%ToJSON())
281
306
  } Catch ex {
307
+ set sc = $$EndCapture^%SYS.Capture(msg,.msgArray)
282
308
  Return ..%WriteErrorResponse(ex.DisplayString())
283
309
  }
284
310
  }
@@ -309,7 +335,7 @@ ClassMethod PutMigrate() As %DynamicObject
309
335
  // Get the request body
310
336
  set dyna = {}.%FromJSON(%request.Content)
311
337
  set body = dyna.%Get("body")
312
- set namespace = dyna.%Get("namespace")
338
+ set namespace = ..ResolveNs(dyna)
313
339
  set targetDirectory = dyna.%Get("remote_folder")
314
340
  set packageName = dyna.%Get("package")
315
341
  // check for namespace existence and user permissions against namespace
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.5.6b7
3
+ Version: 3.5.6b9
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License