def _execute_tasks(tasks, batch_size=24):
 remaining_tasks = ([] + tasks)
 currently_running_tasks = set([])
 while (remaining_tasks or currently_running_tasks):
  if currently_running_tasks:
   for task in list(currently_running_tasks):
    task.join(1)
    if (not task.isAlive()):
     currently_running_tasks.remove(task)
  while (remaining_tasks and (len(currently_running_tasks) < batch_size)):
   task = remaining_tasks.pop()
   currently_running_tasks.add(task)
   task.start()
   task.start_time = time.time()
  time.sleep(5)
  if remaining_tasks:
   log('----------------------------------------')
   log(('Number of unstarted tasks: %s' % len(remaining_tasks)))
  _check_all_tasks(tasks)
  log('----------------------------------------')

def _execute_tasks ( tasks , batch_size = 24 ) : remaining_tasks = ( [ ] + tasks ) currently_running_tasks = set ( [ ] ) while ( remaining_tasks or currently_running_tasks ) : if currently_running_tasks : for task in list ( currently_running_tasks ) : task . join ( 1 ) if ( not task . isAlive ( ) ) : currently_running_tasks . remove ( task ) while ( remaining_tasks and ( len ( currently_running_tasks ) < batch_size ) ) : task = remaining_tasks . pop ( ) currently_running_tasks . add ( task ) task . start ( ) task . start_time = time . time ( ) time . sleep ( 5 ) if remaining_tasks : log ( '----------------------------------------' ) log ( ( 'Number of unstarted tasks: %s' % len ( remaining_tasks ) ) ) _check_all_tasks ( tasks ) log ( '----------------------------------------' )
starts all tasks and checks the results .