QueryEngine's pipeline should choose task_id from a pool instead of alwa...

...ys using task_id of 0