如何停止特定用户创建的marklogic中的任务服务器

如何停止特定用户创建的marklogic中的任务服务器,marklogic,Marklogic,以下是我用于停止TaskServer的查询: xquery version "1.0-ml"; declare namespace ss = "http://marklogic.com/xdmp/status/server <http://marklogic.com/xdmp/status/server>; declare namespace hs = "http://marklogic.com/xdmp/status/host"<http://marklogic.com/x

以下是我用于停止TaskServer的查询:

xquery version "1.0-ml";

declare namespace ss = "http://marklogic.com/xdmp/status/server <http://marklogic.com/xdmp/status/server>;
declare namespace hs = "http://marklogic.com/xdmp/status/host"<http://marklogic.com/xdmp/status/host>;

let $taskServerId as xs:unsignedLong := xdmp:host-status(xdmp:host())//hs:task-server-id
for $i as xs:integer in (1 to 5400)
for $requestId as xs:unsignedLong in xdmp:server-status(xdmp:host(), $taskServerId)//ss:request-id/text()
return (
  try {
    xdmp:request-cancel(xdmp:host(), $taskServerId, $requestId)
  } catch ($e) {
    xdmp:log("Failed to cancel requests, retrying...")
  },
  xdmp:sleep(100)
)
xquery版本“1.0-ml”;
声明命名空间ss=”http://marklogic.com/xdmp/status/server ;
声明命名空间hs=”http://marklogic.com/xdmp/status/host";
将$taskServerId设为xs:unsignedLong:=xdmp:host status(xdmp:host())//hs:task服务器id
对于作为xs:integer的$i(1到5400)
对于xdmp:server状态中xs:unsignedLong的$requestId(xdmp:host(),$taskServerId)//ss:requestId/text()
返回(
试一试{
xdmp:请求取消(xdmp:host(),$taskServerId,$requestId)
}捕获量(e美元){
xdmp:log(“取消请求失败,正在重试…”)
},
xdmp:睡眠(100)
)

任何人都可以帮助您仅获取由特定用户名创建的任务服务器吗?

XML输出
xdmp:server status
包含您正在查找的用户信息,因此您可以对其进行筛选:

xquery version "1.0-ml";

declare namespace ss = "http://marklogic.com/xdmp/status/server";

let $user := xdmp:user("gjosten")
let $host := xdmp:host()
let $taskServer := xdmp:server('TaskServer')

for $i in (1 to 5400)
for $request in xdmp:server-status($host, $taskServer)
  //ss:request-status[ss:user = $user]/ss:request-id
return (
  try {
    xdmp:request-cancel($host, $taskServer, $request)
  } catch ($e) {
    xdmp:log("Failed to cancel requests, retrying...")
  },
  xdmp:sleep(100)
)