code: def rapidfire(self, max_nlaunch=-1, max_loops=1, sleep_time=5):
          
          num_launched, do_exit, launched = 0, False, []
  
          for count in range(max_loops):
              if do_exit:
                  break
              if count > 0:
                  time.sleep(sleep_time)
  
              tasks = self.fetch_tasks_to_run()
  
              # I don't know why but we receive duplicated tasks.
              if any(task in launched for task in tasks):
                  logger.critical("numtasks %d already in launched list:\n%s" % (len(tasks), launched))
  
              # Preventive test.
              tasks = [t for t in tasks if t not in launched]
  
              if not tasks:
                  continue
  
              for task in tasks:
                  fired = task.start()
                  if fired:
                      launched.append(task)
                      num_launched += 1
  
                  if num_launched >= max_nlaunch > 0:
                      logger.info('num_launched >= max_nlaunch, going back to sleep')
                      do_exit = True
                      break
  
          # Update the database.
          self.flow.pickle_dump()
  
          return num_launched
docs: Keeps submitting `Tasks` until we are out of jobs or no job is ready to run.
  
          Args:
              max_nlaunch: Maximum number of launches. default: no limit.
              max_loops: Maximum number of loops
              sleep_time: seconds to sleep between rapidfire loop iterations
  
          Returns:
              The number of tasks launched.