Question
· Apr 25

Disable all operations in a production

Hi Team, 

Is there any way to disable all operation ( or services) in a production entirely? 

For example when restoring from one HealthShare environment to another we may need to get the configs (IP, port, ssl etc ) updated before staring the operation. We set the production autostart to disabled but still need to disable the operation one by one if we want to start production without operations enabled.  

Thank you for your help. 

Product version: IRIS 2021.1
Discussion (6)3
Log in or sign up to continue

One way I can think of is to get the name of each config item that is enabled via an SQL query such as:
SELECT Name, ClassName FROM Ens_Config.Item WHERE Production = '<production name>' and Enabled = 1

Then for each of these call ##class(Ens.Director).EnableConfigItem("<production name>||<config item name>|<config item class name>", 0)

I am not sure of any method to do it all at once.

Hi Mary.

If you did want to create your own method to do this, you could do something like this:

Class Demo.StopThings
{

/// Stops all services in the specified production
ClassMethod StopAllServices(ProductionName As %String) As %Status
{
    Set sc = $$$OK, currService=""
    Set rs = ##class(Ens.Config.Production).EnumerateConfigItemsFunc(ProductionName, 1)
    While rs.%Next() {
        Set currService = rs.Get("ConfigName")
        Write "Stopping the following service: "_currService_"..."
        Set tSC = ##class(Ens.Director).EnableConfigItem(currService, 0)
        If tSC = $$$OK{Write "Complete!",!}
        Else{Write "Failed",!}
        }
    Return sc
}

}

And then you could call it from terminal from relevant namespace by running:

Set Status = ##class(Demo.StopThings).StopAllServices("Insert.ProductionName.Here")

To use the same code for Operations, change the 1 to a 3 in the call to "EnumerateConfigItemsFunc" (and swap out the bits that say service for operation).

The above is some quick and dirty code to demonstrate the approach you could go for, but you may want to add in some error handling etc to make things more robust given your usecase.

For Components of the same type, within the management portal production, you can left click to select the top/first component (operation) and then scroll to the bottom, hold the "shift" key while left-clicking to select the last/bottom component (operation). This should highlight all of the operations between the two also AND it will open the actions tab on the right allowing you to disable, enable or restart all of the components selected.