Address race condition from concurrent task state update
Address race condition from concurrent task state update

task_state acts like a guard to avoid concurrent tasks to be
scheduled. There might be two race conditions:

 1) two tasks are concurrently accepted by api, check task_state to be
 None and allow the tasks to be executed concurrently.

 2) one ordinary task is running, so that task_state is set. The delete
 task is accepted at API, and will "take over" and change task_state to
 DELETING. However the first task may continue to update task_state or
 set it to None as it finishes.

This patch specifies current expected task_state when updating task_state.
If unexpected state is met, abort the task without updating. Various
compute tests are fixed accordingly to set the pre condition of the
task state.

Part of bug 1037372
Change-Id: I5fdf0946c728a47febb56ad468043a828b2736c8

n0ano/gantt,n0ano/gantt