%SYS
WorkQueues Class Reference

This class allows you to modify and view the [WorkQueues] section of the CPF file through programatic APIs. More...

Inheritance diagram for WorkQueues:
Collaboration diagram for WorkQueues:

Static Public Member Functions

_.Library.Boolean IsSystemWorkQueue (_.Library.String Name)
 Returns whether.
 
_.Library.Integer MaxWorkersAvailable ()
 Maximum Number of Queue Manager Workers for the system

 
- Static Public Member Functions inherited from CommonMultipleMethods
_.Library.Status Create (_.Library.String Name, _.Library.String Properties, _.Library.String CPFFile, _.Library.Integer Flags)
 Create a section instance in a CPF file. More...
 
_.Library.Status Delete (_.Library.String Name, _.Library.String CPFFile, _.Library.Integer Flags)
 Delete a section instance from a CPF file. More...
 
_.Library.Boolean Exists (_.Library.String Name, _.Library.ObjectHandle Obj, _.Library.Status Status, _.Library.String CPFFile, _.Library.Integer Flags)
 Database exists. More...
 
_.Library.Status Get (_.Library.String Name, _.Library.String Properties, _.Library.String CPFFile, _.Library.Integer Flags)
 Get a section instances properties from a CPF file. More...
 
_.Library.Status GetList (_.Library.String Name, _.Library.String CPFFile, _.Library.Integer Flags)
 Returns the properties from a section instance in a CPF file by value in $list format
More...
 
_.Library.Status Modify (_.Library.String Name, _.Library.String Properties, _.Library.String CPFFile, _.Library.Integer Flags)
 Modify a section instance in a CPF file. More...
 
_.Library.ObjectHandle Open (_.Library.String Name, _.Library.String CPFFile, _.Library.Integer concurrency, _.Library.Status Status, _.Library.Integer Flags)
 Open a section instance object in a CPF file. More...
 

Public Attributes

 AlwaysQueue
 If true makes this a true queue where you need to wait for the work group request to get to the head of the. More...
 
 DefaultWorkers
 When a work group in this category is created and no worker job count is specified this is the default number of worker jobs. More...
 
 MaxActiveWorkers
 Maximum number of active worker jobs we will keep in the pool of jobs servicing requests in this category. More...
 
 MaxTotalWorkers
 If none-zero specifies the maximum number of workers we will start in this category. More...
 
 MaxWorkers
 When a work group in this category is created specifying the number of worker jobs wanted and the number requested is. More...
 
- Public Attributes inherited from CommonProperties
 CPFFile
 CPF file which the object maps to. More...
 
 Comments
 Embedded comments in the CPF file. More...
 
 Flags
 Flags governing how the object is processed when Save() is called. More...
 
 Name
 Name of the object instance. More...
 

Static Public Attributes

 CAPITALNAME = None
 WorkQueue name is not capitalized. More...
 
- Static Public Attributes inherited from CommonMultipleMethods
 CAPITALNAME = None
 Determines if the Name specified in the index should be capitalized. More...
 
 SECTIONTYPE = None
 This parameter governs how the class creates audit records. More...
 
- Static Public Attributes inherited from CommonProperties
 DOMAIN = None
 This class contains properties which are included by classes which manipulate sections in the CPF file. More...
 

Detailed Description

This class allows you to modify and view the [WorkQueues] section of the CPF file through programatic APIs.

While properties are usually modified through the System Management portal, there may be some occasion where modifying them through the API's is best for your system. In all the Config methods, if you do not specify the CPFFile parameter, the currently active CPF file is used. If you wish to modify a CPF file which is not the currently active one, then specify the CPFFile you wish to modify in the method call.
The Flags parameter does not normally need to be specified; the defaults are usually sufficient for most cases.
You can use either the provided API's (Create/Get/Modify/Delete) to modify the properties by passing in the correct parameters, or use Object syntax to open and directly manipulate the config objects (Open() and Exists()). Most objects created here need only to specify the Name of the object, and 1 or 2 properties since the the defaults are what are commonly used for most cases.

EXAMPLE:

    ; Use class methods to create an instance
    SYS>s Name="TEST"
    SYS>s Properties("MaxActiveWorkers")=8
    SYS>s Status=##Class(Config.WorkQueues).Create(Name,.Properties)
    SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)
    ; Use class methods to modify properties
    SYS>s Status=##Class(Config.WorkQueues).Get(Name,.Properties)
    SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)
    SYS>zw Properties
    Properties("DefaultWorkers")=0
    Properties("MaxWorkers")=0
    Properties("MaxActiveWorkers")=8
    SYS>s Properties("MaxActiveWorkers")=4
    SYS>s Status=##Class(Config.WorkQueues).Modify(Name,.Properties)
    SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)
    ; Now use Objects to modify properties
    SYS>s Obj=##Class(Config.WorkQueues).Open(Name)
    ; We could have used i ##Class(Config.WorkQueues).Exists(Name,.Obj) instead of Open()
    SYS>w Obj.MaxActiveWorkers
    4
    SYS>s Obj.MaxWorkers=2
    SYS>s Status=Obj.Save()
    SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)
    ; Now delete the object we just created
    SYS>s Status=##Class(Config.WorkQueues).Delete(Name)
    SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)
    

Member Data Documentation

◆ CAPITALNAME

CAPITALNAME = None
static

WorkQueue name is not capitalized.


◆ AlwaysQueue

AlwaysQueue

If true makes this a true queue where you need to wait for the work group request to get to the head of the.

queue in order to get a worker assigned. When AlwaysQueue=0 for a category when a new WQM group is created we allocated at least one worker immediately to make progress on the work even if the rest of the work unit are in a queue waiting for additional workers to free up.  

◆ DefaultWorkers

DefaultWorkers

When a work group in this category is created and no worker job count is specified this is the default number of worker jobs.

we will assign to the group. 0 = Dynamic.  

◆ MaxActiveWorkers

MaxActiveWorkers

Maximum number of active worker jobs we will keep in the pool of jobs servicing requests in this category.

Idle jobs are detected and new jobs are started automatically to keep the maximum active job number around this limit. 0 = Dynamic, -1 = unlimited.  

◆ MaxTotalWorkers

MaxTotalWorkers

If none-zero specifies the maximum number of workers we will start in this category.

Even if all existing workers are blocked we will not start more workers once we reach this limit. This is useful for IO intensive workloads where we expect workers to be blocked and are not trying to control the amount of CPU a worker uses.  

◆ MaxWorkers

MaxWorkers

When a work group in this category is created specifying the number of worker jobs wanted and the number requested is.

greater than this limit then we will use this limit value instead. 0 = Dynamic