当前位置:网站首页>Chapter 20 using work queue manager (3)
Chapter 20 using work queue manager (3)
2022-07-07 20:05:00 【yaoxin521123】
List of articles
Chapter 20 Use the work queue manager ( 3、 ... and )
Manage categories
A category is an independent worker jobs pool . When initializing a group worker jobs when , You can specify to provide worker Categories . If any in the set worker jobs In execution work Request additional worker jobs, It's new worker jobs From the same category .
for example , Suppose the system provides SQL The category is assigned the most 8
individual worker. then , Hypothesis and BusinessIntelligence
Related processes create a category , And a maximum of four worker Assign to this category . If SQL All in the pool worker Participated in the work at a given time , be BusinessIntelligence
In category worker Work items may still be processed immediately .
The system includes two categories that cannot be deleted :SQL
and Default
. SQL The category applies to any SQL Handle , Including parallel processing of queries . When initializing a group without specifying a category worker jobs when , Default category withdrawal worker jobs.
Each category has attributes that affect the behavior of each work queue in that category . These properties are :
DefaultWorkers
When a work queue in this category is created and is not specified worker job When counting , This will become a work queue worker job The number of . The default value of this attribute is the number of cores .
MaxActiveWorkers
In this category job Activities reserved in the service request pool worker job Maximum number of . Idle detected job And automatically start a new job To maximize activity job Keep the number near this limit . The default value is twice the number of cores .
MaxWorkers
The largest number of work queues in this category worker job Count . If more... Are specified when creating the work queue worker job, Then use this limitation . The default value is twice the number of cores .
To create a category 、 Adjust category properties and delete custom categories , Please navigate to System Administration > Configuration > System Configuration > WQM Categories
.. The name of the custom category is case sensitive , May contain letters 、 Numbers 、 Underline 、 Dashes and periods .
Use callback
Callback is the code that the work queue manager must execute after completing the work item . Callbacks can be used for two reasons :
- Perform work that depends on work items
- If you choose to complete work items asynchronously , It means that all the queued work has been completed
Including callback of work item
To add a callback , Call when you add a work item to the work queue QueueCallback()
Method, not Queue()
Method :
method QueueCallback(work As %String, callback As %String, args... As %String) as %Status
work and args Methods and Queue()
In the same way . however , Callback parameters use the following syntax to specify the callback code to execute :
##class(Classname).ClassMethod
For class methods$$entry^rtn
For subroutines
Class methods or subroutines must accept the same parameters as the main work item in the same order . The main process passes the same parameters to the main work item and callback code .
The callback code can access the following public variables :
%job
, Jobs that contain processes that actually complete the workID
%status
, It contains%Status
value%workqueue
, That is, of the work queue instanceOREF
These public variables are available in callbacks , But not available in work items .
Include callbacks to confirm completion
You can poll the work queue manager to determine completion , Instead of using WaitForComplete()
Method waits for all queued work in the work queue to complete before returning to the main process , As shown below :
- As mentioned in the previous section , Use
QueueCallback()
Method, notQueue()
Method to add a work item to the work queue . - When all work items are completed , In the callback code, the public variable
%exit
Set to1
. - Use
Wait()
Method, notWaitForComplete()
Method :
method Wait(qspec As %String, byRef AtEnd As %Boolean) as %Status
Wait()
Method waits for the signal from the callback to return to the caller . say concretely , It waits for the callback code to put the public variable %exit
Set equal to 1
.Wait()
Returns... By reference AtEnd
. AtEnd
by 1
when , All the work has been done . perhaps , If AtEnd
by 0
, Then one or more work items are not completed .
Control the output of the current device
By default , If the work item generates output to the current device (WRITE
sentence ), The work queue saves the output in a buffer , until WaitForComplete()
or Wait()
end . If you want the work item to generate output earlier , Please let this work item call %SYSTEM.Context.WorkMgr
Class Flush()
Class method , for example :
set sc = $system.Context.WorkMgr().Flush()
When a work item calls this method , Will cause the parent work queue to write all saved outputs of the work item .
Besides , have access to -d
Flag to disable all outputs to the current device . under these circumstances ,Flush()
Methods do nothing , Because there is no output .
Pause and resume work queues
%SYSTEM.WorkMgr
Class provides methods that can be used to pause and resume work in a work queue :
Pause()
method Pause(timeout As %Integer, ByRef completed As %Boolean = 0) as %Status
Block... Associated with this work queue worker jobs Accept other items from this work queue . Pause()
Method also stops any work items in progress .
timeout
The parameter represents the amount of time the method waits before stopping the work item in progress ( In seconds ). After the timeout , This method returns the completion value , This value indicates that Pause()
Whether the work item in progress at the time of method has been completed . therefore , You can pass in the timeout value 0
To know immediately worker jobs Whether all work items in the work queue have been completed .
Resume()
method Resume() as %Status
If used before Pause()
Method pause , Then resume the work in this work queue . say concretely , This method enables the work queue process to accept and start any other items in the work queue .
边栏推荐
- 注解。。。
- R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
- PMP對工作有益嗎?怎麼選擇靠譜平臺讓備考更省心省力!!!
- A pot of stew, a collection of common commands of NPM and yarn cnpm
- 关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
- # 欢迎使用Markdown编辑器
- Time tools
- Equals method
- R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化分组点状条带图(dot strip plot)、设置position参数配置不同分组数据点的分离程度
- JVM class loading mechanism
猜你喜欢
Detailed explanation of Flink parallelism and slot
[RT thread env tool installation]
The project manager's "eight interview questions" is equal to a meeting
小试牛刀之NunJucks模板引擎
微信公众号OAuth2.0授权登录并显示用户信息
关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
vulnhub之school 1
力扣 599. 两个列表的最小索引总和
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
随机推荐
ASP. Net gymnasium integrated member management system source code, free sharing
equals 方法
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
【RT-Thread env 工具安装】
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
AD域组策略管理
ASP.NET体育馆综合会员管理系统源码,免费分享
ASP.NET幼儿园连锁管理系统源码
pom. Brief introduction of XML configuration file label function
A pot of stew, a collection of common commands of NPM and yarn cnpm
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的填充色、add参数在小提琴图添加箱图
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
Boot 和 Cloud 的版本选型
2022如何评估与选择低代码开发平台?
PMP對工作有益嗎?怎麼選擇靠譜平臺讓備考更省心省力!!!
openEuler 资源利用率提升之道 01:概论
关于ssh登录时卡顿30s左右的问题调试处理
Simulate the implementation of string class
Equals method