xdmp:spawn takes a priority option:

xdmp:spawn(
  "/foo.xqy",
  (),
  <options xmlns="xdmp:eval">
    <priority>higher</priority>
  </options>
)

When you spawn a module with higher priority, it is put into a separate task 
server queue. Essentially there are two queues, the normal priority one and the 
higher priority one. CPF typically executes as normal priority.

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
Cell:  +1-484-798-8720


From: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, November 17, 2014 at 3:06 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] Task Server priority

Hi Ashish,

You can place a check in your pipe-line respective x-query code. If your xquery 
module’s query is running in task server then hold your pipe-line xquery to 
execute. Once module’s query done then you can execute your pipe-line’s query.

Example :
if 
(xdmp:server-status(xdmp:host(),xdmp:server("TaskServer"))//*:request-statuses/*:request-status/*:request-text
 = "/modules/highest-priority-query.xqy")
    then "true"
    else "false"

You can place this check in your pipe-line xquery code and call a recursive 
function(with some time-interval) which check this condition, if this function 
get “false” then execute your pipe-line xquery code.


Regards,
Asit Nautiyal

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Ashish Bhardwaj
Sent: Monday, November 17, 2014 2:25 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Task Server priority

Hi,

We have some CPF pipelines configured which may have thousands of tasks queued 
for task-server. Now, we want some process to happen which we do by spawning a 
new Xquery module with highest priority.
How can we make sure that the newly spawned task is picked before the tasks 
spawned by CPF.

Regards,
Ashish
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to