fd1456ac36e0a1ebfb800c9593f1540858ca7bea,src/python/pants/backend/core/tasks/reporting_server.py,KillServer,execute,#KillServer#,114

Before Change


    // There should only be one pidfile, but in case there are many, we kill them all here.
    for pidfile, pid, port in info:
      with open(pidfile, "r") as infile:
        pidstr = infile.read()
      try:
        os.unlink(pidfile)
        pid = int(pidstr)
        os.kill(pid, signal.SIGKILL)
        print("Killed server with {pid} at http://localhost:{port}".format(pid=pid, port=port),
              file=sys.stderr)
      except (ValueError, OSError):

After Change


  def execute(self):
    server = ReportingServerManager(self.context, self.get_options())

    if not server.is_alive():
      logger.info("No server found.")
      return

    pid = server.pid

    try:
      logger.info("Killing server with {pid} at http://localhost:{port}"
                  .format(pid=pid, port=server.socket))
      server.terminate()
    except ReportingServerManager.NonResponsiveProcess:
      logger.info("Failed to kill server with pid {pid}!".format(pid=pid))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: fd1456ac36e0a1ebfb800c9593f1540858ca7bea
Time: 2015-07-17
Author: kwilson@twopensource.com
File Name: src/python/pants/backend/core/tasks/reporting_server.py
Class Name: KillServer
Method Name: execute


Project Name: SeldonIO/seldon-core
Commit Name: 9cdbed54fcb5ccab77166022a0799c163e2942ef
Time: 2020-04-14
Author: gsunner2000@gmail.com
File Name: release.py
Class Name:
Method Name: update_operator_values_yaml_file


Project Name: markovmodel/PyEMMA
Commit Name: 4ed172063fc1ec493c91b327e4761192dbb227dd
Time: 2017-08-31
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/jsonpickler_handlers.py
Class Name: NumpyNPZHandler
Method Name: flatten