Question
· Jan 29, 2018

Disable Service/Process/Operation from a function?

Hi,

I am working on a custom service that reads from a file and import content into a global. The problem is that global is also used by other processes. I have been trying to find any way to stop/disable a process from cache code so after reading the file, process is stopped, global updated and then process is restored. But I could not find anything, just to start/stop the whole production 

Do ##class(Ens.Director).StopProduction()

Any ideas if this is something that can be done in ensemble?

Thanks

Discussion (6)0
Log in or sign up to continue

Thank you both for your quick replies.

That was exactly what I was looking for....

I think I will be using both...one to stop the other processes accessing the global + locks to really ensure no other processes access the global.

 

My code will be something like the following:

// Stop other ensemble jobs accessing to the global to avoid bad messages. 
// Jobs are such as services/processes/operations by name. 
DO ##class(Ens.Director).EnableConfigItem("xxx",0,0)
$$$LOGINFO("xxx Disabled")

// Add a lock to control access to the global.
// 0 => 1 attemp only.
LOCK +^lockname:0
// If lock is unsuccesfull, $TEST variable = 0
If '$TEST {
$$$LOGERROR("Lock cannot be obtained. Process cannot continue.")
Quit tSC 
}
$$$LOGINFO("LOCK on")



*** code here to update global ***



// Start other ensemble jobs accessing to the global to avoid bad messages. 
// Jobs are such as services/processes/operations by name. 
DO ##class(Ens.Director).EnableConfigItem("xxx",1,0)
$$$LOGINFO("xxx Enabled")

// REmove lock to control access to the global.
LOCK -^lockname
$$$LOGINFO("LOCK off")