wq no deadlock

An idea to avoid deadlocks. Only the last two commits are relevant. The main idea is only to retrieve files from workers when the master would not be blocked.  In this way, we do not need to play too much with the timeouts. 

@dthain, @dpandiar