code: def register(run_snakemake, args):
      app.extensions["run_snakemake"] = run_snakemake
      app.extensions["args"] = dict(
          targets=args.target,
          cluster=args.cluster,
          workdir=args.directory,
          touch=args.touch,
          forcetargets=args.force,
          forceall=args.forceall,
          forcerun=args.forcerun,
          prioritytargets=args.prioritize,
          stats=args.stats,
          keepgoing=args.keep_going,
          jobname=args.jobname,
          immediate_submit=args.immediate_submit,
          ignore_ambiguity=args.allow_ambiguity,
          lock=not args.nolock,
          force_incomplete=args.rerun_incomplete,
          ignore_incomplete=args.ignore_incomplete,
          jobscript=args.jobscript,
          notemp=args.notemp,
          latency_wait=args.latency_wait,
      )
  
      target_rules = []
  
      def log_handler(msg):
          if msg["level"] == "rule_info":
              target_rules.append(msg["name"])
  
      run_snakemake(list_target_rules=True, log_handler=[log_handler])
      for target in args.target:
          target_rules.remove(target)
      app.extensions["targets"] = args.target + target_rules
  
      resources = []
  
      def log_handler(msg):
          if msg["level"] == "info":
              resources.append(msg["msg"])
  
      run_snakemake(list_resources=True, log_handler=[log_handler])
      app.extensions["resources"] = resources
      app.extensions["snakefilepath"] = os.path.abspath(args.snakefile)
  
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 1 for calling a global function with example usage: register(run_snakemake, args) without return types