From bd98023478f251e98f13b093d2ca4e6acb98705b Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Tue, 1 Feb 2022 15:46:08 -0800 Subject: [PATCH] pull Athene from 15 --- .theia/launch.json | 28 ++++++++++++++++++++++++++++ .theia/settings.json | 17 +++++++++++++++++ odoo-reload.py | 16 +++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .theia/settings.json diff --git a/.theia/launch.json b/.theia/launch.json index f048d49b..b76ea3b2 100644 --- a/.theia/launch.json +++ b/.theia/launch.json @@ -28,6 +28,26 @@ "--test-enable", "--no-xmlrpc", "--stop-after-init"], "console": "integratedTerminal" }, + { + "name": "Odoo: INIT 'hr_commission'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_commission", + "-u", "hr_commission", + "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: TEST 'hr_commission'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_commission", + "-u", "hr_commission", + "--test-enable", "--no-xmlrpc", "--stop-after-init"], + "console": "integratedTerminal" + }, { "name": "Odoo: INIT 'hr_payroll_hibou'", "type": "python", @@ -63,6 +83,14 @@ "program": "/opt/odoo/hibou-suite/odoo-reload.py", "args": [], "console": "integratedTerminal" + }, + { + "name": "Odoo: reload foreground server, Kill Others", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-reload.py", + "args": ["KILL_OTHER"], + "console": "integratedTerminal" } ] } diff --git a/.theia/settings.json b/.theia/settings.json new file mode 100644 index 00000000..720fd1c4 --- /dev/null +++ b/.theia/settings.json @@ -0,0 +1,17 @@ +{ + "workbench.colorTheme": "Hibou Dark", + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/*.pyc": {"when": "$(basename).py"}, + "**/__pycache__": true + }, + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/**": true + } +} diff --git a/odoo-reload.py b/odoo-reload.py index c84471ab..a633c8e8 100755 --- a/odoo-reload.py +++ b/odoo-reload.py @@ -1,17 +1,31 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + import psutil import os import signal +import sys PID = 1 PNAME = 'odoo' +PNAME_PYTHON = ['python'] +PNAME_KILL_OTHER = [PNAME] + PNAME_PYTHON +KILL_OTHER = sys.argv[1] == 'KILL_OTHER' if len(sys.argv) >= 2 else False +if KILL_OTHER: + print('Will find other Odoo Processes and Kill them.') + is_foreground = False for proc in psutil.process_iter(): try: process_name = proc.name() process_id = proc.pid + print('Inspecting %s:%s' % (process_id, process_name)) if process_id == PID: is_foreground = process_name == PNAME - break + if not KILL_OTHER: + break + if process_id != PID and KILL_OTHER and process_name in PNAME_KILL_OTHER: + print('Killing %s:%s' % (process_id, process_name)) + os.kill(process_id, signal.SIGKILL) except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): pass