code: def run(config, max_jobs, output=sys.stdout, job_type='local',
          report_type='text', shell='/bin/bash', temp='.metapipe', run_now=False):
      
      if max_jobs == None:
          max_jobs = cpu_count()
  
      parser = Parser(config)
      try:
          command_templates = parser.consume()
      except ValueError as e:
          raise SyntaxError('Invalid config file. \n%s' % e)
      options = '\n'.join(parser.global_options)
  
      queue_type = QUEUE_TYPES[report_type]
      pipeline = Runtime(command_templates,queue_type,JOB_TYPES,job_type,max_jobs)
  
      template = env.get_template('output_script.tmpl.sh')
      with open(temp, 'wb') as f:
          pickle.dump(pipeline, f, 2)
          script = template.render(shell=shell,
              temp=os.path.abspath(temp), options=options)
  
      if run_now:
          output = output if output != sys.stdout else PIPELINE_ALIAS
          submit_job = make_submit_job(shell, output, job_type)
          submit_job.submit()
  
      try:
          f = open(output, 'w')
          output = f
      except TypeError:
          pass
  
      output.write(script)
      f.close()
docs: Create the metapipe based on the provided input.