iris-pex-embedded-python 2.3.27b2__py3-none-any.whl → 3.2.1b2__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 (85) hide show
  1. grongier/cls/Grongier/PEX/BusinessOperation.cls +1 -28
  2. grongier/cls/Grongier/PEX/BusinessProcess.cls +1 -100
  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 +2 -150
  25. grongier/pex/_common.py +1 -347
  26. grongier/pex/_director.py +1 -286
  27. grongier/pex/_utils.py +1 -369
  28. intersystems_iris/_ConnectionInformation.py +22 -20
  29. intersystems_iris/dbapi/_DBAPI.py +6 -1
  30. intersystems_iris/dbapi/_ResultSetRow.py +26 -15
  31. intersystems_iris/dbapi/preparser/_PreParser.py +4 -1
  32. iop/__init__.py +24 -0
  33. iop/__main__.py +4 -0
  34. iop/_business_host.py +675 -0
  35. iop/_business_operation.py +71 -0
  36. iop/_business_process.py +220 -0
  37. {grongier/pex → iop}/_business_service.py +2 -2
  38. iop/_cli.py +141 -0
  39. iop/_common.py +352 -0
  40. iop/_director.py +301 -0
  41. {grongier/pex → iop}/_inbound_adapter.py +1 -1
  42. iop/_log_manager.py +81 -0
  43. {grongier/pex → iop}/_message.py +1 -1
  44. {grongier/pex → iop}/_outbound_adapter.py +1 -1
  45. {grongier/pex → iop}/_private_session_duplex.py +3 -2
  46. {grongier/pex → iop}/_private_session_process.py +2 -2
  47. iop/_utils.py +458 -0
  48. iop/cls/IOP/BusinessOperation.cls +35 -0
  49. iop/cls/IOP/BusinessProcess.cls +124 -0
  50. iop/cls/IOP/BusinessService.cls +35 -0
  51. iop/cls/IOP/Common.cls +344 -0
  52. iop/cls/IOP/Director.cls +62 -0
  53. iop/cls/IOP/Duplex/Operation.cls +29 -0
  54. iop/cls/IOP/Duplex/Process.cls +229 -0
  55. iop/cls/IOP/Duplex/Service.cls +9 -0
  56. iop/cls/IOP/InboundAdapter.cls +22 -0
  57. iop/cls/IOP/Message/JSONSchema.cls +125 -0
  58. iop/cls/IOP/Message.cls +729 -0
  59. iop/cls/IOP/OutboundAdapter.cls +36 -0
  60. iop/cls/IOP/PickleMessage.cls +58 -0
  61. iop/cls/IOP/PrivateSession/Duplex.cls +260 -0
  62. iop/cls/IOP/PrivateSession/Message/Ack.cls +32 -0
  63. iop/cls/IOP/PrivateSession/Message/Poll.cls +32 -0
  64. iop/cls/IOP/PrivateSession/Message/Start.cls +32 -0
  65. iop/cls/IOP/PrivateSession/Message/Stop.cls +48 -0
  66. iop/cls/IOP/Service/WSGI.cls +310 -0
  67. iop/cls/IOP/Test.cls +85 -0
  68. iop/cls/IOP/Utils.cls +378 -0
  69. iop/wsgi/handlers.py +104 -0
  70. iris_pex_embedded_python-3.2.1b2.dist-info/METADATA +90 -0
  71. iris_pex_embedded_python-3.2.1b2.dist-info/RECORD +139 -0
  72. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b2.dist-info}/WHEEL +1 -1
  73. iris_pex_embedded_python-3.2.1b2.dist-info/entry_points.txt +2 -0
  74. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b2.dist-info}/top_level.txt +1 -1
  75. grongier/pex/_business_operation.py +0 -70
  76. grongier/pex/_business_process.py +0 -215
  77. iris/__init__.py +0 -60
  78. iris/__init__.pyi +0 -236
  79. iris/iris_ipm.py +0 -40
  80. iris/iris_ipm.pyi +0 -17
  81. iris_pex_embedded_python-2.3.27b2.dist-info/METADATA +0 -1384
  82. iris_pex_embedded_python-2.3.27b2.dist-info/RECORD +0 -113
  83. iris_pex_embedded_python-2.3.27b2.dist-info/entry_points.txt +0 -2
  84. {grongier/pex → iop}/_pickle_message.py +0 -0
  85. {iris_pex_embedded_python-2.3.27b2.dist-info → iris_pex_embedded_python-3.2.1b2.dist-info}/LICENSE +0 -0
@@ -0,0 +1,124 @@
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 IOP.BusinessProcess Extends (Ens.BusinessProcess, IOP.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
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
+ Storage Default
96
+ {
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>"IOP.BusinessProcess.persistentProperties"</Subscript>
119
+ </Data>
120
+ <DefaultData>BusinessProcessDefaultData1</DefaultData>
121
+ <Type>%Storage.Persistent</Type>
122
+ }
123
+
124
+ }
@@ -0,0 +1,35 @@
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 IOP.BusinessService Extends (Ens.BusinessService, IOP.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
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
+ }
iop/cls/IOP/Common.cls ADDED
@@ -0,0 +1,344 @@
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 IOP.Common [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
8
+ {
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("IOP.InboundAdapter") || ..%Extends("IOP.OutboundAdapter") {
96
+ do ..%class."_set_iris_handles"($this,..BusinessHost)
97
+ } elseif $this.%Extends("IOP.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
+ if $isObject(..%class) {
122
+ try {
123
+ do ..%class."_dispatch_on_tear_down"()
124
+ } catch ex {
125
+ set tSC = ex.AsStatus()
126
+ }
127
+ }
128
+ quit tSC
129
+ }
130
+
131
+ Method SetPropertyValues()
132
+ {
133
+ set remoteSettings = $tr(..%settings,$c(13))
134
+ for i=1:1:$l(remoteSettings,$c(10)) {
135
+ set oneLine = $p(remoteSettings,$c(10),i)
136
+ set property = $p(oneLine,"=",1) continue:property=""
137
+ set value = $p(oneLine,"=",2,*)
138
+ try {
139
+ set $property(..%class,property) = value
140
+ } catch ex {
141
+ $$$LOGWARNING(ex.DisplayString())
142
+ }
143
+ }
144
+ quit
145
+ }
146
+
147
+ Method dispatchSendRequestSync(
148
+ pTarget,
149
+ pRequest,
150
+ timeout,
151
+ pDescription) As %String
152
+ {
153
+ set tSC = ..SendRequestSync(pTarget,pRequest,.objResponse,timeout,pDescription)
154
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
155
+ quit $g(objResponse)
156
+ }
157
+
158
+ Method dispatchSendRequestSyncMultiple(
159
+ pCallStructList As %List,
160
+ pTimeout As %Numeric = -1) As %List
161
+ {
162
+ set builtins = ##class(%SYS.Python).Import("builtins")
163
+ // Convert %List to multidimensional array
164
+ set tCallStructList=builtins.len(pCallStructList)
165
+ for i=0:1:builtins.len(pCallStructList)-1 {
166
+ set tCallStructList(i+1) = pCallStructList."__getitem__"(i)
167
+ }
168
+
169
+ set tSC = ..SendRequestSyncMultiple(.tCallStructList,pTimeout)
170
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
171
+
172
+ // Convert multidimensional array to Python list
173
+ set tResponseList = builtins.list()
174
+
175
+ for i=1:1:tCallStructList {
176
+ do tResponseList.append(tCallStructList(i))
177
+ }
178
+ quit tResponseList
179
+ }
180
+
181
+ Method dispatchSendRequestAsync(
182
+ pTarget,
183
+ pRequest,
184
+ pDescription)
185
+ {
186
+ set tSC = ..SendRequestAsync(pTarget,pRequest,pDescription)
187
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
188
+ quit
189
+ }
190
+
191
+ ClassMethod OnGetConnections(
192
+ Output pArray As %String,
193
+ pItem As Ens.Config.Item)
194
+ {
195
+ // finds any settings of type Ens.DataType.ConfigName
196
+ do ..GetPropertyConnections(.pArray,pItem)
197
+
198
+ // Get settings
199
+ do pItem.GetModifiedSetting("%classpaths", .tClasspaths)
200
+ do pItem.GetModifiedSetting("%classname", .tClassname)
201
+ do pItem.GetModifiedSetting("%module", .tModule)
202
+
203
+ // try to instantiate class
204
+ if tClasspaths '="" {
205
+ set sys = ##class(%SYS.Python).Import("sys")
206
+ set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
207
+ set extraClasspaths = $tr(tClasspaths,delimiter,"|")
208
+ for i=1:1:$l(extraClasspaths,"|") {
209
+ set onePath = $p(extraClasspaths,"|",i)
210
+ set onePath = ##class(%File).NormalizeDirectory(onePath)
211
+ if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
212
+ if onePath'="" do sys.path.append(onePath)
213
+ }
214
+ }
215
+ set importlib = ##class(%SYS.Python).Import("importlib")
216
+ set builtins = ##class(%SYS.Python).Import("builtins")
217
+ set module = importlib."import_module"(tModule)
218
+ set class = builtins.getattr(module, tClassname)
219
+ set tClass = class."__new__"(class)
220
+
221
+ set tPythonList = tClass."on_get_connections"()
222
+ set tPythonListLen = tPythonList."__len__"()
223
+ for i=0:1:(tPythonListLen-1) {
224
+ set tPythonItem = tPythonList."__getitem__"(i)
225
+ set pArray(tPythonItem) = ""
226
+ #; set ^AALog(pItem.Name,tPythonItem) = ""
227
+ }
228
+
229
+ quit
230
+ }
231
+
232
+ Method dispatchSendRequestAsyncNG(
233
+ pTarget,
234
+ pRequest,
235
+ pTimeout,
236
+ pDescription,
237
+ ByRef pMessageHeaderId,
238
+ ByRef pQueueName,
239
+ ByRef pEndTime) As %String
240
+ {
241
+ set tSC=$$$OK, tResponse=$$$NULLOREF
242
+ try {
243
+
244
+ set tTargetDispatchName=pTarget
245
+ set tTargetConfigName=$get($$$DispatchNameToConfigName(pTarget))
246
+ if tTargetConfigName="" set tSC=$$$EnsError($$$EnsErrBusinessDispatchNameNotRegistered,tTargetDispatchName) quit
247
+ set tTargetBusinessClass = $$$ConfigClassName(tTargetConfigName)
248
+ set tINVOCATION=$classmethod(tTargetBusinessClass,"%GetParameter","INVOCATION")
249
+ if (tINVOCATION'="Queue")&&(tINVOCATION'="InProc") set tSC=$$$ERROR($$$EnsErrParameterInvocationInvalid,tTargetBusinessClass) quit
250
+
251
+ quit:$$$ISERR(tSC)
252
+ ;
253
+ set tStartTime=$zh
254
+ set:pTimeout'=-1 tEndTime=$zh+pTimeout
255
+
256
+ if tINVOCATION="InProc" {
257
+ set tTimeout=$s(pTimeout=-1:-1,1:tEndTime-$zh)
258
+ if (pTimeout'=-1)&&(tTimeout<0) quit
259
+ set tSC=..SendRequestSync(tTargetConfigName,pRequest,.tResponse,tTimeout,pDescription)
260
+ return tResponse
261
+ } elseif tINVOCATION="Queue" {
262
+ Set tSessionId=..%SessionId
263
+ Set tSuperSession = ..%SuperSession
264
+ Set tSC = ##class(Ens.MessageHeader).NewRequestMessage(.tRequestHeader,pRequest,.tSessionId,.tSuperSession) quit:$$$ISERR(tSC)
265
+ Set ..%SessionId=tSessionId
266
+ Set ..%SuperSession=tSuperSession
267
+ Set tRequestHeader.SourceConfigName = ..%ConfigName
268
+ Set tRequestHeader.TargetConfigName = tTargetConfigName
269
+ Set tRequestHeader.SourceBusinessType = $$$ConfigBusinessType($$$DispatchNameToConfigName(..%ConfigName))
270
+ Set tRequestHeader.TargetBusinessType = $$$ConfigBusinessType($$$DispatchNameToConfigName(tTargetConfigName))
271
+ Set tRequestHeader.TargetQueueName = $$$getConfigQueueName($$$DispatchNameToConfigName(tTargetConfigName),..%SessionId)
272
+ Set tRequestHeader.ReturnQueueName = $$$queueSyncCallQueueName
273
+ Set tRequestHeader.BusinessProcessId = ""
274
+ Set tRequestHeader.Priority = $$$eMessagePriorityAsync
275
+ Set tRequestHeader.Description = pDescription
276
+ Set tSC = ##class(Ens.Queue).Create($$$queueSyncCallQueueName) quit:$$$ISERR(tSC)
277
+ Set tSC = ##class(Ens.Queue).EnQueue(tRequestHeader) quit:$$$ISERR(tSC)
278
+ Set pMessageHeaderId = tRequestHeader.MessageId()
279
+ Set pQueueName = $$$queueSyncCallQueueName
280
+ Set:(pTimeout'=-1) pEndTime = tEndTime
281
+ }
282
+ }
283
+ catch {
284
+ set tSC = $$$EnsSystemError
285
+ }
286
+ quit tSC
287
+ }
288
+
289
+ Method dispatchIsRequestDone(
290
+ pTimeout,
291
+ pEndTime,
292
+ pQueueName,
293
+ pMessageHeaderId,
294
+ ByRef pResponse) As %Status
295
+ {
296
+
297
+ set tSC=$$$OK
298
+ try {
299
+ set tTimeout=$s(pTimeout=-1:-1,1:pEndTime-$zh)
300
+
301
+ set tSC = ##class(Ens.Queue).DeQueue($$$queueSyncCallQueueName,.tResponseHeader,tTimeout,.tIsTimedOut,0) Quit:$$$ISERR(tSC)
302
+
303
+ quit:$IsObject(tResponseHeader)=0
304
+
305
+ set tFound = $select(tResponseHeader.CorrespondingMessageId: pMessageHeaderId=tResponseHeader.CorrespondingMessageId, 1: 0)
306
+ if tFound=0 {
307
+
308
+ set tSC = ##class(Ens.Queue).EnQueue(tResponseHeader)
309
+ Kill $$$EnsActiveMessage($$$SystemName_":"_$Job)
310
+ }
311
+ else {
312
+
313
+ if tIsTimedOut || ((pTimeout'=-1)&&(tTimeout<0)) {
314
+
315
+ do tResponseHeader.SetStatus($$$eMessageStatusDiscarded)
316
+ return $$$ERROR($$$EnsErrFailureTimeout, tTimeout, $$$StatusDisplayString(tSC), $$$CurrentClass)
317
+ }
318
+ if tResponseHeader.IsError {
319
+
320
+ do tResponseHeader.SetStatus($$$eMessageStatusCompleted)
321
+ return $$$EnsError($$$EnsErrGeneral,"Error message received: "_tResponseHeader.ErrorText)
322
+
323
+ }
324
+ if tResponseHeader.MessageBodyClassName'="" {
325
+
326
+ set tResponse = $classmethod(tResponseHeader.MessageBodyClassName,"%OpenId",tResponseHeader.MessageBodyId,,.tSC)
327
+ if '$IsObject(tResponse) return $$$EnsError($$$EnsErrGeneral,"Could not open MessageBody "_tResponseHeader.MessageBodyId_" for MessageHeader #"_tResponseHeader.%Id()_" with body class "_tResponseHeader.MessageBodyClassName_":"_$$$StatusDisplayString(tSC))
328
+ } else {
329
+
330
+ set tResponse=$$$NULLOREF
331
+ }
332
+ set pResponse=tResponse
333
+ do tResponseHeader.SetStatus($$$eMessageStatusCompleted)
334
+ set tSC = 2
335
+
336
+ }
337
+ }
338
+ catch ex {
339
+ set tSC = ex.AsStatus()
340
+ }
341
+ quit tSC
342
+ }
343
+
344
+ }
@@ -0,0 +1,62 @@
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 IOP.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
8
+ {
9
+
10
+ ClassMethod dispatchCreateBusinessService(pTargetDispatchName As %String) As Ens.BusinessService
11
+ {
12
+ set tSC = ##class(Ens.Director).CreateBusinessService(pTargetDispatchName,.service)
13
+
14
+ // Hack to prevent job to be registered in the production
15
+ do ##class(Ens.Job).UnRegister(pTargetDispatchName,$JOB)
16
+
17
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
18
+
19
+ quit service
20
+ }
21
+
22
+ ClassMethod dispatchListProductions() As %String
23
+ {
24
+ // Loop over the productions in this namespace
25
+ Set tRS = ##class(%ResultSet).%New("Ens.Config.Production:ProductionStatus")
26
+ If '$IsObject(tRS) Set tSC = %objlasterror Quit
27
+
28
+ Set tSC = tRS.Execute()
29
+ Quit:$$$ISERR(tSC)
30
+
31
+ set tDict = ##class(%SYS.Python).Import("builtins").dict()
32
+
33
+ While (tRS.Next()) {
34
+ Set tProduction = tRS.Data("Production")
35
+ Set tInfo = ##class(%SYS.Python).Import("builtins").dict()
36
+ do tInfo."__setitem__"("Status",tRS.Data("Status"))
37
+ do tInfo."__setitem__"("LastStartTime",tRS.Data("LastStartTime"))
38
+ do tInfo."__setitem__"("LastStopTime",tRS.Data("LastStopTime"))
39
+ do tInfo."__setitem__"("AutoStart",$G(^Ens.AutoStart)=tProduction)
40
+ do tDict."__setitem__"(tProduction,tInfo)
41
+ }
42
+
43
+ Kill tRS
44
+
45
+ return tDict
46
+ }
47
+
48
+ ClassMethod StatusProduction() As %String
49
+ {
50
+ Set sc = $$$OK
51
+ Set tInfo = ##class(%SYS.Python).Import("builtins").dict()
52
+ $$$ThrowOnError(##class(Ens.Director).GetProductionStatus(.tProdName,.tStatus))
53
+ do tInfo."__setitem__"("Production",tProdName)
54
+ do tInfo."__setitem__"("Status",$CASE(tStatus,$$$eProductionStateRunning:"running",
55
+ $$$eProductionStateStopped:"stopped",
56
+ $$$eProductionStateSuspended:"suspended",
57
+ $$$eProductionStateTroubled:"toubled",
58
+ :"unknown"))
59
+ Return tInfo
60
+ }
61
+
62
+ }
@@ -0,0 +1,29 @@
1
+ Class IOP.DuplexOperation Extends IOP.PrivateSessionDuplex
2
+ {
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
+ }