11import asyncio
22import datetime
33import functools
4- import iris
4+ from . import _iris
55import intersystems_iris .dbapi ._DBAPI as irisdbapi
66import signal
77from dataclasses import dataclass
@@ -55,7 +55,7 @@ def create_business_service(target):
5555 Returns:
5656 an object that contains an instance of IRISBusinessService
5757 """
58- iris_object = iris .cls ("IOP.Director" ).dispatchCreateBusinessService (target )
58+ iris_object = _iris . get_iris () .cls ("IOP.Director" ).dispatchCreateBusinessService (target )
5959 return iris_object
6060
6161 @staticmethod
@@ -69,7 +69,7 @@ def create_python_business_service(target):
6969 Returns:
7070 an object that contains an instance of IRISBusinessService
7171 """
72- iris_object = iris .cls ("IOP.Director" ).dispatchCreateBusinessService (target )
72+ iris_object = _iris . get_iris () .cls ("IOP.Director" ).dispatchCreateBusinessService (target )
7373 return iris_object .GetClass ()
7474
7575 ### List of function to manage the production
@@ -102,37 +102,37 @@ async def _start_production_async(production_name=None, handler=None):
102102 def start_production (production_name = None ):
103103 if production_name is None or production_name == '' :
104104 production_name = _Director .get_default_production ()
105- iris .cls ('Ens.Director' ).StartProduction (production_name )
105+ _iris . get_iris () .cls ('Ens.Director' ).StartProduction (production_name )
106106
107107 ### stop production
108108 @staticmethod
109109 def stop_production ():
110- iris .cls ('Ens.Director' ).StopProduction ()
110+ _iris . get_iris () .cls ('Ens.Director' ).StopProduction ()
111111
112112 ### restart production
113113 @staticmethod
114114 def restart_production ():
115- iris .cls ('Ens.Director' ).RestartProduction ()
115+ _iris . get_iris () .cls ('Ens.Director' ).RestartProduction ()
116116
117117 ### shutdown production
118118 @staticmethod
119119 def shutdown_production ():
120- iris .cls ('Ens.Director' ).StopProduction (10 ,1 )
120+ _iris . get_iris () .cls ('Ens.Director' ).StopProduction (10 ,1 )
121121
122122 ### update production
123123 @staticmethod
124124 def update_production ():
125- iris .cls ('Ens.Director' ).UpdateProduction ()
125+ _iris . get_iris () .cls ('Ens.Director' ).UpdateProduction ()
126126
127127 ### list production
128128 @staticmethod
129129 def list_productions ():
130- return iris .cls ('IOP.Director' ).dispatchListProductions ()
130+ return _iris . get_iris () .cls ('IOP.Director' ).dispatchListProductions ()
131131
132132 ### status production
133133 @staticmethod
134134 def status_production ():
135- dikt = iris .cls ('IOP.Director' ).StatusProduction ()
135+ dikt = _iris . get_iris () .cls ('IOP.Director' ).StatusProduction ()
136136 if dikt ['Production' ] is None or dikt ['Production' ] == '' :
137137 dikt ['Production' ] = _Director .get_default_production ()
138138 return dikt
@@ -141,13 +141,13 @@ def status_production():
141141 @staticmethod
142142 def set_default_production (production_name = '' ):
143143 #set ^Ens.Configuration("SuperUser","LastProduction")
144- glb = iris .gref ("^Ens.Configuration" )
144+ glb = _iris . get_iris () .gref ("^Ens.Configuration" )
145145 glb ['csp' , "LastProduction" ] = production_name
146146
147147 ### get default production
148148 @staticmethod
149149 def get_default_production ():
150- glb = iris .gref ("^Ens.Configuration" )
150+ glb = _iris . get_iris () .gref ("^Ens.Configuration" )
151151 default_production_name = glb ['csp' , "LastProduction" ]
152152 if default_production_name is None or default_production_name == '' :
153153 default_production_name = 'Not defined'
@@ -257,28 +257,28 @@ def test_component(target,message=None,classname=None,body=None):
257257 body: the body of the message
258258 """
259259 if not message :
260- message = iris .cls ('Ens.Request' )._New ()
260+ message = _iris . get_iris () .cls ('Ens.Request' )._New ()
261261 if classname :
262262 # if classname start with 'iris.' then create an iris object
263263 if classname .startswith ('iris.' ):
264264 # strip the iris. prefix
265265 classname = classname [5 :]
266266 if body :
267- message = iris .cls (classname )._New (body )
267+ message = _iris . get_iris () .cls (classname )._New (body )
268268 else :
269- message = iris .cls (classname )._New ()
269+ message = _iris . get_iris () .cls (classname )._New ()
270270 # else create a python object
271271 else :
272272 # python message are casted to Grongier.PEX.Message
273- message = iris .cls ("IOP.Message" )._New ()
273+ message = _iris . get_iris () .cls ("IOP.Message" )._New ()
274274 message .classname = classname
275275 if body :
276276 message .json = body
277277 else :
278278 message .json = _Utils .string_to_stream ("{}" )
279279 # serialize the message
280280 serial_message = dispatch_serializer (message )
281- response = iris .cls ('IOP.Utils' ).dispatchTestComponent (target ,serial_message )
281+ response = _iris . get_iris () .cls ('IOP.Utils' ).dispatchTestComponent (target ,serial_message )
282282 try :
283283 deserialized_response = dispatch_deserializer (response )
284284 except ImportError as e :
0 commit comments