code: def run_dependency_graph(jobgraph, logger=None, jgprefix="ANIm_SGE_JG",
                           sgegroupsize=10000, sgeargs=None):
      joblist = build_joblist(jobgraph)
      dep_count = 0
      if logger:
          logger.info("Jobs to run with scheduler")
          for job in joblist:
              logger.info("{0}: {1}".format(job.name, job.command))
              if len(job.dependencies):
                  dep_count += len(job.dependencies)
                  for dep in job.dependencies:
                      logger.info("\t[^ depends on: %s]" % dep.name)
      logger.info("There are %d job dependencies" % dep_count)
      if dep_count == 0:
          logger.info("Compiling jobs into JobGroups")
          joblist = compile_jobgroups_from_joblist(joblist, jgprefix,
                                                   sgegroupsize)
      logger.info("Running jobs with scheduler...")
      logger.info("Jobs passed to scheduler in order:")
      for job in joblist:
          logger.info("\t%s" % job.name)
      build_and_submit_jobs(os.curdir, joblist, sgeargs)
      logger.info("Waiting for SGE-submitted jobs to finish (polling)")
      for job in joblist:
          job.wait()