Expand my Community achievements bar.

Help with completeTask from DSC method

Avatar

Former Community Member

Hello,

I'm having some trouble with a custom DSC method calling TaskManager.completeTask().  Our application consists of a parent main process with several subprocess children.  At one step within the parent process, we are calling a custom DSC method that sends each child down a certain path by claiming the task to a dummy userid and invoking the completeTask method that specifies the path.  This is a simple example:

(loop)

myTaskManager.reAssignTask(taskId, dummyUser);

myTaskManager.completeTask(taskId, "UpdateData");

(end loop)

This works fine, and all the subprocesses are sent down the "UpdateData" process route.  The problem we are having is that there may be hundreds of subprocesses running at a given moment and sending them all down the "UpdateData" path at (nearly) the same time is overwhelming the server.  I've attemped to build a delay into the loop, but this is where I'm experiencing some 'queueing' from the completeTask call

(loop)

pause 5 seconds

myTaskManager.reAssignTask(taskId, dummyUser);

myTaskManager.completeTask(taskId, "UpdateData");

(end loop)

When I attempt this, the first 14 calls to completeTask() will result in the subprocesses being sent down the path (almost) immediately, within a few seconds.  After that as we continue looping the processes are no longer being routed immediately, but they seem to get queued up somewhere (I event built in a 15 minute delay at the end to see if they would eventually go through, but they never did.  I have also tried nulling out the TaskManager and the other objects, but this was no help).  After the DSC method has completed and exited, all of the processes get flushed at once and go through

(which usually results in OOM errors simply because of the heavy processing load).

Does anyone have any insight into the internal workings of the TaskManager, and how it manages it's queues and/or messaging.

Thanks,

Brian

1 Reply

Avatar

Level 10

Why don't you consider writing events?

The event are asynchronous and are triggered based on its priority.

For your case, you could create a simple event and least prioritizing it will cause the delayed invoke.

I hope the event mechanism uses the JMS concept (asynchronous queuing) behind the screen.

Make sense?

Nith