code: def _run_data_v1(run, index):
      formatted = run_util.format_run(run)
      data = {
          "id": run.id,
          "shortId": run.short_id,
          "dir": run.dir,
          "operation": formatted["operation"],
          "started": formatted["started"],
          "stopped": formatted["stopped"],
          "time": _run_duration(run),
          "label": formatted["label"],
          "tags": _format_tags(run.get("tags") or []),
          "comments": run.get("comments") or [],
          "status": run.status,
          "exitStatus": formatted["exit_status"],
          "command": formatted["command"],
          "otherAttrs": _other_attrs(run),
          "flags": run.get("flags", {}),
          "env": run.get("env", {}),
          "deps": _format_deps(run.get("deps", {})),
          "files": _format_files(run.iter_files(), run.path),
          "sourcecode": _sourcecode_data(run),
          "projectDir": run_util.run_op_dir(run),
          "opRef": _opref_data(run),
          "marked": run.get("marked") or False,
      }
      if index:
          data["scalars"] = _run_scalars(run, index)
      return data
  
imports: import json
  import logging
  import os
  import re
  import socket
  import sys
  import guild
  import guild.run
  from guild import batch_util
  from guild import cli
  from guild import click_util
  from guild import config
  from guild import index
  from guild import run_util
  from guild import util
  from guild import var
  from guild import view
  from .None import compare_impl
  from .None import runs_impl
label_desc: Use image node_id 2 for calling a global function with example usage: _run_data_v1(run, index) and returns: data