Kills a job on the server.
436317
def kill(self, job_id):
        
        check_jobid(job_id)

        queue = self._get_queue()
        if queue is None:
            raise QueueDoesntExist

        ret, output = self._call('%s %s' % (
                                 shell_escape(queue / 'commands/kill'),
                                 job_id),
                                 False)
        if ret == 3:
            raise JobNotFound
        elif ret != 0:
            raise RemoteCommandFailure(command='commands/kill',
                                       ret=ret)
754769
def kill(self):
        
        try:
            os.unlink(self.server_address)
        except OSError:
            if os.path.exists(self.server_address):
                raise
984440
function kill( proc, callback ){
    var arg = isNumber( proc ) ? '/F /PID ' + proc : '/F /IM ' + proc;

    if ( isNumber( proc ) || isString( proc )){
        exec( taskKillPath + arg, function( err ){
            if( callback ) callback( err )
        })
    } else {
        callback( new Error( 'The first kill() argument provided is neither a string nor an integer (not a valid process).' ))
    }
}
688556
function destroy() {
        foreach ($this->_task_list as $task)
            $task->destroy();
        Cron::destroy($this->_name);
    }
1082429
def kill(container, rm=True):
    '''
    
    '''
    container = get_container(container)
    if not container:
        raise Exception('No such container: %s' % container)
    unbind_all(container['ip']) # legacy, only here for backwards compatibility

    sudo('docker kill %s' % container['name'])
    if rm:
        sudo('docker rm %s' % container['name'])
1241622
def stop_server( working_dir, clean=False, kill=False ):
    

    timeout = 1.0
    dead = False

    for i in xrange(0, 5):
        # try to kill the main supervisor
        pid_file = get_pidfile_path(working_dir)
        if not os.path.exists(pid_file):
            dead = True
            break

        pid = read_pid_file(pid_file)
        if pid is not None:
            try:
               os.kill(pid, signal.SIGTERM)
            except OSError, oe:
               if oe.errno == errno.ESRCH:
                  # already dead
                  log.info("Process %s is not running" % pid)
                  try:
                      os.unlink(pid_file)
                  except:
                      pass

                  return

            except Exception, e:
                log.exception(e)
                os.abort()

        else:
            log.info("Corrupt PID file.  Please make sure all instances of this program have stopped and remove {}".format(pid_file))
            os.abort()

        # is it actually dead?
        blockstack_opts = get_blockstack_opts()
        srv = BlockstackRPCClient('localhost', blockstack_opts['rpc_port'], timeout=5, protocol='http')
        try:
            res = blockstack_ping(proxy=srv)
        except socket.error as se:
            # dead?
            if se.errno == errno.ECONNREFUSED:
                # couldn't connect, so infer dead
                try:
                    os.kill(pid, 0)
                    log.info("Server %s is not dead yet..." % pid)

                except OSError, oe:
                    log.info("Server %s is dead to us" % pid)
                    dead = True
                    break
            else:
                continue

        log.info("Server %s is still running; trying again in %s seconds" % (pid, timeout))
        time.sleep(timeout)
        timeout *= 2

    if not dead and kill:
        # be sure to clean up the pidfile
        log.info("Killing server %s" % pid)
        clean = True
        try:
            os.kill(pid, signal.SIGKILL)
        except Exception, e:
            pass

    if clean:
        # blow away the pid file
        try:
            os.unlink(pid_file)
        except:
            pass


    log.debug("Blockstack server stopped")
266671
function destroyServer(server, topology, callback) {
  LOCAL_SERVER_EVENTS.forEach(event => server.removeAllListeners(event));

  server.destroy(() => {
    topology.emit(
      'serverClosed',
      new monitoring.ServerClosedEvent(topology.s.id, server.description.address)
    );

    if (typeof callback === 'function') callback(null, null);
  });
}
1035407
def stop_server(self):
        
        self.stop = True
        while self.task_count:
            time.sleep(END_RESP)
        self.terminate = True
241496
public function kill() : bool
    {
        // kill server process:
        $serverPid = $this->getServerPid();
        if (!empty($serverPid)) {
            $this->killProcessById($serverPid);
        }

        // kill worker processes:
        $workerPids = [];
        foreach ($this->config['pool'] as $poolName => $poolConfig) {
            $pids = $this->getPidsByPath($poolConfig['worker_file']);
            if (empty($pids)) {
                continue;
            }
            $workerPids = array_merge($workerPids, $pids);
        }
        if (empty($workerPids)) {
            return true;
        }
        foreach ($workerPids as $pid) {
            $this->killProcessById($pid);
        }
        return true;
    }
1192778
def terminate(self):
        """"""
        self.close()

        # Clearing the job queue
        try:
            while 1:
                self._workq.get_nowait()
        except queue.Empty:
            pass

        # Send one sentinel for each worker thread: each thread will die
        # eventually, leaving the next sentinel for the next thread
        for _ in self._workers:
            self._workq.put(SENTINEL)
590327
async def handle_client_kill_job(self, client_addr, message: ClientKillJob):
        
        # Check if the job is not in the queue
        if (client_addr, message.job_id) in self._waiting_jobs:
            del self._waiting_jobs[(client_addr, message.job_id)]
            # Do not forget to send a JobDone
            await ZMQUtils.send_with_addr(self._client_socket, client_addr, BackendJobDone(message.job_id, ("killed", "You killed the job"),
                                                                                           0.0, {}, {}, {}, "", None, "", ""))
        # If the job is running, transmit the info to the agent
        elif (client_addr, message.job_id) in self._job_running:
            agent_addr = self._job_running[(client_addr, message.job_id)][0]
            await ZMQUtils.send_with_addr(self._agent_socket, agent_addr, BackendKillJob((client_addr, message.job_id)))
        else:
            self._logger.warning("Client %s attempted to kill unknown job %s", str(client_addr), str(message.job_id))
186588
private void stopServer() {
        // Get current server
        final Server targetServer = this.getServer();

        // Start a new thread in order to escape the destruction of this Handler
        // during the stop process.
        new Thread() {
            @Override
            public void run() {
                try {
                    targetServer.stop();
                } catch (Exception e) {
                    // ignore
                }
            }
        }.start();

    }
919827
def kill(self):
        ""
        if self.pid:
            try:
                os.kill(self.pid, signal.SIGTERM)
                # Raises an OSError for ESRCH when we've killed it.
                while True:
                    os.kill(self.pid, signal.SIGTERM)
                    time.sleep(0.01)
            except OSError:
                pass
            self.pid = None
919830
def terminate(self):
        """"""
        logger.info("deleting entire server %s" % self)
        self.close()
        try:
            shutil.rmtree(self.basedir)
            logger.info("deleted server under %s" % self.basedir)
            # delete everything from self, so that using this object fails results
            # in an error as quickly as possible
            for val in self.__dict__.keys():
                try:
                    delattr(self, val)
                except:
                    pass
        except Exception, e:
            logger.warning("failed to delete SessionServer: %s" % (e))
211791
public synchronized void kill() {
        if (oooProcess != null) {
            log.info("OOServer is killing office instance with port {}", port);
            List<Long> pids = processManager.findPid(host, port);
            processManager.kill(oooProcess, pids);
            oooProcess = null;
        }
    }
1369905
def kill(self, jid):
        ''''''
        greenlet = self.greenlets.get(jid)
        if greenlet is not None:
            logger.warn('Lost ownership of %s' % jid)
            greenlet.kill()
193360
def kill
      self.status = 'killed'

      Sidekiq.redis do |conn|
        conn.multi do
          save
          conn.zrem(self.class.kill_key, self.jid)
        end
      end
    end