iris-pex-embedded-python 2.3.19__py3-none-any.whl → 2.3.21b1__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 (54) hide show
  1. grongier/cls/Grongier/PEX/Common.cls +115 -74
  2. grongier/pex/wsgi/handlers.py +51 -0
  3. intersystems_iris/_IRISOREF.py +6 -1
  4. intersystems_iris/dbapi/_DBAPI.py +16 -1
  5. intersystems_iris/dbapi/_Parameter.py +2 -0
  6. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/METADATA +32 -10
  7. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/RECORD +11 -53
  8. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/WHEEL +1 -1
  9. grongier/iris/Grongier/PEX/BusinessOperation.cls +0 -33
  10. grongier/iris/Grongier/PEX/BusinessProcess.cls +0 -100
  11. grongier/iris/Grongier/PEX/BusinessService.cls +0 -33
  12. grongier/iris/Grongier/PEX/Common.cls +0 -133
  13. grongier/iris/Grongier/PEX/Director.cls +0 -15
  14. grongier/iris/Grongier/PEX/Duplex/Operation.cls +0 -27
  15. grongier/iris/Grongier/PEX/Duplex/Process.cls +0 -211
  16. grongier/iris/Grongier/PEX/Duplex/Service.cls +0 -9
  17. grongier/iris/Grongier/PEX/InboundAdapter.cls +0 -22
  18. grongier/iris/Grongier/PEX/Message.cls +0 -126
  19. grongier/iris/Grongier/PEX/OutboundAdapter.cls +0 -34
  20. grongier/iris/Grongier/PEX/PickleMessage.cls +0 -58
  21. grongier/iris/Grongier/PEX/PrivateSession/Duplex.cls +0 -247
  22. grongier/iris/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -32
  23. grongier/iris/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -32
  24. grongier/iris/Grongier/PEX/PrivateSession/Message/Start.cls +0 -32
  25. grongier/iris/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -48
  26. grongier/iris/Grongier/PEX/Python.cls +0 -27
  27. grongier/iris/Grongier/PEX/Test.cls +0 -62
  28. grongier/iris/Grongier/PEX/Utils.cls +0 -312
  29. grongier/iris/__init__.py +0 -0
  30. grongier/pex/data/PEX/BusinessOperation.cls +0 -35
  31. grongier/pex/data/PEX/BusinessProcess.cls +0 -113
  32. grongier/pex/data/PEX/BusinessService.cls +0 -35
  33. grongier/pex/data/PEX/Common.cls +0 -146
  34. grongier/pex/data/PEX/Director.cls +0 -57
  35. grongier/pex/data/PEX/Duplex/Operation.cls +0 -29
  36. grongier/pex/data/PEX/Duplex/Process.cls +0 -229
  37. grongier/pex/data/PEX/Duplex/Service.cls +0 -9
  38. grongier/pex/data/PEX/InboundAdapter.cls +0 -22
  39. grongier/pex/data/PEX/Message.cls +0 -128
  40. grongier/pex/data/PEX/OutboundAdapter.cls +0 -36
  41. grongier/pex/data/PEX/PickleMessage.cls +0 -58
  42. grongier/pex/data/PEX/PrivateSession/Duplex.cls +0 -260
  43. grongier/pex/data/PEX/PrivateSession/Message/Ack.cls +0 -32
  44. grongier/pex/data/PEX/PrivateSession/Message/Poll.cls +0 -32
  45. grongier/pex/data/PEX/PrivateSession/Message/Start.cls +0 -32
  46. grongier/pex/data/PEX/PrivateSession/Message/Stop.cls +0 -48
  47. grongier/pex/data/PEX/Test.cls +0 -62
  48. grongier/pex/data/PEX/Utils.cls +0 -413
  49. iris/iris_site.py +0 -13
  50. iris/irisbuiltins.py +0 -97
  51. iris/irisloader.py +0 -199
  52. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/LICENSE +0 -0
  53. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/entry_points.txt +0 -0
  54. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/top_level.txt +0 -0
@@ -1,312 +0,0 @@
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.Utils [ Abstract ]
8
- {
9
-
10
- ClassMethod dispatchRegisterComponent(pModule As %String, pRemoteClassname As %String, pCLASSPATHS As %String = "", pOverwrite As %Boolean = 0, pProxyClassname As %String = "") As %Status
11
- {
12
- set tSc = $$$OK
13
- $$$ThrowOnError(##class(Grongier.PEX.Utils).RegisterComponent(pModule, pRemoteClassname, pCLASSPATHS, pOverwrite , pProxyClassname))
14
- return tSc
15
- }
16
-
17
- /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
18
- ClassMethod RegisterComponent(pModule As %String, pRemoteClassname As %String, pCLASSPATHS As %String = "", pOverwrite As %Boolean = 0, pProxyClassname As %String = "") As %Status
19
- {
20
- #dim tSC As %Status = $$$OK
21
- #dim ex As %Exception.AbstractException
22
- #dim tLanguage,tExtraClasspaths,tDelimiter,tOnePath As %String = ""
23
- #dim tClassDetails,tRemoteSettings As %String = ""
24
- #dim tClasspaths As %ListOfDataTypes
25
-
26
- Quit:(""=pRemoteClassname) $$$ERROR($$$EnsErrGeneral,"Remote Classname must be specified in order to register a Production EXtensions component")
27
- Quit:(""=pModule) $$$ERROR($$$EnsErrGeneral,"Must specify the module of the remote code.")
28
-
29
- Try {
30
-
31
- $$$ThrowOnError(..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings))
32
-
33
- Set tConnectionSettings("Classpaths") = pCLASSPATHS
34
- Set tConnectionSettings("Module") = pModule
35
- Set tConnectionSettings("Classname") = pRemoteClassname
36
- Set:(""=pProxyClassname) pProxyClassname = "User."_pRemoteClassname
37
-
38
- $$$ThrowOnError(..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite))
39
-
40
- } Catch ex {
41
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
42
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
43
- }
44
-
45
- Quit tSC
46
- }
47
-
48
- ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
49
- {
50
- #dim tSC As %Status = $$$OK
51
- #dim ex As %Exception.AbstractException
52
- #dim tIsPEX As %Boolean = 0
53
- #dim tClass As %Dictionary.CompiledClass
54
-
55
- Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Remote class name must be specified.")
56
-
57
- Try {
58
-
59
- If '##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
60
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("No proxy class defined for remote class '%1'.",pClassname))
61
- Quit
62
- }
63
- If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
64
- Set tClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname,,.tSC)
65
- Quit:$$$ISERR(tSC)
66
- If '$IsObject(tClass) {
67
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class for remote class '%1' could not be opened.",pClassname))
68
- Quit
69
- }
70
- Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
71
- }
72
- If tIsPEX {
73
- Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
74
- If $$$ISERR(tSC) {
75
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete proxy class for remote class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
76
- Quit
77
- }
78
- } Else {
79
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot delete class '%1' because it is not a PEX proxy class.",pClassname))
80
- Quit
81
- }
82
-
83
- } Catch ex {
84
- Set tSC = ex.AsStatus()
85
- }
86
-
87
- Quit tSC
88
- }
89
-
90
- // ..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings)
91
-
92
- ClassMethod GetRemoteClassInfo(pRemoteClassname As %String, pModule As %String, pClasspaths As %String, ByRef pClassDetails, ByRef pRemoteSettings) As %Status [ Internal, Private ]
93
- {
94
- #dim tSC As %Status = $$$OK
95
- #dim ex As %Exception.AbstractException
96
- #dim tGateway As %External.Gateway
97
- #dim tGatewayProxy As %Net.Remote.Object
98
-
99
- Try {
100
- if pClasspaths '="" {
101
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
102
- set extraClasspaths = $tr(pClasspaths,delimiter,"|")
103
- for i=1:1:$l(extraClasspaths,"|") {
104
- set onePath = $p(extraClasspaths,"|",i)
105
- set onePath = ##class(%File).NormalizeDirectory(onePath)
106
- if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
107
- if onePath'="" do ##class(Grongier.PEX.Python).SetClassPath(onePath)
108
- }
109
- }
110
- ;
111
-
112
- set tClass = ##class(Grongier.PEX.Python).GetInstanceFromModuleClassName(pModule,pRemoteClassname)
113
-
114
- If $IsObject(tClass) {
115
- #; List of information about the class as a whole - $lb(SuperClass, Description, InfoURL, IconURL, Adapter)
116
- Set pClassDetails = tClass."_get_info"()
117
- #; List of information about the various properties of the class
118
- #; List of lists of form $lb(propName,dataType,defaultVal,required,category,description)
119
- Set pRemoteSettings = tClass."_get_properties"()
120
- } Else {
121
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Error opening gateway proxy for class '%1'"),pRemoteClassname)
122
- }
123
- } Catch ex {
124
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
125
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
126
- }
127
-
128
- Quit tSC
129
- }
130
-
131
- /// Set tConnectionSettings("Classpaths") = pCLASSPATHS
132
- /// Set tConnectionSettings("Module") = pModule
133
- /// Set tConnectionSettings("Classname") = pRemoteClassname
134
- /// Set:(""=pProxyClassname) pProxyClassname = pRemoteClassname
135
- ///
136
- /// Set tSC = ..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite)
137
- /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
138
- ClassMethod GenerateProxyClass(pClassname As %String, ByRef pConnectionSettings, pClassDetails As %String = "", pRemoteSettings As %String = "", pOverwrite As %Boolean = 0) As %Status [ Internal, Private ]
139
- {
140
- #dim tSC As %Status = $$$OK
141
- #dim ex As %Exception.AbstractException
142
-
143
- Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Class name must be specified in order to generate a proxy class for this Production EXtensions component")
144
-
145
- Try {
146
-
147
- If ##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
148
- If 'pOverwrite {
149
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class '%1' already exists.",pClassname))
150
- Quit
151
- } Else {
152
- #dim tIsPEX As %Boolean = 0
153
- If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
154
- #dim tClass As %Dictionary.CompiledClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname)
155
- If '$IsObject(tClass) {
156
- Set tSC = $$$ERROR($$$EnsErrGeneral,"Class not found")
157
- Quit
158
- }
159
- Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
160
- }
161
- If tIsPEX {
162
- Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
163
- If $$$ISERR(tSC) {
164
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete existing proxy class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
165
- Quit
166
- }
167
- } Else {
168
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot overwrite class '%1' because it is not a PEX proxy class.",pClassname))
169
- Quit
170
- }
171
- }
172
- }
173
-
174
- #; create subclass of the ObjectScript Business Host
175
- #dim tCOSClass As %Dictionary.ClassDefinition
176
- Set tCOSClass = ##class(%Dictionary.ClassDefinition).%New()
177
- Set tCOSClass.Name = pClassname
178
-
179
- #dim tSuperClass As %String = pClassDetails."__getitem__"(0)
180
- If (""=tSuperClass) {
181
- Set tSC = $$$ERROR($$$EnsErrGeneral,"No PEX superclass found.")
182
- Quit
183
- }
184
- If '$Case($P(tSuperClass,".",*),"DuplexProcess":1,"DuplexService":1,"DuplexOperation":1,"InboundAdapter":1,"OutboundAdapter":1,"BusinessService":1,"BusinessProcess":1,"BusinessOperation":1,:0) {
185
- Set tSC = $$$ERROR($$$EnsErrGeneral,"Invalid superclass")
186
- Quit
187
- }
188
- Set tSuperClass = "Grongier.PEX."_$P(tSuperClass,".",*)
189
-
190
- Set tCOSClass.Super = tSuperClass
191
- Set tCOSClass.GeneratedBy = $CLASSNAME()
192
- Set tCOSClass.ClassVersion = $$$CLASSDEFINITIONVERSION
193
- #dim tDescription As %String = pClassDetails."__getitem__"(1)
194
- If (""'=tDescription) {
195
- Set tCOSClass.Description = $Replace(tDescription,$C(10),$C(13,10))
196
- }
197
-
198
- #; Do not display any of the connection settings
199
- #dim tSETTINGSParamValue As %String = "%classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type"
200
-
201
- #dim tPropClassname As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
202
- Set tPropClassname.Name = "%classname"
203
- Set tPropClassname.Type = "%String"
204
- Set tPropClassname.InitialExpression = $$$quote(pConnectionSettings("Classname"))
205
- Set tPropClassname.Internal = 1
206
- Set tSC = tCOSClass.Properties.Insert(tPropClassname)
207
- Quit:$$$ISERR(tSC)
208
-
209
-
210
- #dim tPropClasspaths As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
211
- Set tPropClasspaths.Name = "%classpaths"
212
- Set tPropClasspaths.Type = "%String"
213
- Set tSC = tPropClasspaths.Parameters.SetAt("","MAXLEN")
214
- Quit:$$$ISERR(tSC)
215
- Set tPropClasspaths.InitialExpression = $$$quote(pConnectionSettings("Classpaths"))
216
- Set tPropClasspaths.Description = "One or more Classpaths (separated by '|' character) needed in addition to the ones configured in the Remote Gateway"
217
- Set tSC = tCOSClass.Properties.Insert(tPropClasspaths)
218
- Quit:$$$ISERR(tSC)
219
-
220
-
221
- #dim tPropLanguage As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
222
- Set tPropLanguage.Name = "%module"
223
- Set tPropLanguage.Type = "%String"
224
- Set tPropLanguage.Internal = 1
225
- Set tPropLanguage.InitialExpression = $$$quote(pConnectionSettings("Module"))
226
- Set tSC = tCOSClass.Properties.Insert(tPropLanguage)
227
- Quit:$$$ISERR(tSC)
228
-
229
- If $Case(tSuperClass,"Grongier.PEX.BusinessService":1,"Grongier.PEX.BusinessOperation":1,"Grongier.PEX.DuplexService":1,"Grongier.PEX.DuplexOperation":1,:0) {
230
-
231
- If (##class(Grongier.PEX.Python).Len(pClassDetails)>4) { //Adaptor
232
-
233
- #dim tAdapterClass = pClassDetails."__getitem__"(4)
234
- #; May want to issue a warning in the UI if the Adapter class does not exist
235
- #; but we don't check here because it does compile and may just be that the user is registering the Service/Operation before the Adapter
236
- #dim tADAPTERParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
237
- Set tADAPTERParam.Name = "ADAPTER"
238
- Set tADAPTERParam.Default = tAdapterClass
239
- Set tSC = tCOSClass.Parameters.Insert(tADAPTERParam)
240
- Quit:$$$ISERR(tSC)
241
- }
242
- }
243
-
244
- set type = ""
245
- set:($Case(tSuperClass,"Grongier.PEX.InboundAdapter":1,"Grongier.PEX.OutboundAdapter":1,:0)) type = "Adapter"
246
- set tSETTINGSParamValue = $REPLACE(tSETTINGSParamValue,"$type",type)
247
-
248
- #dim tSETTINGSParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
249
- Set tSETTINGSParam.Name = "SETTINGS"
250
- Set tSETTINGSParam.Default = tSETTINGSParamValue
251
- Set tSC = tCOSClass.Parameters.Insert(tSETTINGSParam)
252
- Quit:$$$ISERR(tSC)
253
-
254
- Set tSC = tCOSClass.%Save()
255
- Quit:$$$ISERR(tSC)
256
-
257
- Set tSC = $System.OBJ.Compile(pClassname,"-d")
258
-
259
- } Catch ex {
260
- Set tSC = ex.AsStatus()
261
- }
262
-
263
- Quit tSC
264
- }
265
-
266
- // Thanks to Alex Woodhead for this serializer
267
- ClassMethod ListFrompyList(ByRef pyList As %SYS.Python = {$$$NULLOREF}, ByRef impBi As %SYS.Python = {##class(%SYS.Python).Import("builtins")}, msgkeys = "") As %SYS.Python [ ProcedureBlock = 1 ]
268
- {
269
- set ret=$LB()
270
- // How to get length of list
271
- set listlen=impBi.len(pyList)
272
- for i=1:1:listlen {
273
- set data=..pyListGet(i,pyList)
274
- // if data is also a list // TODO
275
- if $IsObject(data) {
276
- if ..pyListIs(data) {
277
- set data=..ListFrompyList(data,impBi,,msgkeys_"["_i_"]")
278
- } else {
279
- set $ZE="Class "_..%ClassName(1)_" Method ListFrompyList. Unsupported value type """_..pyTypeName(data)_""" at position "_msgkeys_"["_i_"]"
280
- do BACK^%ETN
281
- }
282
- }
283
- // add string / numeric / IRIS LIST to ret
284
- set ret=$LU(ret,i,data)
285
- }
286
- quit ret
287
- }
288
-
289
- ClassMethod pyListIs(ByRef pyList As %SYS.Python) As %SYS.Python [ Language = python ]
290
- {
291
- return (type(pyList)==list)
292
- }
293
-
294
- /// Returns empty string on error
295
- /// position starts at one to keep same as IRIS List
296
- ClassMethod pyListGet(position As %Integer, ByRef pyList As %SYS.Python) As %SYS.Python [ Language = python ]
297
- {
298
- ret=""
299
- try:
300
- ret=(pyList[position-1])
301
- except:
302
- print("Error in pyListGet")
303
-
304
- return ret
305
- }
306
-
307
- ClassMethod pyTypeName(obj As %SYS.Python) As %String [ Language = python ]
308
- {
309
- return type(obj).__name__
310
- }
311
-
312
- }
grongier/iris/__init__.py DELETED
File without changes
@@ -1,35 +0,0 @@
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 (Ens.BusinessOperation, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
- {
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
- }
@@ -1,113 +0,0 @@
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 (Ens.BusinessProcess, Grongier.PEX.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 OnRequest(
29
- request As %Persistent,
30
- Output response As %Persistent) As %Status
31
- {
32
- set tSC = $$$OK
33
- try {
34
- set response = ..%class."_dispatch_on_request"($this,request)
35
- } catch ex {
36
- set tSC = ex.AsStatus()
37
- }
38
- quit tSC
39
- }
40
-
41
- /// Handle a 'Response'
42
- Method OnResponse(
43
- request As %Persistent,
44
- Output response As %Persistent,
45
- callRequest As %Persistent,
46
- callResponse As %Persistent,
47
- pCompletionKey As %String) As %Status
48
- {
49
- set tSC = $$$OK
50
- try {
51
- set response = ..%class."_dispatch_on_response"($this,request,response,callRequest,callResponse,pCompletionKey)
52
- } catch ex {
53
- set tSC = ex.AsStatus()
54
- }
55
- quit tSC
56
- }
57
-
58
- Method OnComplete(
59
- request As %Library.Persistent,
60
- ByRef response As %Library.Persistent) As %Status
61
- {
62
- set tSC = $$$OK
63
- try {
64
- set tSC = ..Connect() quit:$$$ISERR(tSC)
65
- set response = ..%class."_dispatch_on_complete"($this,request,response)
66
- } catch ex {
67
- set tSC = ex.AsStatus()
68
- }
69
- quit tSC
70
- }
71
-
72
- Method getPersistentProperty(name)
73
- {
74
- quit ..persistentProperties.GetAt(name)
75
- }
76
-
77
- Method setPersistentProperty(
78
- name,
79
- value)
80
- {
81
- quit ..persistentProperties.SetAt(value,name)
82
- }
83
-
84
- Storage Default
85
- {
86
- <Data name="BusinessProcessDefaultData1">
87
- <Subscript>"BusinessProcess"</Subscript>
88
- <Value name="1">
89
- <Value>%classpaths</Value>
90
- </Value>
91
- <Value name="2">
92
- <Value>%classname</Value>
93
- </Value>
94
- <Value name="3">
95
- <Value>%module</Value>
96
- </Value>
97
- <Value name="4">
98
- <Value>%settings</Value>
99
- </Value>
100
- <Value name="5">
101
- <Value>%class</Value>
102
- </Value>
103
- </Data>
104
- <Data name="persistentProperties">
105
- <Attribute>persistentProperties</Attribute>
106
- <Structure>subnode</Structure>
107
- <Subscript>"Grongier.PEX.BusinessProcess.persistentProperties"</Subscript>
108
- </Data>
109
- <DefaultData>BusinessProcessDefaultData1</DefaultData>
110
- <Type>%Storage.Persistent</Type>
111
- }
112
-
113
- }
@@ -1,35 +0,0 @@
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 (Ens.BusinessService, Grongier.PEX.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
- }
@@ -1,146 +0,0 @@
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 [ 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
- Method Connect() As %Status
53
- {
54
- set tSC = $$$OK
55
- try {
56
-
57
- set container = $this
58
-
59
- //set classpass
60
- if ..%classpaths '="" {
61
- set sys = ##class(%SYS.Python).Import("sys")
62
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
63
- set extraClasspaths = $tr(container.%classpaths,delimiter,"|")
64
- for i=1:1:$l(extraClasspaths,"|") {
65
- set onePath = $p(extraClasspaths,"|",i)
66
- set onePath = ##class(%File).NormalizeDirectory(onePath)
67
- if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
68
- if onePath'="" do sys.path.append(onePath)
69
- }
70
- }
71
- if $isObject(..%class)=0 {
72
- set importlib = ##class(%SYS.Python).Import("importlib")
73
- set builtins = ##class(%SYS.Python).Import("builtins")
74
- set module = importlib."import_module"(..%module)
75
- set class = builtins.getattr(module, ..%classname)
76
- set ..%class = class."__new__"(class)
77
- }
78
- ;
79
- if ..%Extends("Grongier.PEX.InboundAdapter") || ..%Extends("Grongier.PEX.OutboundAdapter") {
80
- do ..%class."_set_iris_handles"($this,..BusinessHost)
81
- } elseif $this.%Extends("Grongier.PEX.BusinessProcess") {
82
- do ..%class."_set_iris_handles"($this,$$$NULLOREF)
83
- } else {
84
- do ..%class."_set_iris_handles"($this,..Adapter)
85
- }
86
- ;
87
- do ..SetPropertyValues()
88
- ;
89
- try {
90
- do ..%class."_dispatch_on_connected"($this)
91
- } catch ex {
92
- $$$LOGWARNING(ex.DisplayString())
93
- }
94
- ;
95
- } catch ex {
96
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
97
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
98
- }
99
- quit tSC
100
- }
101
-
102
- Method OnTearDown() As %Status
103
- {
104
- set tSC = $$$OK
105
- do ..%class."_dispatch_on_tear_down"()
106
- quit tSC
107
- }
108
-
109
- Method SetPropertyValues()
110
- {
111
- set remoteSettings = $tr(..%settings,$c(13))
112
- for i=1:1:$l(remoteSettings,$c(10)) {
113
- set oneLine = $p(remoteSettings,$c(10),i)
114
- set property = $p(oneLine,"=",1) continue:property=""
115
- set value = $p(oneLine,"=",2,*)
116
- try {
117
- set $property(..%class,property) = value
118
- } catch ex {
119
- $$$LOGWARNING(ex.DisplayString())
120
- }
121
- }
122
- quit
123
- }
124
-
125
- Method dispatchSendRequestSync(
126
- target,
127
- request,
128
- timeout,
129
- description) As %String
130
- {
131
- set tSC = ..SendRequestSync(target,request,.objResponse,timeout,description)
132
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
133
- quit $g(objResponse)
134
- }
135
-
136
- Method dispatchSendRequestAsync(
137
- target,
138
- request,
139
- description)
140
- {
141
- set tSC = ..SendRequestAsync(target,request,description)
142
- if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
143
- quit
144
- }
145
-
146
- }
@@ -1,57 +0,0 @@
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 [ 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
- 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
- }