iris-pex-embedded-python 3.5.5b4__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.
- grongier/__init__.py +0 -0
- grongier/cls/Grongier/PEX/BusinessOperation.cls +8 -0
- grongier/cls/Grongier/PEX/BusinessProcess.cls +13 -0
- grongier/cls/Grongier/PEX/BusinessService.cls +8 -0
- grongier/cls/Grongier/PEX/Common.cls +10 -0
- grongier/cls/Grongier/PEX/Director.cls +10 -0
- grongier/cls/Grongier/PEX/Duplex/Operation.cls +4 -0
- grongier/cls/Grongier/PEX/Duplex/Process.cls +13 -0
- grongier/cls/Grongier/PEX/Duplex/Service.cls +4 -0
- grongier/cls/Grongier/PEX/InboundAdapter.cls +8 -0
- grongier/cls/Grongier/PEX/Message.cls +13 -0
- grongier/cls/Grongier/PEX/OutboundAdapter.cls +8 -0
- grongier/cls/Grongier/PEX/PickleMessage.cls +13 -0
- grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +8 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +14 -0
- grongier/cls/Grongier/PEX/Test.cls +10 -0
- grongier/cls/Grongier/PEX/Utils.cls +10 -0
- grongier/cls/Grongier/Service/WSGI.cls +4 -0
- grongier/pex/__init__.py +24 -0
- grongier/pex/__main__.py +4 -0
- grongier/pex/_business_host.py +1 -0
- grongier/pex/_cli.py +4 -0
- grongier/pex/_common.py +1 -0
- grongier/pex/_director.py +1 -0
- grongier/pex/_utils.py +1 -0
- grongier/pex/wsgi/handlers.py +104 -0
- iop/__init__.py +25 -0
- iop/__main__.py +4 -0
- iop/_async_request.py +67 -0
- iop/_business_host.py +256 -0
- iop/_business_operation.py +75 -0
- iop/_business_process.py +224 -0
- iop/_business_service.py +63 -0
- iop/_cli.py +247 -0
- iop/_common.py +334 -0
- iop/_debugpy.py +187 -0
- iop/_decorators.py +49 -0
- iop/_director.py +301 -0
- iop/_dispatch.py +136 -0
- iop/_generator_request.py +30 -0
- iop/_inbound_adapter.py +34 -0
- iop/_iris.py +8 -0
- iop/_log_manager.py +100 -0
- iop/_message.py +40 -0
- iop/_message_validator.py +49 -0
- iop/_outbound_adapter.py +23 -0
- iop/_private_session_duplex.py +103 -0
- iop/_private_session_process.py +41 -0
- iop/_remote.py +91 -0
- iop/_serialization.py +199 -0
- iop/_utils.py +671 -0
- iop/cls/IOP/BusinessOperation.cls +35 -0
- iop/cls/IOP/BusinessProcess.cls +156 -0
- iop/cls/IOP/BusinessService.cls +40 -0
- iop/cls/IOP/Common.cls +569 -0
- iop/cls/IOP/Director.cls +70 -0
- iop/cls/IOP/Duplex/Operation.cls +29 -0
- iop/cls/IOP/Duplex/Process.cls +229 -0
- iop/cls/IOP/Duplex/Service.cls +9 -0
- iop/cls/IOP/Generator/Message/Ack.cls +31 -0
- iop/cls/IOP/Generator/Message/Poll.cls +31 -0
- iop/cls/IOP/Generator/Message/Start.cls +15 -0
- iop/cls/IOP/Generator/Message/StartPickle.cls +15 -0
- iop/cls/IOP/Generator/Message/Stop.cls +32 -0
- iop/cls/IOP/InboundAdapter.cls +22 -0
- iop/cls/IOP/Message/JSONSchema.cls +125 -0
- iop/cls/IOP/Message.cls +754 -0
- iop/cls/IOP/OutboundAdapter.cls +36 -0
- iop/cls/IOP/PickleMessage.cls +58 -0
- iop/cls/IOP/PrivateSession/Duplex.cls +260 -0
- iop/cls/IOP/PrivateSession/Message/Ack.cls +32 -0
- iop/cls/IOP/PrivateSession/Message/Poll.cls +32 -0
- iop/cls/IOP/PrivateSession/Message/Start.cls +31 -0
- iop/cls/IOP/PrivateSession/Message/Stop.cls +48 -0
- iop/cls/IOP/Projection.cls +49 -0
- iop/cls/IOP/Service/Remote/Handler.cls +30 -0
- iop/cls/IOP/Service/Remote/Rest/v1.cls +97 -0
- iop/cls/IOP/Service/WSGI.cls +310 -0
- iop/cls/IOP/Test.cls +85 -0
- iop/cls/IOP/Utils.cls +503 -0
- iop/cls/IOP/Wrapper.cls +58 -0
- iop/wsgi/handlers.py +104 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/METADATA +91 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/RECORD +91 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/WHEEL +5 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/entry_points.txt +2 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/licenses/LICENSE +21 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/top_level.txt +2 -0
grongier/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.BusinessOperation Extends IOP.BusinessOperation [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.BusinessProcess Extends IOP.BusinessProcess [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Storage Default
|
|
9
|
+
{
|
|
10
|
+
<Type>%Storage.Persistent</Type>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.BusinessService Extends IOP.BusinessService [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Include Ensemble
|
|
6
|
+
|
|
7
|
+
Class Grongier.PEX.Common Extends IOP.Common [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Include (%occInclude, Ensemble)
|
|
6
|
+
|
|
7
|
+
Class Grongier.PEX.Director Extends IOP.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 Grongier.PEX.DuplexProcess Extends IOP.BusinessProcess [ ClassType = persistent, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Storage Default
|
|
9
|
+
{
|
|
10
|
+
<Type>%Storage.Persistent</Type>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.InboundAdapter Extends IOP.InboundAdapter [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.Message Extends IOP.Message
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Storage Default
|
|
9
|
+
{
|
|
10
|
+
<Type>%Storage.Persistent</Type>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.OutboundAdapter Extends IOP.OutboundAdapter [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Copyright (c) 2021 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class Grongier.PEX.PickleMessage Extends IOP.PickleMessage
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Storage Default
|
|
9
|
+
{
|
|
10
|
+
<Type>%Storage.Persistent</Type>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 Grongier.PEX.PrivateSessionDuplex Extends IOP.PrivateSessionDuplex [ Abstract, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class Grongier.PEX.PrivateSession.Message.Ack Extends IOP.PrivateSession.Message.Ack [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Storage Default
|
|
10
|
+
{
|
|
11
|
+
<Type>%Storage.Persistent</Type>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class Grongier.PEX.PrivateSession.Message.Poll Extends IOP.PrivateSession.Message.Poll [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Storage Default
|
|
10
|
+
{
|
|
11
|
+
<Type>%Storage.Persistent</Type>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class Grongier.PEX.PrivateSession.Message.Start Extends IOP.PrivateSession.Message.Start [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Storage Default
|
|
10
|
+
{
|
|
11
|
+
<Type>%Storage.Persistent</Type>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class Grongier.PEX.PrivateSession.Message.Stop Extends IOP.PrivateSession.Message.Stop [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Storage Default
|
|
10
|
+
{
|
|
11
|
+
<Type>%Storage.Persistent</Type>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
grongier/pex/__init__.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from iop._business_service import _BusinessService
|
|
2
|
+
from iop._business_process import _BusinessProcess
|
|
3
|
+
from iop._private_session_duplex import _PrivateSessionDuplex
|
|
4
|
+
from iop._private_session_process import _PrivateSessionProcess
|
|
5
|
+
from iop._business_operation import _BusinessOperation
|
|
6
|
+
from iop._inbound_adapter import _InboundAdapter
|
|
7
|
+
from iop._outbound_adapter import _OutboundAdapter
|
|
8
|
+
from iop._message import _Message
|
|
9
|
+
from iop._message import _PickleMessage
|
|
10
|
+
from iop._director import _Director
|
|
11
|
+
from iop._utils import _Utils
|
|
12
|
+
|
|
13
|
+
class Utils(_Utils): pass
|
|
14
|
+
class InboundAdapter(_InboundAdapter): pass
|
|
15
|
+
class OutboundAdapter(_OutboundAdapter): pass
|
|
16
|
+
class BusinessService(_BusinessService): pass
|
|
17
|
+
class BusinessOperation(_BusinessOperation): pass
|
|
18
|
+
class BusinessProcess(_BusinessProcess): pass
|
|
19
|
+
class DuplexService(_PrivateSessionDuplex): pass
|
|
20
|
+
class DuplexOperation(_PrivateSessionDuplex): pass
|
|
21
|
+
class DuplexProcess(_PrivateSessionProcess): pass
|
|
22
|
+
class Message(_Message): pass
|
|
23
|
+
class PickleMessage(_PickleMessage): pass
|
|
24
|
+
class Director(_Director): pass
|
grongier/pex/__main__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from iop._business_host import _BusinessHost
|
grongier/pex/_cli.py
ADDED
grongier/pex/_common.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from iop._common import _Common
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from iop._director import _Director
|
grongier/pex/_utils.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from iop._utils import _Utils
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import os, sys, importlib, urllib.parse
|
|
2
|
+
from io import BytesIO
|
|
3
|
+
|
|
4
|
+
__ospath = os.getcwd()
|
|
5
|
+
|
|
6
|
+
import iris
|
|
7
|
+
|
|
8
|
+
os.chdir(__ospath)
|
|
9
|
+
|
|
10
|
+
enc, esc = sys.getfilesystemencoding(), 'surrogateescape'
|
|
11
|
+
|
|
12
|
+
rest_service = iris.cls('%REST.Impl')
|
|
13
|
+
|
|
14
|
+
def get_from_module(app_path, app_module, app_name):
|
|
15
|
+
|
|
16
|
+
# Add the path to the application
|
|
17
|
+
if (app_path not in sys.path) :
|
|
18
|
+
sys.path.append(app_path)
|
|
19
|
+
|
|
20
|
+
# retrieve the application
|
|
21
|
+
return getattr(importlib.import_module(app_module), app_name)
|
|
22
|
+
|
|
23
|
+
# Changes the current working directory to the manager directory of the instance.
|
|
24
|
+
def goto_manager_dir():
|
|
25
|
+
iris.system.Process.CurrentDirectory(iris.system.Util.ManagerDirectory())
|
|
26
|
+
|
|
27
|
+
def unicode_to_wsgi(u):
|
|
28
|
+
# Convert an environment variable to a WSGI "bytes-as-unicode" string
|
|
29
|
+
return u.encode(enc, esc).decode('iso-8859-1')
|
|
30
|
+
|
|
31
|
+
def wsgi_to_bytes(s):
|
|
32
|
+
return s.encode('iso-8859-1')
|
|
33
|
+
|
|
34
|
+
def write(chunk):
|
|
35
|
+
rest_service._WriteResponse(chunk)
|
|
36
|
+
|
|
37
|
+
def start_response(status, response_headers, exc_info=None):
|
|
38
|
+
'''WSGI start_response callable'''
|
|
39
|
+
if exc_info:
|
|
40
|
+
try:
|
|
41
|
+
raise exc_info[1].with_traceback(exc_info[2])
|
|
42
|
+
finally:
|
|
43
|
+
exc_info = None
|
|
44
|
+
|
|
45
|
+
rest_service._SetStatusCode(status)
|
|
46
|
+
for tuple in response_headers:
|
|
47
|
+
rest_service._SetHeader(tuple[0], tuple[1])
|
|
48
|
+
return write
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Make request to application
|
|
52
|
+
def make_request(environ, stream, application, path):
|
|
53
|
+
|
|
54
|
+
# Change the working directory for logging purposes
|
|
55
|
+
goto_manager_dir()
|
|
56
|
+
|
|
57
|
+
error_log_file = open('WSGI.log', 'a+')
|
|
58
|
+
|
|
59
|
+
# We want the working directory to be the app's directory
|
|
60
|
+
if (not path.endswith(os.path.sep)):
|
|
61
|
+
path = path + os.path.sep
|
|
62
|
+
|
|
63
|
+
#iris.system.Process.CurrentDirectory(path)
|
|
64
|
+
|
|
65
|
+
# Set up the body of the request
|
|
66
|
+
if stream != '':
|
|
67
|
+
bytestream = stream
|
|
68
|
+
elif (environ['CONTENT_TYPE'] == 'application/x-www-form-urlencoded'):
|
|
69
|
+
bytestream = BytesIO()
|
|
70
|
+
part = urllib.parse.urlencode(environ['formdata'])
|
|
71
|
+
bytestream.write(part.encode('utf-8'))
|
|
72
|
+
bytestream.seek(0)
|
|
73
|
+
else:
|
|
74
|
+
bytestream = BytesIO(b'')
|
|
75
|
+
|
|
76
|
+
#for k,v in os.environ.items():
|
|
77
|
+
#environ[k] = unicode_to_wsgi(v)
|
|
78
|
+
environ['wsgi.input'] = bytestream
|
|
79
|
+
environ['wsgi.errors'] = error_log_file
|
|
80
|
+
environ['wsgi.version'] = (1, 0)
|
|
81
|
+
environ['wsgi.multithread'] = False
|
|
82
|
+
environ['wsgi.multiprocess'] = True
|
|
83
|
+
environ['wsgi.run_once'] = True
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if environ.get('HTTPS', 'off') in ('on', '1'):
|
|
87
|
+
environ['wsgi.url_scheme'] = 'https'
|
|
88
|
+
else:
|
|
89
|
+
environ['wsgi.url_scheme'] = 'http'
|
|
90
|
+
|
|
91
|
+
# Calling WSGI application
|
|
92
|
+
response = application(environ, start_response)
|
|
93
|
+
|
|
94
|
+
error_log_file.close()
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
for data in response:
|
|
98
|
+
if data:
|
|
99
|
+
# (REST.Impl).Write() needs a utf-8 string
|
|
100
|
+
write(data.decode('utf-8'))
|
|
101
|
+
write(b'')
|
|
102
|
+
finally:
|
|
103
|
+
if hasattr(response, 'close'):
|
|
104
|
+
response.close()
|
iop/__init__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from iop._business_operation import _BusinessOperation
|
|
2
|
+
from iop._business_process import _BusinessProcess
|
|
3
|
+
from iop._business_service import _BusinessService
|
|
4
|
+
from iop._director import _Director
|
|
5
|
+
from iop._inbound_adapter import _InboundAdapter
|
|
6
|
+
from iop._message import _Message, _PickleMessage, _PydanticMessage, _PydanticPickleMessage
|
|
7
|
+
from iop._outbound_adapter import _OutboundAdapter
|
|
8
|
+
from iop._private_session_duplex import _PrivateSessionDuplex
|
|
9
|
+
from iop._private_session_process import _PrivateSessionProcess
|
|
10
|
+
from iop._utils import _Utils
|
|
11
|
+
|
|
12
|
+
class Utils(_Utils): pass
|
|
13
|
+
class InboundAdapter(_InboundAdapter): pass
|
|
14
|
+
class OutboundAdapter(_OutboundAdapter): pass
|
|
15
|
+
class BusinessService(_BusinessService): pass
|
|
16
|
+
class BusinessOperation(_BusinessOperation): pass
|
|
17
|
+
class BusinessProcess(_BusinessProcess): pass
|
|
18
|
+
class DuplexService(_PrivateSessionDuplex): pass
|
|
19
|
+
class DuplexOperation(_PrivateSessionDuplex): pass
|
|
20
|
+
class DuplexProcess(_PrivateSessionProcess): pass
|
|
21
|
+
class Message(_Message): pass
|
|
22
|
+
class PickleMessage(_PickleMessage): pass
|
|
23
|
+
class PydanticMessage(_PydanticMessage): pass
|
|
24
|
+
class PydanticPickleMessage(_PydanticPickleMessage): pass
|
|
25
|
+
class Director(_Director): pass
|
iop/__main__.py
ADDED
iop/_async_request.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
from . import _iris
|
|
5
|
+
from ._dispatch import dispatch_deserializer, dispatch_serializer
|
|
6
|
+
from ._message import _Message as Message
|
|
7
|
+
|
|
8
|
+
class AsyncRequest(asyncio.Future):
|
|
9
|
+
_message_header_id: int = 0
|
|
10
|
+
_queue_name: str = ""
|
|
11
|
+
_end_time: int = 0
|
|
12
|
+
_response: Any = None
|
|
13
|
+
_done: bool = False
|
|
14
|
+
|
|
15
|
+
def __init__(self, target: str, request: Union[Message, Any],
|
|
16
|
+
timeout: int = -1, description: Optional[str] = None, host: Optional[Any] = None) -> None:
|
|
17
|
+
super().__init__()
|
|
18
|
+
self.target = target
|
|
19
|
+
self.request = request
|
|
20
|
+
self.timeout = timeout
|
|
21
|
+
self.description = description
|
|
22
|
+
self.host = host
|
|
23
|
+
if host is None:
|
|
24
|
+
raise ValueError("host parameter cannot be None")
|
|
25
|
+
self._iris_handle = host.iris_handle
|
|
26
|
+
asyncio.create_task(self.send())
|
|
27
|
+
|
|
28
|
+
async def send(self) -> None:
|
|
29
|
+
# init parameters
|
|
30
|
+
iris = _iris.get_iris()
|
|
31
|
+
message_header_id = iris.ref()
|
|
32
|
+
queue_name = iris.ref()
|
|
33
|
+
end_time = iris.ref()
|
|
34
|
+
request = dispatch_serializer(self.request)
|
|
35
|
+
|
|
36
|
+
# send request
|
|
37
|
+
self._iris_handle.dispatchSendRequestAsyncNG(
|
|
38
|
+
self.target, request, self.timeout, self.description,
|
|
39
|
+
message_header_id, queue_name, end_time)
|
|
40
|
+
|
|
41
|
+
# get byref values
|
|
42
|
+
self._message_header_id = message_header_id.value
|
|
43
|
+
self._queue_name = queue_name.value
|
|
44
|
+
self._end_time = end_time.value
|
|
45
|
+
|
|
46
|
+
while not self._done:
|
|
47
|
+
await asyncio.sleep(0.1)
|
|
48
|
+
self.is_done()
|
|
49
|
+
|
|
50
|
+
self.set_result(self._response)
|
|
51
|
+
|
|
52
|
+
def is_done(self) -> None:
|
|
53
|
+
iris = _iris.get_iris()
|
|
54
|
+
response = iris.ref()
|
|
55
|
+
status = self._iris_handle.dispatchIsRequestDone(self.timeout, self._end_time,
|
|
56
|
+
self._queue_name, self._message_header_id,
|
|
57
|
+
response)
|
|
58
|
+
|
|
59
|
+
self._response = dispatch_deserializer(response.value)
|
|
60
|
+
|
|
61
|
+
if status == 2: # message found
|
|
62
|
+
self._done = True
|
|
63
|
+
elif status == 1: # message not found
|
|
64
|
+
pass
|
|
65
|
+
else:
|
|
66
|
+
self._done = True
|
|
67
|
+
self.set_exception(RuntimeError(iris.system.Status.GetOneStatusText(status)))
|