From ed03259c17543d31c74b0690d31767329d45d951 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sun, 24 May 2020 05:33:41 +0530 Subject: [PATCH] feat: debug workers in vscode devcontainers [skip travis] --- development/.vscode/launch.json | 48 ++++++++++++++++++++++++++++++--- development/README.md | 2 ++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/development/.vscode/launch.json b/development/.vscode/launch.json index 21867b35..2ed12780 100644 --- a/development/.vscode/launch.json +++ b/development/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Bench", + "name": "Bench Web", "type": "python", "request": "launch", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", @@ -17,6 +17,48 @@ "env": { "DEV_SERVER": "1" } - } + }, + { + "name": "Bench Default Worker", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", + "args": [ + "frappe", "worker", "--queue", "default" + ], + "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", + "cwd": "${workspaceFolder}/frappe-bench/sites", + "env": { + "DEV_SERVER": "1" + } + }, + { + "name": "Bench Short Worker", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", + "args": [ + "frappe", "worker", "--queue", "short" + ], + "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", + "cwd": "${workspaceFolder}/frappe-bench/sites", + "env": { + "DEV_SERVER": "1" + } + }, + { + "name": "Bench Long Worker", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", + "args": [ + "frappe", "worker", "--queue", "long" + ], + "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", + "cwd": "${workspaceFolder}/frappe-bench/sites", + "env": { + "DEV_SERVER": "1" + } + }, ] -} \ No newline at end of file +} diff --git a/development/README.md b/development/README.md index dd43bed0..77152d90 100644 --- a/development/README.md +++ b/development/README.md @@ -173,6 +173,8 @@ This command starts all processes with the exception of Redis (which is already You can now login with user `Administrator` and the password you choose when creating the site, if you followed this guide's unattended install that password is going to be `admin`. +To debug workers, skip starting worker with honcho and start it with VSCode debugger. + ## Developing using the interactive console You can launch a simple interactive shell console in the terminal with: