Dynamically assign and update priorities to tasks

Showing results for 
Search instead for 
Did you mean: 
Member II

Dynamically assign and update priorities to tasks

Lets say a process definition is deployed and process instances are being spawned continuously. There are like x (x1, x2, x3...) number of different user tasks i.e., having a different taskDefinitionKey. Lets assume that there are currently 5 types of x1 task, 17 types of x2 task and so on currently active. The user tasks in the execution flow would have some priority assigned to them initially on basis of exec variables, current workflow metrics and priority weightage already assigned to each kind of task (x1 = 4, x2 = 5, x3 = 4, ...) etc. The priority weightage for x1, x2, ... is maintained as a Consul property so that these could be updated in real time.

Now, suddenly the admin wishes to update the priority weightage like (x1 = 7, x2 = 2, x3 = 1, ...) via an Admin Panel (may be Consul), the priorities must be updated for all the existing tasks. For new upcoming tasks, priorities must be assigned on basis of exec variables and new custom weightage. The question that which all tasks need to be updated can be either all the tasks or a subset of tasks filtered on basis of some criteria.

The new process definitions or new upcoming tasks can behave according to new settings i.e., their priorities can be assigned as per latest exec variables, current workflow metrics and priority weightage.
But, updating existing tasks via Task Update API (there can be one, hundreds, thousands or count may scale upto millions) would be a very heavy activity. I mean iterating over all the tasks of all process instances of all process definitions can be too much cumbersome, verbose and poor programming practise.

I am looking for the best possible solution/infra/worker-process to achieve dynamic assigning/updating of priorities for some or all kinds of tasks.

1 Reply
Senior Member

Re: Dynamically assign and update priorities to tasks