From a568b5140b80e55b9959ba36addf32a0ff63c43a Mon Sep 17 00:00:00 2001 From: Brett Williams Date: Thu, 6 Mar 2025 14:57:39 -0600 Subject: [PATCH] Remove buggy existing process code --- build_agent.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/build_agent.py b/build_agent.py index b9225da..4ffd7aa 100755 --- a/build_agent.py +++ b/build_agent.py @@ -18,7 +18,7 @@ import platform from zeroconf_server import ZeroconfServer from version import APP_VERSION, APP_NAME -build_agent_version = "0.1.32" +build_agent_version = "0.1.33" app = Flask(__name__) launch_time = datetime.datetime.now() @@ -352,35 +352,8 @@ def delete_cache(): return jsonify(job_cache()), 200 -def is_another_instance_running(): - if os.name == "nt": # Windows - cmd = [ - "powershell", - "-Command", - "Get-WmiObject Win32_Process | Where-Object { $_.CommandLine -match 'python' } | Select-Object ProcessId, CommandLine" - ] - minimum_count = 1 - else: - cmd = ["pgrep", "-fl", " "] - minimum_count = 0 - try: - output = subprocess.check_output(cmd, text=True) - running_versions = [] - for line in output.splitlines(): - if SCRIPT_PATH in line and str(os.getpid()) not in line: - running_versions.append(line) - return len(running_versions) > minimum_count - except subprocess.CalledProcessError: - return False - if __name__ == "__main__": - had_previous_instances = False - while is_another_instance_running(): - had_previous_instances = True - print("Another instance is running. Waiting until it exits.") - time.sleep(1) - print(f"===== {APP_NAME} {APP_VERSION} Build Agent (v{build_agent_version}) =====") ZeroconfServer.configure("_crosspybuilder._tcp.local.", socket.gethostname(), 9001) try: