def _get_external_workers(worker):
 worker_that_blocked_task = collections.defaultdict(set)
 get_work_response_history = worker._get_work_response_history
 for get_work_response in get_work_response_history:
  if (get_work_response['task_id'] is None):
   for running_task in get_work_response['running_tasks']:
    other_worker_id = running_task['worker']
    other_task_id = running_task['task_id']
    other_task = worker._scheduled_tasks.get(other_task_id)
    if ((other_worker_id == worker._id) or (not other_task)):
     continue
    worker_that_blocked_task[other_worker_id].add(other_task)
 return worker_that_blocked_task

def _get_external_workers ( worker ) : worker_that_blocked_task = collections . defaultdict ( set ) get_work_response_history = worker . _get_work_response_history for get_work_response in get_work_response_history : if ( get_work_response [ 'task_id' ] is None ) : for running_task in get_work_response [ 'running_tasks' ] : other_worker_id = running_task [ 'worker' ] other_task_id = running_task [ 'task_id' ] other_task = worker . _scheduled_tasks . get ( other_task_id ) if ( ( other_worker_id == worker . _id ) or ( not other_task ) ) : continue worker_that_blocked_task [ other_worker_id ] . add ( other_task ) return worker_that_blocked_task
this returns a dict with a set of tasks for all of the other workers .