iris-pex-embedded-python 2.3.3__tar.gz → 2.3.5__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.

Files changed (50) hide show
  1. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/PKG-INFO +1 -1
  2. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/setup.py +3 -3
  3. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_process.py +7 -1
  4. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_cli.py +9 -1
  5. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_common.py +4 -3
  6. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_utils.py +15 -6
  7. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/BusinessOperation.cls +35 -0
  8. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/BusinessProcess.cls +118 -0
  9. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/BusinessService.cls +35 -0
  10. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Common.cls +146 -0
  11. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Director.cls +57 -0
  12. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Duplex/Operation.cls +29 -0
  13. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Duplex/Process.cls +229 -0
  14. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Duplex/Service.cls +9 -0
  15. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/InboundAdapter.cls +22 -0
  16. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Message.cls +128 -0
  17. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/OutboundAdapter.cls +36 -0
  18. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PickleMessage.cls +58 -0
  19. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PrivateSession/Duplex.cls +260 -0
  20. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PrivateSession/Message/Ack.cls +32 -0
  21. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PrivateSession/Message/Poll.cls +32 -0
  22. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PrivateSession/Message/Start.cls +32 -0
  23. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/PrivateSession/Message/Stop.cls +48 -0
  24. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Test.cls +62 -0
  25. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/Utils.cls +363 -0
  26. iris_pex_embedded_python-2.3.5/src/grongier/pex/data/PEX/WSGI.cls +99 -0
  27. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/PKG-INFO +1 -1
  28. iris_pex_embedded_python-2.3.5/src/iris_pex_embedded_python.egg-info/SOURCES.txt +46 -0
  29. iris_pex_embedded_python-2.3.3/src/grongier/iris/__init__.py +0 -0
  30. iris_pex_embedded_python-2.3.3/src/iris_pex_embedded_python.egg-info/SOURCES.txt +0 -27
  31. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/LICENSE +0 -0
  32. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/README.md +0 -0
  33. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/pyproject.toml +0 -0
  34. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/setup.cfg +0 -0
  35. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/__init__.py +0 -0
  36. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/__main__.py +0 -0
  37. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_host.py +0 -0
  38. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_operation.py +0 -0
  39. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_business_service.py +0 -0
  40. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_director.py +0 -0
  41. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_inbound_adapter.py +0 -0
  42. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_message.py +0 -0
  43. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_outbound_adapter.py +0 -0
  44. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_pickle_message.py +0 -0
  45. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_private_session_duplex.py +0 -0
  46. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/grongier/pex/_private_session_process.py +0 -0
  47. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/dependency_links.txt +0 -0
  48. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/entry_points.txt +0 -0
  49. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/requires.txt +0 -0
  50. {iris_pex_embedded_python-2.3.3 → iris_pex_embedded_python-2.3.5}/src/iris_pex_embedded_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris_pex_embedded_python
3
- Version: 2.3.3
3
+ Version: 2.3.5
4
4
  Summary: iris_pex_embedded_python
5
5
  Home-page: https://github.com/grongierisc/interoperability-embedded-python
6
6
  Author: grongier
@@ -26,7 +26,7 @@ def main():
26
26
  description='iris_pex_embedded_python',
27
27
  long_description=long_description,
28
28
  long_description_content_type='text/markdown',
29
- version='2.3.3',
29
+ version='2.3.5',
30
30
  author='grongier',
31
31
  author_email='guillaume.rongier@intersystems.com',
32
32
  keywords='iris_pex_embedded_python',
@@ -46,8 +46,8 @@ def main():
46
46
  'Topic :: Utilities'
47
47
  ],
48
48
  package_dir={'': 'src'},
49
- packages=['grongier.pex','grongier.iris'],
50
- include_package_data=True,
49
+ packages=['grongier.pex','grongier.pex.data'],
50
+ package_data={'grongier.pex.data': ['**/*.cls']},
51
51
  python_requires='>=3.6',
52
52
  install_requires=[
53
53
  "dacite>=1.6.0",
@@ -10,7 +10,9 @@ class _BusinessProcess(_BusinessHost):
10
10
  DISPATCH = []
11
11
 
12
12
  PERSISTENT_PROPERTY_LIST=None
13
- """ A list of the variable names of persistent properties."""
13
+ """ A list of the variable names of persistent properties."""
14
+
15
+ Context=None
14
16
 
15
17
  def on_message(self, request):
16
18
  """ Called when the business operation receives a message from another production component.
@@ -95,6 +97,8 @@ class _BusinessProcess(_BusinessHost):
95
97
 
96
98
  def _save_persistent_properties(self, host_object):
97
99
  """ For internal use only. """
100
+ if self.Context:
101
+ host_object.Context = self.Context
98
102
  if self.PERSISTENT_PROPERTY_LIST == None:
99
103
  return
100
104
  for prop in self.PERSISTENT_PROPERTY_LIST:
@@ -109,6 +113,8 @@ class _BusinessProcess(_BusinessHost):
109
113
 
110
114
  def _restore_persistent_properties(self, host_object):
111
115
  """ For internal use only. """
116
+ if host_object.Context:
117
+ self.Context = host_object.Context
112
118
  if self.PERSISTENT_PROPERTY_LIST == None:
113
119
  return
114
120
  for prop in self.PERSISTENT_PROPERTY_LIST:
@@ -26,10 +26,11 @@ def parse_args(argv):
26
26
  parser.add_argument('-k', '--kill', help='kill a production', action='store_true')
27
27
  parser.add_argument('-r', '--restart', help='restart a production', action='store_true')
28
28
  parser.add_argument('-x', '--status', help='status a production', action='store_true')
29
- parser.add_argument('-M', '--migrate', help='migrate production and classes with settings file')
29
+ parser.add_argument('-M', '-m', '--migrate', help='migrate production and classes with settings file')
30
30
  parser.add_argument('-e', '--export', help='export a production', nargs='?', const='not_set')
31
31
  parser.add_argument('-v', '--version', help='display version', action='store_true')
32
32
  parser.add_argument('-L', '--log', help='display log', action='store_true')
33
+ parser.add_argument('-i', '--init', help='init the pex module in iris', nargs='?', const='not_set')
33
34
  return parser.parse_args(argv)
34
35
 
35
36
  def main(argv=None):
@@ -55,6 +56,12 @@ def main(argv=None):
55
56
  args.start = _Director.get_default_production()
56
57
  _Director.start_production_with_log(args.start)
57
58
 
59
+ elif args.init:
60
+ if args.init == 'not_set':
61
+ # set arg to None
62
+ args.init = None
63
+ _Utils.setup(args.start)
64
+
58
65
  elif args.kill:
59
66
  # kill a production
60
67
  _Director.shutdown_production()
@@ -112,6 +119,7 @@ def main(argv=None):
112
119
  print(" -x, --status status a production")
113
120
  print(" -v, --version display version")
114
121
  print(" -L, --log display log")
122
+ print(" -i, --init init the pex module in iris")
115
123
  print("")
116
124
  print("default production: " + _Director.get_default_production())
117
125
 
@@ -2,8 +2,9 @@ import traceback
2
2
  import dataclasses
3
3
  import inspect
4
4
  import iris
5
+ import abc
5
6
 
6
- class _Common():
7
+ class _Common(metaclass=abc.ABCMeta):
7
8
  """ This is a common superclass for all component types that defines common methods."""
8
9
 
9
10
  INFO_URL: str
@@ -130,8 +131,8 @@ class _Common():
130
131
 
131
132
  if ""!=adapter:
132
133
  ret.append(adapter)
133
- except:
134
- pass
134
+ except Exception as e:
135
+ raise e
135
136
  return ret
136
137
 
137
138
  @classmethod
@@ -3,6 +3,7 @@ import ast
3
3
  import iris
4
4
  import inspect
5
5
  import xmltodict
6
+ import pkg_resources
6
7
 
7
8
  class _Utils():
8
9
  @staticmethod
@@ -19,9 +20,8 @@ class _Utils():
19
20
  def setup(path:str = None):
20
21
 
21
22
  if path is None:
22
- # get the parent directory of the current module
23
- # and append 'iris/Grongier/PEX' to it
24
- path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'iris/Grongier/PEX')
23
+ # get the path of the data folder with pkg_resources
24
+ path = pkg_resources.resource_filename(__name__, 'data')
25
25
 
26
26
  _Utils.raise_on_error(iris.cls('%SYSTEM.OBJ').LoadDir(path,'cubk',"*.cls",1))
27
27
 
@@ -190,13 +190,22 @@ class _Utils():
190
190
  raise ValueError("The filename must be absolute")
191
191
  # add the path to the system path
192
192
  sys.path.append(path)
193
- from settings import CLASSES, PRODUCTIONS
193
+ import settings
194
194
  except ImportError:
195
195
  # return an error if the settings file is not found
196
196
  # and explain how to create it
197
197
  raise ImportError("settings.py file not found. Please create it in the same directory as the main.py file. See the documentation for more information.")
198
- _Utils.set_classes_settings(CLASSES)
199
- _Utils.set_productions_settings(PRODUCTIONS)
198
+ try:
199
+ # set the classes settings
200
+ _Utils.set_classes_settings(settings.CLASSES)
201
+ except AttributeError:
202
+ print("No classes to register")
203
+ try:
204
+ # set the productions settings
205
+ _Utils.set_productions_settings(settings.PRODUCTIONS)
206
+ except AttributeError:
207
+ print("No productions to register")
208
+
200
209
 
201
210
 
202
211
  @staticmethod
@@ -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 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
+ }
@@ -0,0 +1,118 @@
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
+ Property Context As Ens.BP.Context;
13
+
14
+ Method dispatchReply(response)
15
+ {
16
+ set tSC = ..Reply(response)
17
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
18
+ quit
19
+ }
20
+
21
+ Method dispatchSetTimer(
22
+ timeout,
23
+ completionKey)
24
+ {
25
+ set tSC = ..SetTimer(timeout,$g(completionKey))
26
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
27
+ quit
28
+ }
29
+
30
+ Method OnRequest(
31
+ request As %Persistent,
32
+ Output response As %Persistent) As %Status
33
+ {
34
+ set tSC = $$$OK
35
+ try {
36
+ set response = ..%class."_dispatch_on_request"($this,request)
37
+ } catch ex {
38
+ set tSC = ex.AsStatus()
39
+ }
40
+ quit tSC
41
+ }
42
+
43
+ /// Handle a 'Response'
44
+ Method OnResponse(
45
+ request As %Persistent,
46
+ Output response As %Persistent,
47
+ callRequest As %Persistent,
48
+ callResponse As %Persistent,
49
+ pCompletionKey As %String) As %Status
50
+ {
51
+ set tSC = $$$OK
52
+ try {
53
+ set response = ..%class."_dispatch_on_response"($this,request,response,callRequest,callResponse,pCompletionKey)
54
+ } catch ex {
55
+ set tSC = ex.AsStatus()
56
+ }
57
+ quit tSC
58
+ }
59
+
60
+ Method OnComplete(
61
+ request As %Library.Persistent,
62
+ ByRef response As %Library.Persistent) As %Status
63
+ {
64
+ set tSC = $$$OK
65
+ try {
66
+ set tSC = ..Connect() quit:$$$ISERR(tSC)
67
+ set response = ..%class."_dispatch_on_complete"($this,request,response)
68
+ } catch ex {
69
+ set tSC = ex.AsStatus()
70
+ }
71
+ quit tSC
72
+ }
73
+
74
+ Method getPersistentProperty(name)
75
+ {
76
+ quit ..persistentProperties.GetAt(name)
77
+ }
78
+
79
+ Method setPersistentProperty(
80
+ name,
81
+ value)
82
+ {
83
+ quit ..persistentProperties.SetAt(value,name)
84
+ }
85
+
86
+ Storage Default
87
+ {
88
+ <Data name="BusinessProcessDefaultData1">
89
+ <Subscript>"BusinessProcess"</Subscript>
90
+ <Value name="1">
91
+ <Value>%classpaths</Value>
92
+ </Value>
93
+ <Value name="2">
94
+ <Value>%classname</Value>
95
+ </Value>
96
+ <Value name="3">
97
+ <Value>%module</Value>
98
+ </Value>
99
+ <Value name="4">
100
+ <Value>%settings</Value>
101
+ </Value>
102
+ <Value name="5">
103
+ <Value>%class</Value>
104
+ </Value>
105
+ <Value name="6">
106
+ <Value>Context</Value>
107
+ </Value>
108
+ </Data>
109
+ <Data name="persistentProperties">
110
+ <Attribute>persistentProperties</Attribute>
111
+ <Structure>subnode</Structure>
112
+ <Subscript>"Grongier.PEX.BusinessProcess.persistentProperties"</Subscript>
113
+ </Data>
114
+ <DefaultData>BusinessProcessDefaultData1</DefaultData>
115
+ <Type>%Storage.Persistent</Type>
116
+ }
117
+
118
+ }
@@ -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 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
+ }
@@ -0,0 +1,146 @@
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
+ }
@@ -0,0 +1,57 @@
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
+ }
@@ -0,0 +1,29 @@
1
+ Class Grongier.PEX.DuplexOperation Extends Grongier.PEX.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
+ }