docs: def calc_abort(request, calc_id):
      """
      Abort the given calculation, it is it running
      """
      job = logs.dbcmd('get_job', calc_id)
      if job is None:
          message = {'error': 'Unknown job %s' % calc_id}
          return HttpResponse(content=json.dumps(message), content_type=JSON)
  
      if job.status not in ('submitted', 'executing'):
          message = {'error': 'Job %s is not running' % job.id}
          return HttpResponse(content=json.dumps(message), content_type=JSON)
  
      if not utils.user_has_permission(request, job.user_name):
          message = {'error': ('User %s has no permission to abort job %s' %
                               (job.user_name, job.id))}
          return HttpResponse(content=json.dumps(message), content_type=JSON,
                              status=403)
  
      if job.pid:  # is a spawned job
          try:
              os.kill(job.pid, signal.SIGTERM)
          except Exception as exc:
              logging.error(exc)
          else:
              logging.warning('Aborting job %d, pid=%d', job.id, job.pid)
              logs.dbcmd('set_status', job.id, 'aborted')
          message = {'success': 'Killing job %d' % job.id}
          return HttpResponse(content=json.dumps(message), content_type=JSON)
  
      message = {'error': 'PID for job %s not found' % job.id}
      return HttpResponse(content=json.dumps(message), content_type=JSON)