Skip to content

Commit 1677862

Browse files
committed
Enhance get_business_service method to support session ID management
1 parent 75cf691 commit 1677862

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/iop/_director.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ class _Director():
1717

1818
_bs = {}
1919

20-
def get_business_service(self,target):
20+
def get_business_service(self,target,force_session_id=False):
21+
""" get the business service
22+
Parameters:
23+
target: the name of the business service
24+
force_session_id: if True, force the session id to be a new one
25+
"""
2126
if target not in self._bs or self._bs[target] is None:
2227
self._bs[target] = _Director.create_python_business_service(target)
28+
if force_session_id:
29+
self._bs[target].iris_handle._SessionId = ""
30+
self._bs[target].iris_handle.ForceSessionId()
2331
return self._bs[target]
2432

2533
@staticmethod

src/iop/cls/IOP/Director.cls

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ Class IOP.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
99

1010
ClassMethod dispatchCreateBusinessService(pTargetDispatchName As %String) As Ens.BusinessService
1111
{
12-
// Hack to prevent job to be registered in the production
1312
set tSC = ##class(Ens.Director).CreateBusinessService(pTargetDispatchName,.service)
14-
if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
13+
14+
// Hack to prevent job to be registered in the production
1515
do ##class(Ens.Job).UnRegister(pTargetDispatchName,$JOB)
16+
17+
if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
18+
1619
quit service
1720
}
1821

0 commit comments

Comments
 (0)