iris-pex-embedded-python 3.5.0b1__tar.gz → 3.5.0b3__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.
Potentially problematic release.
This version of iris-pex-embedded-python might be problematic. Click here for more details.
- {iris_pex_embedded_python-3.5.0b1/src/iris_pex_embedded_python.egg-info → iris_pex_embedded_python-3.5.0b3}/PKG-INFO +1 -1
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/pyproject.toml +1 -1
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_host.py +46 -12
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_operation.py +1 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_dispatch.py +6 -2
- iris_pex_embedded_python-3.5.0b3/src/iop/_generator_request.py +30 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_message.py +3 -2
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_serialization.py +18 -10
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Common.cls +51 -5
- iris_pex_embedded_python-3.5.0b3/src/iop/cls/IOP/Generator/Message/Ack.cls +31 -0
- iris_pex_embedded_python-3.5.0b3/src/iop/cls/IOP/Generator/Message/Poll.cls +31 -0
- iris_pex_embedded_python-3.5.0b3/src/iop/cls/IOP/Generator/Message/Start.cls +15 -0
- iris_pex_embedded_python-3.5.0b3/src/iop/cls/IOP/Generator/Message/StartPickle.cls +15 -0
- iris_pex_embedded_python-3.5.0b3/src/iop/cls/IOP/Generator/Message/Stop.cls +32 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PrivateSession/Duplex.cls +1 -1
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PrivateSession/Message/Start.cls +4 -5
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3/src/iris_pex_embedded_python.egg-info}/PKG-INFO +1 -1
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iris_pex_embedded_python.egg-info/SOURCES.txt +6 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/LICENSE +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/README.md +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/setup.cfg +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/setup.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/__init__.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/BusinessService.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Common.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Director.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Message.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PickleMessage.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Test.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/PEX/Utils.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/cls/Grongier/Service/WSGI.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/__init__.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/__main__.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_business_host.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_cli.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_common.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_director.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_utils.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/wsgi/handlers.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/__init__.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/__main__.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_async_request.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_process.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_service.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_cli.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_common.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_debugpy.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_decorators.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_director.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_inbound_adapter.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_iris.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_log_manager.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_message_validator.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_outbound_adapter.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_private_session_duplex.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_private_session_process.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_utils.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/BusinessOperation.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/BusinessProcess.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/BusinessService.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Director.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Duplex/Operation.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Duplex/Process.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Duplex/Service.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/InboundAdapter.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Message/JSONSchema.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Message.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/OutboundAdapter.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PickleMessage.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PrivateSession/Message/Ack.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PrivateSession/Message/Poll.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/PrivateSession/Message/Stop.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Service/WSGI.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Test.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Utils.cls +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/wsgi/handlers.py +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
- {iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_host.py
RENAMED
|
@@ -4,9 +4,10 @@ from typing import Any,List, Optional, Tuple, Union
|
|
|
4
4
|
from . import _iris
|
|
5
5
|
from ._common import _Common
|
|
6
6
|
from ._message import _Message as Message
|
|
7
|
-
from ._decorators import input_serializer_param, output_deserializer
|
|
8
|
-
from ._dispatch import dispatch_serializer, dispatch_deserializer
|
|
7
|
+
from ._decorators import input_serializer_param, output_deserializer, input_deserializer, output_serializer
|
|
8
|
+
from ._dispatch import dispatch_serializer, dispatch_deserializer, dispach_message
|
|
9
9
|
from ._async_request import AsyncRequest
|
|
10
|
+
from ._generator_request import _GeneratorRequest
|
|
10
11
|
|
|
11
12
|
class _BusinessHost(_Common):
|
|
12
13
|
"""Base class for business components that defines common methods.
|
|
@@ -68,6 +69,21 @@ class _BusinessHost(_Common):
|
|
|
68
69
|
"""
|
|
69
70
|
return await AsyncRequest(target, request, timeout, description, self)
|
|
70
71
|
|
|
72
|
+
def send_generator_request(self, target: str, request: Union[Message, Any],
|
|
73
|
+
timeout: int = -1, description: Optional[str] = None) -> _GeneratorRequest:
|
|
74
|
+
"""Send message as a generator request to target component.
|
|
75
|
+
Args:
|
|
76
|
+
target: Name of target component
|
|
77
|
+
request: Message to send
|
|
78
|
+
timeout: Timeout in seconds, -1 means wait forever
|
|
79
|
+
description: Optional description for logging
|
|
80
|
+
Returns:
|
|
81
|
+
_GeneratorRequest: An instance of _GeneratorRequest to iterate over responses
|
|
82
|
+
Raises:
|
|
83
|
+
TypeError: If request is not of type Message
|
|
84
|
+
"""
|
|
85
|
+
return _GeneratorRequest(self, target, request, timeout, description)
|
|
86
|
+
|
|
71
87
|
def send_multi_request_sync(self, target_request: List[Tuple[str, Union[Message, Any]]],
|
|
72
88
|
timeout: int = -1, description: Optional[str] = None) -> List[Tuple[str, Union[Message, Any], Any, int]]:
|
|
73
89
|
"""Send multiple messages synchronously to target components.
|
|
@@ -179,7 +195,7 @@ class _BusinessHost(_Common):
|
|
|
179
195
|
"""
|
|
180
196
|
## Parse the class code to find all invocations of send_request_sync and send_request_async
|
|
181
197
|
## and return the targets
|
|
182
|
-
|
|
198
|
+
target_list = []
|
|
183
199
|
# get the source code of the class
|
|
184
200
|
source = getsource(self.__class__)
|
|
185
201
|
# find all invocations of send_request_sync and send_request_async
|
|
@@ -194,29 +210,47 @@ class _BusinessHost(_Common):
|
|
|
194
210
|
if target.find("=") != -1:
|
|
195
211
|
# it's a keyword argument, remove the keyword
|
|
196
212
|
target = target[target.find("=")+1:].strip()
|
|
197
|
-
if target not in
|
|
198
|
-
|
|
213
|
+
if target not in target_list:
|
|
214
|
+
target_list.append(target)
|
|
199
215
|
i = source.find(method, i+1)
|
|
200
216
|
|
|
201
|
-
for target in
|
|
217
|
+
for target in target_list:
|
|
202
218
|
# if target is a string, remove the quotes
|
|
203
219
|
if target[0] == "'" and target[-1] == "'":
|
|
204
|
-
|
|
220
|
+
target_list[target_list.index(target)] = target[1:-1]
|
|
205
221
|
elif target[0] == '"' and target[-1] == '"':
|
|
206
|
-
|
|
222
|
+
target_list[target_list.index(target)] = target[1:-1]
|
|
207
223
|
# if target is a variable, try to find the value of the variable
|
|
208
224
|
else:
|
|
209
225
|
self.on_init()
|
|
210
226
|
try:
|
|
211
227
|
if target.find("self.") != -1:
|
|
212
228
|
# it's a class variable
|
|
213
|
-
|
|
229
|
+
target_list[target_list.index(target)] = getattr(self, target[target.find(".")+1:])
|
|
214
230
|
elif target.find(".") != -1:
|
|
215
231
|
# it's a class variable
|
|
216
|
-
|
|
232
|
+
target_list[target_list.index(target)] = getattr(getattr(self, target[:target.find(".")]), target[target.find(".")+1:])
|
|
217
233
|
else:
|
|
218
|
-
|
|
234
|
+
target_list[target_list.index(target)] = getattr(self, target)
|
|
219
235
|
except Exception as e:
|
|
220
236
|
pass
|
|
221
237
|
|
|
222
|
-
return
|
|
238
|
+
return target_list
|
|
239
|
+
|
|
240
|
+
@input_deserializer
|
|
241
|
+
def _dispatch_generator_started(self, request: Any) -> Any:
|
|
242
|
+
"""For internal use only."""
|
|
243
|
+
self._gen = dispach_message(self, request)
|
|
244
|
+
# check if self._gen is a generator
|
|
245
|
+
if not hasattr(self._gen, '__iter__'):
|
|
246
|
+
raise TypeError("Expected a generator or iterable object, got: {}".format(type(self._gen).__name__))
|
|
247
|
+
|
|
248
|
+
return _iris.get_iris().IOP.Generator.Message.Ack._New()
|
|
249
|
+
|
|
250
|
+
@output_serializer
|
|
251
|
+
def _dispatch_generator_poll(self) -> Any:
|
|
252
|
+
"""For internal use only."""
|
|
253
|
+
try:
|
|
254
|
+
return next(self._gen)
|
|
255
|
+
except StopIteration:
|
|
256
|
+
return _iris.get_iris().IOP.Generator.Message.Stop._New()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from inspect import signature, Parameter
|
|
2
2
|
from typing import Any, List, Tuple, Callable
|
|
3
3
|
|
|
4
|
-
from ._serialization import serialize_message, serialize_pickle_message, deserialize_message, deserialize_pickle_message
|
|
4
|
+
from ._serialization import serialize_message, serialize_pickle_message, deserialize_message, deserialize_pickle_message, serialize_message_generator, serialize_pickle_message_generator
|
|
5
5
|
from ._message_validator import is_message_instance, is_pickle_message_instance, is_iris_object_instance
|
|
6
6
|
|
|
7
|
-
def dispatch_serializer(message: Any) -> Any:
|
|
7
|
+
def dispatch_serializer(message: Any, is_generator: bool = False) -> Any:
|
|
8
8
|
"""Serializes the message based on its type.
|
|
9
9
|
|
|
10
10
|
Args:
|
|
@@ -18,8 +18,12 @@ def dispatch_serializer(message: Any) -> Any:
|
|
|
18
18
|
"""
|
|
19
19
|
if message is not None:
|
|
20
20
|
if is_message_instance(message):
|
|
21
|
+
if is_generator:
|
|
22
|
+
return serialize_message_generator(message)
|
|
21
23
|
return serialize_message(message)
|
|
22
24
|
elif is_pickle_message_instance(message):
|
|
25
|
+
if is_generator:
|
|
26
|
+
return serialize_pickle_message_generator(message)
|
|
23
27
|
return serialize_pickle_message(message)
|
|
24
28
|
elif is_iris_object_instance(message):
|
|
25
29
|
return message
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Any, Optional, Union
|
|
2
|
+
|
|
3
|
+
from . import _iris
|
|
4
|
+
from ._dispatch import dispatch_serializer
|
|
5
|
+
|
|
6
|
+
class _GeneratorRequest:
|
|
7
|
+
"""Generator class to interetate over responses from a request.
|
|
8
|
+
This class is used to handle the responses from a request in a generator-like manner."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, host: Any, target: str, request: Any,
|
|
11
|
+
timeout: int = -1, description: Optional[str] = None) -> None:
|
|
12
|
+
self.host = host
|
|
13
|
+
self.target = target
|
|
14
|
+
self.request = request
|
|
15
|
+
|
|
16
|
+
ack_response = self.host.send_request_sync(self.target, dispatch_serializer(self.request, is_generator=True),
|
|
17
|
+
timeout=timeout, description=description)
|
|
18
|
+
|
|
19
|
+
if ack_response is None or not ack_response._IsA("IOP.Generator.Message.Ack"):
|
|
20
|
+
raise RuntimeError("Failed to send request, no acknowledgment received.")
|
|
21
|
+
|
|
22
|
+
def __iter__(self):
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def __next__(self):
|
|
26
|
+
poll = _iris.get_iris().IOP.Generator.Message.Poll._New()
|
|
27
|
+
rsp = self.host.send_request_sync(self.target, poll)
|
|
28
|
+
if rsp is None or (hasattr(rsp, '_IsA') and rsp._IsA("IOP.Generator.Message.Stop")):
|
|
29
|
+
raise StopIteration("No more responses available.")
|
|
30
|
+
return rsp
|
|
@@ -9,7 +9,7 @@ class _Message:
|
|
|
9
9
|
"""
|
|
10
10
|
pass
|
|
11
11
|
|
|
12
|
-
class _PickleMessage:
|
|
12
|
+
class _PickleMessage(_Message):
|
|
13
13
|
""" The abstract class that is the superclass for persistent messages sent from one component to another.
|
|
14
14
|
This class has no properties or methods. Users subclass Message and add properties.
|
|
15
15
|
The IOP framework provides the persistence to objects derived from the Message class.
|
|
@@ -26,4 +26,5 @@ class _PydanticPickleMessage(BaseModel):
|
|
|
26
26
|
"""Base class for Pydantic-based messages that can be serialized to IRIS."""
|
|
27
27
|
|
|
28
28
|
def __init__(self, **data: Any):
|
|
29
|
-
super().__init__(**data)
|
|
29
|
+
super().__init__(**data)
|
|
30
|
+
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_serialization.py
RENAMED
|
@@ -37,17 +37,20 @@ class MessageSerializer:
|
|
|
37
37
|
raise SerializationError(f"Object {obj} must be a Pydantic model or dataclass Message")
|
|
38
38
|
|
|
39
39
|
@staticmethod
|
|
40
|
-
def serialize(message: Any, use_pickle: bool = False) -> Any:
|
|
40
|
+
def serialize(message: Any, use_pickle: bool = False, is_generator:bool = False) -> Any:
|
|
41
41
|
"""Serializes a message to IRIS format."""
|
|
42
|
-
if
|
|
43
|
-
return MessageSerializer._serialize_pickle(message)
|
|
44
|
-
return MessageSerializer._serialize_json(message)
|
|
42
|
+
if use_pickle:
|
|
43
|
+
return MessageSerializer._serialize_pickle(message, is_generator)
|
|
44
|
+
return MessageSerializer._serialize_json(message, is_generator)
|
|
45
45
|
|
|
46
46
|
@staticmethod
|
|
47
|
-
def _serialize_json(message: Any) -> Any:
|
|
47
|
+
def _serialize_json(message: Any, is_generator: bool = False) -> Any:
|
|
48
48
|
json_string = MessageSerializer._convert_to_json_safe(message)
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
if is_generator:
|
|
51
|
+
msg = _iris.get_iris().cls('IOP.Generator.Message.Start')._New()
|
|
52
|
+
else:
|
|
53
|
+
msg = _iris.get_iris().cls('IOP.Message')._New()
|
|
51
54
|
msg.classname = f"{message.__class__.__module__}.{message.__class__.__name__}"
|
|
52
55
|
|
|
53
56
|
if hasattr(msg, 'buffer') and len(json_string) > msg.buffer:
|
|
@@ -88,9 +91,12 @@ class MessageSerializer:
|
|
|
88
91
|
raise SerializationError(f"Failed to deserialize JSON: {str(e)}")
|
|
89
92
|
|
|
90
93
|
@staticmethod
|
|
91
|
-
def _serialize_pickle(message: Any) -> Any:
|
|
94
|
+
def _serialize_pickle(message: Any, is_generator: bool = False) -> Any:
|
|
92
95
|
pickle_string = codecs.encode(pickle.dumps(message), "base64").decode()
|
|
93
|
-
|
|
96
|
+
if is_generator:
|
|
97
|
+
msg = _iris.get_iris().cls('IOP.Generator.Message.StartPickle')._New()
|
|
98
|
+
else:
|
|
99
|
+
msg = _iris.get_iris().cls('IOP.PickleMessage')._New()
|
|
94
100
|
msg.classname = f"{message.__class__.__module__}.{message.__class__.__name__}"
|
|
95
101
|
msg.jstr = _Utils.string_to_stream(pickle_string)
|
|
96
102
|
return msg
|
|
@@ -165,7 +171,9 @@ def dataclass_to_dict(instance: Any) -> Dict:
|
|
|
165
171
|
return result
|
|
166
172
|
|
|
167
173
|
# Maintain backwards compatibility
|
|
168
|
-
serialize_pickle_message = lambda msg: MessageSerializer.serialize(msg, use_pickle=True)
|
|
169
|
-
|
|
174
|
+
serialize_pickle_message = lambda msg: MessageSerializer.serialize(msg, use_pickle=True, is_generator=False)
|
|
175
|
+
serialize_pickle_message_generator = lambda msg: MessageSerializer.serialize(msg, use_pickle=True, is_generator=True)
|
|
176
|
+
serialize_message = lambda msg: MessageSerializer.serialize(msg, use_pickle=False, is_generator=False)
|
|
177
|
+
serialize_message_generator = lambda msg: MessageSerializer.serialize(msg, use_pickle=False, is_generator=True)
|
|
170
178
|
deserialize_pickle_message = lambda serial: MessageSerializer.deserialize(serial, use_pickle=True)
|
|
171
179
|
deserialize_message = lambda serial: MessageSerializer.deserialize(serial, use_pickle=False)
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Common.cls
RENAMED
|
@@ -86,11 +86,7 @@ Method DisplayTraceback(ex) As %Status
|
|
|
86
86
|
Method OnInit() As %Status
|
|
87
87
|
{
|
|
88
88
|
set tSC = $$$OK
|
|
89
|
-
|
|
90
|
-
if $SYSTEM.Semaphore.Open(tSemName) '= 1 {
|
|
91
|
-
// Create the semaphore if it does not exist
|
|
92
|
-
set tSC = $SYSTEM.Semaphore.Create(tSemName)
|
|
93
|
-
}
|
|
89
|
+
|
|
94
90
|
try {
|
|
95
91
|
LOCK +^PythonSettings:5
|
|
96
92
|
|
|
@@ -469,4 +465,54 @@ Method dispatchIsRequestDone(
|
|
|
469
465
|
quit tSC
|
|
470
466
|
}
|
|
471
467
|
|
|
468
|
+
XData MessageMap
|
|
469
|
+
{
|
|
470
|
+
<MapItems>
|
|
471
|
+
<MapItem MessageType="IOP.Generator.Message.Start"><Method>OnMsgGeneratorStart</Method></MapItem>
|
|
472
|
+
<MapItem MessageType="IOP.Generator.Message.Stop"><Method>OnMsgGeneratorStop</Method></MapItem>
|
|
473
|
+
<MapItem MessageType="IOP.Generator.Message.Poll"><Method>OnMsgGeneratorPoll</Method></MapItem>
|
|
474
|
+
</MapItems>
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
Method OnMsgGeneratorStart(
|
|
478
|
+
pRequest As IOP.Generator.Message.Start,
|
|
479
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
480
|
+
{
|
|
481
|
+
#dim tSC As %Status = $$$OK
|
|
482
|
+
try {
|
|
483
|
+
set pResponse = ..%class."_dispatch_generator_started"(pRequest)
|
|
484
|
+
} catch ex {
|
|
485
|
+
set tSC = ..DisplayTraceback(ex)
|
|
486
|
+
}
|
|
487
|
+
quit tSC
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
Method OnMsgGeneratorStop(
|
|
491
|
+
pRequest As IOP.Generator.Message.Stop,
|
|
492
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
493
|
+
{
|
|
494
|
+
#dim tSC As %Status = $$$OK
|
|
495
|
+
|
|
496
|
+
try {
|
|
497
|
+
set pResponse = ..%class."_dispatch_generator_stopped"(pRequest)
|
|
498
|
+
} catch ex {
|
|
499
|
+
set tSC = ..DisplayTraceback(ex)
|
|
500
|
+
}
|
|
501
|
+
quit tSC
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
Method OnMsgGeneratorPoll(
|
|
505
|
+
pPollIn As IOP.Generator.Message.Poll,
|
|
506
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
507
|
+
{
|
|
508
|
+
#dim tSC As %Status = $$$OK
|
|
509
|
+
set tSC = $$$OK
|
|
510
|
+
try {
|
|
511
|
+
set pResponse = ..%class."_dispatch_generator_poll"()
|
|
512
|
+
} catch ex {
|
|
513
|
+
set tSC = ..DisplayTraceback(ex)
|
|
514
|
+
}
|
|
515
|
+
quit tSC
|
|
516
|
+
}
|
|
517
|
+
|
|
472
518
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.Generator.Message.Ack Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "Generator";
|
|
9
|
+
|
|
10
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
11
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
12
|
+
{
|
|
13
|
+
Write $$$Text("(session-ack)")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Storage Default
|
|
17
|
+
{
|
|
18
|
+
<Data name="AckDefaultData">
|
|
19
|
+
<Value name="1">
|
|
20
|
+
<Value>%%CLASSNAME</Value>
|
|
21
|
+
</Value>
|
|
22
|
+
</Data>
|
|
23
|
+
<DataLocation>^IOP.Generator.Message.AckD</DataLocation>
|
|
24
|
+
<DefaultData>AckDefaultData</DefaultData>
|
|
25
|
+
<IdLocation>^IOP.Generator.Message.AckD</IdLocation>
|
|
26
|
+
<IndexLocation>^IOP.Generator.Message.AckI</IndexLocation>
|
|
27
|
+
<StreamLocation>^IOP.Generator.Message.AckS</StreamLocation>
|
|
28
|
+
<Type>%Storage.Persistent</Type>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.Generator.Message.Poll Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "Generator";
|
|
9
|
+
|
|
10
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
11
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
12
|
+
{
|
|
13
|
+
Write $$$Text("(poll-data)")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Storage Default
|
|
17
|
+
{
|
|
18
|
+
<Data name="PollDefaultData">
|
|
19
|
+
<Value name="1">
|
|
20
|
+
<Value>%%CLASSNAME</Value>
|
|
21
|
+
</Value>
|
|
22
|
+
</Data>
|
|
23
|
+
<DataLocation>^IOP.PrivateS9756.PollD</DataLocation>
|
|
24
|
+
<DefaultData>PollDefaultData</DefaultData>
|
|
25
|
+
<IdLocation>^IOP.PrivateS9756.PollD</IdLocation>
|
|
26
|
+
<IndexLocation>^IOP.PrivateS9756.PollI</IndexLocation>
|
|
27
|
+
<StreamLocation>^IOP.PrivateS9756.PollS</StreamLocation>
|
|
28
|
+
<Type>%Storage.Persistent</Type>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.Generator.Message.Start Extends IOP.Message [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "Generator";
|
|
9
|
+
|
|
10
|
+
Storage Default
|
|
11
|
+
{
|
|
12
|
+
<Type>%Storage.Persistent</Type>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.Generator.Message.StartPickle Extends IOP.PickleMessage [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "Generator";
|
|
9
|
+
|
|
10
|
+
Storage Default
|
|
11
|
+
{
|
|
12
|
+
<Type>%Storage.Persistent</Type>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.Generator.Message.Stop Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "PrivateSession";
|
|
9
|
+
|
|
10
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
11
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
Write $$$Text("(session-stop)")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Storage Default
|
|
18
|
+
{
|
|
19
|
+
<Data name="StopDefaultData">
|
|
20
|
+
<Value name="1">
|
|
21
|
+
<Value>%%CLASSNAME</Value>
|
|
22
|
+
</Value>
|
|
23
|
+
</Data>
|
|
24
|
+
<DataLocation>^IOP.Generator.Message.StopD</DataLocation>
|
|
25
|
+
<DefaultData>StopDefaultData</DefaultData>
|
|
26
|
+
<IdLocation>^IOP.Generator.Message.StopD</IdLocation>
|
|
27
|
+
<IndexLocation>^IOP.Generator.Message.StopI</IndexLocation>
|
|
28
|
+
<StreamLocation>^IOP.Generator.Message.StopS</StreamLocation>
|
|
29
|
+
<Type>%Storage.Persistent</Type>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
3
|
Confidential property of InterSystems Corporation. */
|
|
4
4
|
|
|
5
|
-
/// This class is a DICOM framework class
|
|
6
5
|
Class IOP.PrivateSession.Message.Start Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
6
|
{
|
|
8
7
|
|
|
@@ -21,11 +20,11 @@ Storage Default
|
|
|
21
20
|
<Value>%%CLASSNAME</Value>
|
|
22
21
|
</Value>
|
|
23
22
|
</Data>
|
|
24
|
-
<DataLocation>^IOP.
|
|
23
|
+
<DataLocation>^IOP.PrivateSession.M6AEC.StartD</DataLocation>
|
|
25
24
|
<DefaultData>StartDefaultData</DefaultData>
|
|
26
|
-
<IdLocation>^IOP.
|
|
27
|
-
<IndexLocation>^IOP.
|
|
28
|
-
<StreamLocation>^IOP.
|
|
25
|
+
<IdLocation>^IOP.PrivateSession.M6AEC.StartD</IdLocation>
|
|
26
|
+
<IndexLocation>^IOP.PrivateSession.M6AEC.StartI</IndexLocation>
|
|
27
|
+
<StreamLocation>^IOP.PrivateSession.M6AEC.StartS</StreamLocation>
|
|
29
28
|
<Type>%Storage.Persistent</Type>
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -44,6 +44,7 @@ src/iop/_debugpy.py
|
|
|
44
44
|
src/iop/_decorators.py
|
|
45
45
|
src/iop/_director.py
|
|
46
46
|
src/iop/_dispatch.py
|
|
47
|
+
src/iop/_generator_request.py
|
|
47
48
|
src/iop/_inbound_adapter.py
|
|
48
49
|
src/iop/_iris.py
|
|
49
50
|
src/iop/_log_manager.py
|
|
@@ -68,6 +69,11 @@ src/iop/cls/IOP/Utils.cls
|
|
|
68
69
|
src/iop/cls/IOP/Duplex/Operation.cls
|
|
69
70
|
src/iop/cls/IOP/Duplex/Process.cls
|
|
70
71
|
src/iop/cls/IOP/Duplex/Service.cls
|
|
72
|
+
src/iop/cls/IOP/Generator/Message/Ack.cls
|
|
73
|
+
src/iop/cls/IOP/Generator/Message/Poll.cls
|
|
74
|
+
src/iop/cls/IOP/Generator/Message/Start.cls
|
|
75
|
+
src/iop/cls/IOP/Generator/Message/StartPickle.cls
|
|
76
|
+
src/iop/cls/IOP/Generator/Message/Stop.cls
|
|
71
77
|
src/iop/cls/IOP/Message/JSONSchema.cls
|
|
72
78
|
src/iop/cls/IOP/PrivateSession/Duplex.cls
|
|
73
79
|
src/iop/cls/IOP/PrivateSession/Message/Ack.cls
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/__init__.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_cli.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_common.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_director.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/grongier/pex/_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_async_request.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_process.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_business_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_inbound_adapter.py
RENAMED
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_log_manager.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_message_validator.py
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/_outbound_adapter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Director.cls
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Message.cls
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Test.cls
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/cls/IOP/Utils.cls
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.5.0b1 → iris_pex_embedded_python-3.5.0b3}/src/iop/wsgi/handlers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|