Avoid race conditions when launching tasks

- Execute tasks in the proper order
- Remove sleep command
Couldn't you get this information from the clusterState