iris-pex-embedded-python 2.3.28b2__py3-none-any.whl → 3.0.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.

Potentially problematic release.


This version of iris-pex-embedded-python might be problematic. Click here for more details.

Files changed (71) hide show
  1. grongier/cls/Grongier/PEX/BusinessOperation.cls +1 -28
  2. grongier/cls/Grongier/PEX/BusinessProcess.cls +1 -112
  3. grongier/cls/Grongier/PEX/BusinessService.cls +1 -28
  4. grongier/cls/Grongier/PEX/Common.cls +1 -194
  5. grongier/cls/Grongier/PEX/Director.cls +1 -48
  6. grongier/cls/Grongier/PEX/Duplex/Operation.cls +1 -26
  7. grongier/cls/Grongier/PEX/Duplex/Process.cls +1 -217
  8. grongier/cls/Grongier/PEX/Duplex/Service.cls +1 -6
  9. grongier/cls/Grongier/PEX/InboundAdapter.cls +1 -15
  10. grongier/cls/Grongier/PEX/Message.cls +1 -116
  11. grongier/cls/Grongier/PEX/OutboundAdapter.cls +1 -29
  12. grongier/cls/Grongier/PEX/PickleMessage.cls +1 -46
  13. grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +1 -253
  14. grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +1 -19
  15. grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +1 -19
  16. grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +1 -19
  17. grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +1 -35
  18. grongier/cls/Grongier/PEX/Test.cls +1 -53
  19. grongier/cls/Grongier/PEX/Utils.cls +1 -365
  20. grongier/cls/Grongier/Service/WSGI.cls +1 -307
  21. grongier/pex/__init__.py +11 -11
  22. grongier/pex/__main__.py +1 -1
  23. grongier/pex/_business_host.py +1 -511
  24. grongier/pex/_cli.py +1 -152
  25. grongier/pex/_common.py +1 -347
  26. grongier/pex/_director.py +1 -286
  27. grongier/pex/_utils.py +1 -369
  28. iop/__init__.py +24 -0
  29. iop/__main__.py +4 -0
  30. iop/_business_host.py +511 -0
  31. {grongier/pex → iop}/_business_operation.py +1 -1
  32. {grongier/pex → iop}/_business_process.py +1 -1
  33. {grongier/pex → iop}/_business_service.py +1 -1
  34. iop/_cli.py +152 -0
  35. iop/_common.py +349 -0
  36. iop/_director.py +286 -0
  37. {grongier/pex → iop}/_inbound_adapter.py +1 -1
  38. {grongier/pex → iop}/_outbound_adapter.py +1 -1
  39. {grongier/pex → iop}/_private_session_duplex.py +1 -1
  40. {grongier/pex → iop}/_private_session_process.py +2 -2
  41. iop/_utils.py +374 -0
  42. iop/cls/IOP/BusinessOperation.cls +35 -0
  43. iop/cls/IOP/BusinessProcess.cls +124 -0
  44. iop/cls/IOP/BusinessService.cls +35 -0
  45. iop/cls/IOP/Common.cls +203 -0
  46. iop/cls/IOP/Director.cls +57 -0
  47. iop/cls/IOP/Duplex/Operation.cls +29 -0
  48. iop/cls/IOP/Duplex/Process.cls +229 -0
  49. iop/cls/IOP/Duplex/Service.cls +9 -0
  50. iop/cls/IOP/InboundAdapter.cls +22 -0
  51. iop/cls/IOP/Message.cls +128 -0
  52. iop/cls/IOP/OutboundAdapter.cls +36 -0
  53. iop/cls/IOP/PickleMessage.cls +58 -0
  54. iop/cls/IOP/PrivateSession/Duplex.cls +260 -0
  55. iop/cls/IOP/PrivateSession/Message/Ack.cls +32 -0
  56. iop/cls/IOP/PrivateSession/Message/Poll.cls +32 -0
  57. iop/cls/IOP/PrivateSession/Message/Start.cls +32 -0
  58. iop/cls/IOP/PrivateSession/Message/Stop.cls +48 -0
  59. iop/cls/IOP/Service/WSGI.cls +310 -0
  60. iop/cls/IOP/Test.cls +62 -0
  61. iop/cls/IOP/Utils.cls +374 -0
  62. iop/wsgi/handlers.py +104 -0
  63. {iris_pex_embedded_python-2.3.28b2.dist-info → iris_pex_embedded_python-3.0.0.dist-info}/METADATA +28 -28
  64. {iris_pex_embedded_python-2.3.28b2.dist-info → iris_pex_embedded_python-3.0.0.dist-info}/RECORD +70 -42
  65. {iris_pex_embedded_python-2.3.28b2.dist-info → iris_pex_embedded_python-3.0.0.dist-info}/WHEEL +1 -1
  66. iris_pex_embedded_python-3.0.0.dist-info/entry_points.txt +2 -0
  67. {iris_pex_embedded_python-2.3.28b2.dist-info → iris_pex_embedded_python-3.0.0.dist-info}/top_level.txt +1 -0
  68. iris_pex_embedded_python-2.3.28b2.dist-info/entry_points.txt +0 -2
  69. {grongier/pex → iop}/_message.py +0 -0
  70. {grongier/pex → iop}/_pickle_message.py +0 -0
  71. {iris_pex_embedded_python-2.3.28b2.dist-info → iris_pex_embedded_python-3.0.0.dist-info}/LICENSE +0 -0
@@ -2,34 +2,7 @@
2
2
  Cambridge, Massachusetts, U.S.A. All rights reserved.
3
3
  Confidential property of InterSystems Corporation. */
4
4
 
5
- Class Grongier.PEX.BusinessOperation Extends (Ens.BusinessOperation, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
5
+ Class Grongier.PEX.BusinessOperation Extends IOP.BusinessOperation [ Inheritance = right, ProcedureBlock, System = 4 ]
6
6
  {
7
7
 
8
- Parameter SETTINGS = "%classname:Python BusinessOperation,%module:Python BusinessOperation,%settings:Python BusinessOperation,%classpaths:Python BusinessOperation";
9
-
10
- Method OnMessage(
11
- request As %Library.Persistent,
12
- Output response As %Library.Persistent) As %Status
13
- {
14
- set tSC = $$$OK
15
- try {
16
- set response = ..%class."_dispatch_on_message"(request)
17
- } catch ex {
18
- set tSC = ex.AsStatus()
19
- }
20
- quit tSC
21
- }
22
-
23
- Method OnKeepalive(pStatus As %Status = {$$$OK}) As %Status
24
- {
25
- set tSC = $$$OK
26
- try {
27
- $$$ThrowOnError(##super(pStatus))
28
- do ..%class."on_keepalive"()
29
- } catch ex {
30
- set tSC = ex.AsStatus()
31
- }
32
- quit tSC
33
- }
34
-
35
8
  }
@@ -2,122 +2,11 @@
2
2
  Cambridge, Massachusetts, U.S.A. All rights reserved.
3
3
  Confidential property of InterSystems Corporation. */
4
4
 
5
- Class Grongier.PEX.BusinessProcess Extends (Ens.BusinessProcess, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
5
+ Class Grongier.PEX.BusinessProcess Extends IOP.BusinessProcess [ Inheritance = right, ProcedureBlock, System = 4 ]
6
6
  {
7
7
 
8
- Parameter SETTINGS = "%classname:Python BusinessProcess,%module:Python BusinessProcess,%settings:Python BusinessProcess,%classpaths:Python BusinessProcess";
9
-
10
- Property persistentProperties As array Of %String(MAXLEN = "");
11
-
12
- Method dispatchReply(response)
13
- {
14
- set tSC = ..Reply(response)
15
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
16
- quit
17
- }
18
-
19
- Method dispatchSetTimer(
20
- timeout,
21
- completionKey)
22
- {
23
- set tSC = ..SetTimer(timeout,$g(completionKey))
24
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
25
- quit
26
- }
27
-
28
- Method dispatchSendRequestAsync(
29
- target,
30
- request,
31
- responseRequired,
32
- completionKey,
33
- description)
34
- {
35
- set tSC = ..SendRequestAsync(target,request,responseRequired,completionKey,description)
36
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
37
- quit
38
- }
39
-
40
- Method OnRequest(
41
- request As %Persistent,
42
- Output response As %Persistent) As %Status
43
- {
44
- set tSC = $$$OK
45
- try {
46
- set response = ..%class."_dispatch_on_request"($this,request)
47
- } catch ex {
48
- set tSC = ex.AsStatus()
49
- }
50
- quit tSC
51
- }
52
-
53
- /// Handle a 'Response'
54
- Method OnResponse(
55
- request As %Persistent,
56
- Output response As %Persistent,
57
- callRequest As %Persistent,
58
- callResponse As %Persistent,
59
- pCompletionKey As %String) As %Status
60
- {
61
- set tSC = $$$OK
62
- try {
63
- set response = ..%class."_dispatch_on_response"($this,request,response,callRequest,callResponse,pCompletionKey)
64
- } catch ex {
65
- set tSC = ex.AsStatus()
66
- }
67
- quit tSC
68
- }
69
-
70
- Method OnComplete(
71
- request As %Library.Persistent,
72
- ByRef response As %Library.Persistent) As %Status
73
- {
74
- set tSC = $$$OK
75
- try {
76
- set response = ..%class."_dispatch_on_complete"($this,request,response)
77
- } catch ex {
78
- set tSC = ex.AsStatus()
79
- }
80
- quit tSC
81
- }
82
-
83
- Method getPersistentProperty(name)
84
- {
85
- quit ..persistentProperties.GetAt(name)
86
- }
87
-
88
- Method setPersistentProperty(
89
- name,
90
- value)
91
- {
92
- quit ..persistentProperties.SetAt(value,name)
93
- }
94
-
95
8
  Storage Default
96
9
  {
97
- <Data name="BusinessProcessDefaultData1">
98
- <Subscript>"BusinessProcess"</Subscript>
99
- <Value name="1">
100
- <Value>%classpaths</Value>
101
- </Value>
102
- <Value name="2">
103
- <Value>%classname</Value>
104
- </Value>
105
- <Value name="3">
106
- <Value>%module</Value>
107
- </Value>
108
- <Value name="4">
109
- <Value>%settings</Value>
110
- </Value>
111
- <Value name="5">
112
- <Value>%class</Value>
113
- </Value>
114
- </Data>
115
- <Data name="persistentProperties">
116
- <Attribute>persistentProperties</Attribute>
117
- <Structure>subnode</Structure>
118
- <Subscript>"Grongier.PEX.BusinessProcess.persistentProperties"</Subscript>
119
- </Data>
120
- <DefaultData>BusinessProcessDefaultData1</DefaultData>
121
10
  <Type>%Storage.Persistent</Type>
122
11
  }
123
12
 
@@ -2,34 +2,7 @@
2
2
  Cambridge, Massachusetts, U.S.A. All rights reserved.
3
3
  Confidential property of InterSystems Corporation. */
4
4
 
5
- Class Grongier.PEX.BusinessService Extends (Ens.BusinessService, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
5
+ Class Grongier.PEX.BusinessService Extends IOP.BusinessService [ Inheritance = right, ProcedureBlock, System = 4 ]
6
6
  {
7
7
 
8
- Parameter SETTINGS = "%classname:Python BusinessService,%module:Python BusinessService,%settings:Python BusinessService,%classpaths:Python BusinessService";
9
-
10
- Method dispatchProcessInput(pInput As %RegisteredObject) As %RegisteredObject
11
- {
12
-
13
- quit ..%class."on_process_input"(pInput)
14
- }
15
-
16
- Method OnProcessInput(
17
- request As %RegisteredObject,
18
- Output response As %RegisteredObject) As %Status
19
- {
20
- set tSC = $$$OK
21
- try {
22
- try {
23
- set ..%class."_wait_for_next_call_interval" = ..%WaitForNextCallInterval
24
- } catch {}
25
- set response = ..%class."_dispatch_on_process_input"(request)
26
- try {
27
- set ..%WaitForNextCallInterval = ..%class."_wait_for_next_call_interval"
28
- } catch {}
29
- } catch ex {
30
- set tSC = ex.AsStatus()
31
- }
32
- quit tSC
33
- }
34
-
35
8
  }
@@ -4,200 +4,7 @@
4
4
 
5
5
  Include Ensemble
6
6
 
7
- Class Grongier.PEX.Common [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
7
+ Class Grongier.PEX.Common Extends IOP.Common [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
8
8
  {
9
9
 
10
- /// One or more Classpaths (separated by '|' character) needed in addition to the ones configured in the Java Gateway Service
11
- Property %classpaths As %String(MAXLEN = "");
12
-
13
- Property %classname As %String(MAXLEN = "");
14
-
15
- Property %module As %String(MAXLEN = "");
16
-
17
- Property %settings As %String(MAXLEN = "");
18
-
19
- /// Instance of class
20
- Property %class As %SYS.Python;
21
-
22
- /// Get Class
23
- Method GetClass() As %SYS.Python
24
- {
25
- Return ..%class
26
- }
27
-
28
- /// Get Classname
29
- Method GetClassname() As %String
30
- {
31
- Return ..%classname
32
- }
33
-
34
- /// Get Classname
35
- Method GetModule() As %String
36
- {
37
- Return ..%module
38
- }
39
-
40
- Method OnInit() As %Status
41
- {
42
- set tSC = $$$OK
43
- try {
44
- $$$ThrowOnError(..Connect())
45
- do ..%class."_dispatch_on_init"($this)
46
- } catch ex {
47
- set tSC = ex.AsStatus()
48
- }
49
- quit tSC
50
- }
51
-
52
- ClassMethod SetPythonPath(pClasspaths)
53
- {
54
- set sys = ##class(%SYS.Python).Import("sys")
55
-
56
- for i=0:1:(sys.path."__len__"()-1) {
57
- Try {
58
- if sys.path."__getitem__"(i) = pClasspaths {
59
- do sys.path."__delitem__"(i)
60
- }
61
- }
62
- Catch ex {
63
- // do nothing
64
- }
65
-
66
- }
67
- do sys.path.insert(0, pClasspaths)
68
- }
69
-
70
- Method Connect() As %Status
71
- {
72
- set tSC = $$$OK
73
- try {
74
-
75
- set container = $this
76
-
77
- //set classpass
78
- if ..%classpaths '="" {
79
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
80
- set extraClasspaths = $tr(container.%classpaths,delimiter,"|")
81
- for i=1:1:$l(extraClasspaths,"|") {
82
- set onePath = $p(extraClasspaths,"|",i)
83
- set onePath = ##class(%File).NormalizeDirectory(onePath)
84
- do ..SetPythonPath(onePath)
85
- }
86
- }
87
- if $isObject(..%class)=0 {
88
- set importlib = ##class(%SYS.Python).Import("importlib")
89
- set builtins = ##class(%SYS.Python).Import("builtins")
90
- set module = importlib."import_module"(..%module)
91
- set class = builtins.getattr(module, ..%classname)
92
- set ..%class = class."__new__"(class)
93
- }
94
- ;
95
- if ..%Extends("Grongier.PEX.InboundAdapter") || ..%Extends("Grongier.PEX.OutboundAdapter") {
96
- do ..%class."_set_iris_handles"($this,..BusinessHost)
97
- } elseif $this.%Extends("Grongier.PEX.BusinessProcess") {
98
- do ..%class."_set_iris_handles"($this,$$$NULLOREF)
99
- } else {
100
- do ..%class."_set_iris_handles"($this,..Adapter)
101
- }
102
- ;
103
- do ..SetPropertyValues()
104
- ;
105
- try {
106
- do ..%class."_dispatch_on_connected"($this)
107
- } catch ex {
108
- $$$LOGWARNING(ex.DisplayString())
109
- }
110
- ;
111
- } catch ex {
112
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
113
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
114
- }
115
- quit tSC
116
- }
117
-
118
- Method OnTearDown() As %Status
119
- {
120
- set tSC = $$$OK
121
- do ..%class."_dispatch_on_tear_down"()
122
- quit tSC
123
- }
124
-
125
- Method SetPropertyValues()
126
- {
127
- set remoteSettings = $tr(..%settings,$c(13))
128
- for i=1:1:$l(remoteSettings,$c(10)) {
129
- set oneLine = $p(remoteSettings,$c(10),i)
130
- set property = $p(oneLine,"=",1) continue:property=""
131
- set value = $p(oneLine,"=",2,*)
132
- try {
133
- set $property(..%class,property) = value
134
- } catch ex {
135
- $$$LOGWARNING(ex.DisplayString())
136
- }
137
- }
138
- quit
139
- }
140
-
141
- Method dispatchSendRequestSync(
142
- target,
143
- request,
144
- timeout,
145
- description) As %String
146
- {
147
- set tSC = ..SendRequestSync(target,request,.objResponse,timeout,description)
148
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
149
- quit $g(objResponse)
150
- }
151
-
152
- Method dispatchSendRequestAsync(
153
- target,
154
- request,
155
- description)
156
- {
157
- set tSC = ..SendRequestAsync(target,request,description)
158
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
159
- quit
160
- }
161
-
162
- ClassMethod OnGetConnections(
163
- Output pArray As %String,
164
- pItem As Ens.Config.Item)
165
- {
166
- // finds any settings of type Ens.DataType.ConfigName
167
- do ..GetPropertyConnections(.pArray,pItem)
168
-
169
- // Get settings
170
- do pItem.GetModifiedSetting("%classpaths", .tClasspaths)
171
- do pItem.GetModifiedSetting("%classname", .tClassname)
172
- do pItem.GetModifiedSetting("%module", .tModule)
173
-
174
- // try to instantiate class
175
- if tClasspaths '="" {
176
- set sys = ##class(%SYS.Python).Import("sys")
177
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
178
- set extraClasspaths = $tr(tClasspaths,delimiter,"|")
179
- for i=1:1:$l(extraClasspaths,"|") {
180
- set onePath = $p(extraClasspaths,"|",i)
181
- set onePath = ##class(%File).NormalizeDirectory(onePath)
182
- if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
183
- if onePath'="" do sys.path.append(onePath)
184
- }
185
- }
186
- set importlib = ##class(%SYS.Python).Import("importlib")
187
- set builtins = ##class(%SYS.Python).Import("builtins")
188
- set module = importlib."import_module"(tModule)
189
- set class = builtins.getattr(module, tClassname)
190
- set tClass = class."__new__"(class)
191
-
192
- set tPythonList = tClass."on_get_connections"()
193
- set tPythonListLen = tPythonList."__len__"()
194
- for i=0:1:(tPythonListLen-1) {
195
- set tPythonItem = tPythonList."__getitem__"(i)
196
- set pArray(tPythonItem) = ""
197
- #; set ^AALog(pItem.Name,tPythonItem) = ""
198
- }
199
-
200
- quit
201
- }
202
-
203
10
  }
@@ -4,54 +4,7 @@
4
4
 
5
5
  Include (%occInclude, Ensemble)
6
6
 
7
- Class Grongier.PEX.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
7
+ Class Grongier.PEX.Director Extends IOP.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
8
8
  {
9
9
 
10
- ClassMethod dispatchCreateBusinessService(pTargetDispatchName As %String) As Ens.BusinessService
11
- {
12
- set tSC = ##class(Ens.Director).CreateBusinessService(pTargetDispatchName,.service)
13
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
14
- quit service
15
- }
16
-
17
- ClassMethod dispatchListProductions() As %String
18
- {
19
- // Loop over the productions in this namespace
20
- Set tRS = ##class(%ResultSet).%New("Ens.Config.Production:ProductionStatus")
21
- If '$IsObject(tRS) Set tSC = %objlasterror Quit
22
-
23
- Set tSC = tRS.Execute()
24
- Quit:$$$ISERR(tSC)
25
-
26
- set tDict = ##class(%SYS.Python).Import("builtins").dict()
27
-
28
- While (tRS.Next()) {
29
- Set tProduction = tRS.Data("Production")
30
- Set tInfo = ##class(%SYS.Python).Import("builtins").dict()
31
- do tInfo."__setitem__"("Status",tRS.Data("Status"))
32
- do tInfo."__setitem__"("LastStartTime",tRS.Data("LastStartTime"))
33
- do tInfo."__setitem__"("LastStopTime",tRS.Data("LastStopTime"))
34
- do tInfo."__setitem__"("AutoStart",$G(^Ens.AutoStart)=tProduction)
35
- do tDict."__setitem__"(tProduction,tInfo)
36
- }
37
-
38
- Kill tRS
39
-
40
- return tDict
41
- }
42
-
43
- ClassMethod StatusProduction() As %String
44
- {
45
- Set sc = $$$OK
46
- Set tInfo = ##class(%SYS.Python).Import("builtins").dict()
47
- $$$ThrowOnError(##class(Ens.Director).GetProductionStatus(.tProdName,.tStatus))
48
- do tInfo."__setitem__"("Production",tProdName)
49
- do tInfo."__setitem__"("Status",$CASE(tStatus,$$$eProductionStateRunning:"running",
50
- $$$eProductionStateStopped:"stopped",
51
- $$$eProductionStateSuspended:"suspended",
52
- $$$eProductionStateTroubled:"toubled",
53
- :"unknown"))
54
- Return tInfo
55
- }
56
-
57
10
  }
@@ -1,29 +1,4 @@
1
- Class Grongier.PEX.DuplexOperation Extends Grongier.PEX.PrivateSessionDuplex
1
+ Class Grongier.PEX.DuplexOperation Extends IOP.DuplexOperation
2
2
  {
3
3
 
4
- ClassMethod OnBusinessType(pItem As Ens.Config.Item) As %Integer
5
- {
6
- Quit $$$eHostTypeOperation
7
- }
8
-
9
- XData MessageMap
10
- {
11
- <MapItems>
12
- <MapItem MessageType="Ens.Request"><Method>OnMessage</Method></MapItem>
13
- </MapItems>
14
- }
15
-
16
- Method OnMessage(
17
- request As %Library.Persistent,
18
- Output response As %Library.Persistent) As %Status
19
- {
20
- set tSC = $$$OK
21
- try {
22
- set response = ..%class."_dispatch_on_message"(request)
23
- } catch ex {
24
- set tSC = ex.AsStatus()
25
- }
26
- quit tSC
27
- }
28
-
29
4
  }