code: def wait_for_completion(report, interval=10):
      
      for jobid in report.collect('jobid'):
          try:
              if not Job.finished(jobid):
                  logging.info('waiting for SLURM job %s', jobid)
                  time.sleep(interval)
                  while not Job.finished(jobid):
                      time.sleep(interval)
              yield Job.fromid(jobid)._asdict()
          except OSError as e:
              if e.errno == errno.ENOENT:
                  yield dict(id=str(jobid))
              else:
                  raise e
docs: Wait for asynchronous jobs stil running in the given campaign.
  
      :param report: memory representation of a campaign report
      :type campaign: ReportNode
      :param interval: wait interval
      :type interval: int or float
      :return: list of asynchronous job identifiers