docs: def cancel(context, jobs, analysis_id):
      """Cancel all jobs in a run."""
      analysis_obj = context.obj['store'].analysis(analysis_id)
      if analysis_obj is None:
          click.echo('analysis not found')
          context.abort()
      elif analysis_obj.status != 'running':
          click.echo(f"analysis not running: {analysis_obj.status}")
          context.abort()
  
      config_path = Path(analysis_obj.config_path)
      with config_path.open() as config_stream:
          config_raw = ruamel.yaml.safe_load(config_stream)
      config_data = parse_config(config_raw)
  
      log_path = Path(f"{config_data['log_path']}")
      if not log_path.exists():
          click.echo(f"missing MIP log file: {log_path}")
          context.abort()
  
      with log_path.open() as log_stream:
          all_jobs = job_ids(log_stream)
  
      if jobs:
          for job_id in all_jobs:
              click.echo(job_id)
      else:
          for job_id in all_jobs:
              LOG.debug(f"cancelling job: {job_id}")
              process = subprocess.Popen(['scancel', job_id])
              process.wait()
  
          analysis_obj.status = 'canceled'
          context.obj['store'].commit()
          click.echo('cancelled analysis successfully!')