Python thread pool and execution graph