code: def _run(dryrun=False, cores=1):
      def log_handler(msg):
          level = msg["level"]
          if level == "progress":
              app.extensions["progress"] = msg
          elif level in (
              "info",
              "error",
              "job_info",
              "job_finished",
              "job_error",
          ):
              app.extensions["log"].append(msg)
  
      with LOCK:
          app.extensions["status"]["running"] = True
      run_snakemake(
          log_handler=[log_handler], dryrun=dryrun, cores=cores
      )
      with LOCK:
          app.extensions["status"]["running"] = False
      return ""
  
file_path: snakemake/snakemake/gui.py
imports: import json
  import os
  import threading
  from flask import Flask, render_template, request
  from snakemake.common import __version__
label_desc: Use image node_id 7 for calling a global function with example usage: _run(dryrun, cores) and returns: str