MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / stop_process

Method stop_process

web/pgadmin/misc/bgprocess/processes.py:877–898  ·  view source on GitHub ↗

(_pid)

Source from the content-addressed store, hash-verified

875
876 @staticmethod
877 def stop_process(_pid):
878 """
879 """
880 p = Process.for_user(pid=_pid).first()
881
882 if p is None:
883 raise LookupError(PROCESS_NOT_FOUND)
884
885 try:
886 process = psutil.Process(p.utility_pid)
887 process.terminate()
888 # Update the process state to "Terminated"
889 p.process_state = PROCESS_TERMINATED
890 except psutil.NoSuchProcess:
891 p.process_state = PROCESS_TERMINATED
892 except psutil.Error as e:
893 current_app.logger.warning(
894 _("Unable to kill the background process '{0}'.").format(
895 p.utility_pid)
896 )
897 current_app.logger.exception(e)
898 db.session.commit()
899
900 @staticmethod
901 def update_server_id(_pid, _sid):

Callers 1

stop_processFunction · 0.80

Calls 3

for_userMethod · 0.80
warningMethod · 0.80
firstMethod · 0.65

Tested by

no test coverage detected