code: def run_on_instance(template_name):
      current_instance_name = f"{template_name}-{get_time_stamp()}"
      benchmark_name = sys.argv[1] if len(sys.argv) > 1 else ""
  
      print(f"Creating new instance with name: {current_instance_name}")
  
      gcloud_run(
          "instances",
          "create",
          current_instance_name,
          "--source-instance-template",
          template_name,
      )
      sleep(20)  # Waiting for ssh keys to propagate to instance
      command_over_ssh(current_instance_name, "sudo", "apt", "update")
      print("copying instance setup to instance")
      command_over_ssh(
          current_instance_name,
          "wget",
          "-q",
          "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh",
      )
      print("installing miniconda")
      command_over_ssh(
          current_instance_name,
          "bash",
          "Miniconda3-latest-Linux-x86_64.sh",
          "-b",
      )
      command_over_ssh(
          current_instance_name,
          "echo",
          '"source  miniconda3/bin/activate"',
          ">>",
          "~/.bashrc",
      )
      command_over_ssh(current_instance_name, f"{CONDA_PATH}", "init")
      print("installing asv and google api")
      command_over_ssh(
          current_instance_name,
          f"{CONDA_PATH}",
          "install",
          "-c",
          "conda-forge",
          "asv",
          "google-api-python-client",
          "google-auth-httplib2",
          "google-auth-oauthlib",
          "google-cloud-storage",
          "numpy",
          "-y",
      )
  
      copy_files_to_instance(current_instance_name, "instance_setup.py")
  
      for config_name in os.listdir(MACHINE_CONFIGS_DIR):
          if config_name == template_name + ".json":
              copy_files_to_instance(
                  current_instance_name,
                  os.path.join(MACHINE_CONFIGS_DIR, config_name),
                  directory="~/.asv-machine.json",
              )
              break
      else:
          print(
              f"Found no valid machine config for template: {template_name}."
          )
          exit(1)
      print("starting instance setup")
      command_over_ssh(
          current_instance_name,
          "miniconda3/bin/python3",
          "instance_setup.py",
          current_instance_name,
          template_name,
          block=True,
      )
  
      command_over_ssh(
          current_instance_name,
          "cd",
          "ipyparallel_master_project",
          ";",
          "~/miniconda3/bin/python3",
          "asv_runner.py",
          benchmark_name,
          template_name,
          block=False,
      )
  
file_path: ipyparallel/benchmarks/gcloud_setup.py
imports: import multiprocessing
  import os
  import sys
  from subprocess import Popen, check_call
  from time import sleep
  from typing import List
  import googleapiclient.discovery
  from benchmarks.utils import get_time_stamp
label_desc: Use image node_id 8 for calling a global function with example usage: run_on_instance(template_name) without return types