Skip to content

Worker debugging#11677

Merged
SchrodingersGat merged 4 commits intoinventree:masterfrom
gunstr:worker-debugging
Apr 10, 2026
Merged

Worker debugging#11677
SchrodingersGat merged 4 commits intoinventree:masterfrom
gunstr:worker-debugging

Conversation

@gunstr
Copy link
Copy Markdown
Contributor

@gunstr gunstr commented Apr 6, 2026

Ref #11665

Open questions:

  • Should an option to start debugging with the sync=True setting be added and covered in docs update in this PR or is a manual change in settings.py enough for now?
  • When I built the docs I noted that the API version in schema.md was also updated from 449 to 470. I see in the repo that the version is 449 but in the documentation it's 470. Should I just dropt that?

@gunstr gunstr requested a review from SchrodingersGat as a code owner April 6, 2026 09:37
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 6, 2026

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit a2ad509
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69d50610e2f0270007dc20fe

@SchrodingersGat
Copy link
Copy Markdown
Member

* Should an option to start debugging with the sync=True setting be added and covered in docs update in this PR or is a manual change in settings.py enough for now?

It might be a good addition for developers to have a --sync-worker flag to the invoke dev.server command - which only applies in debug mode. The invoke dev.server command already runs the development server, so it's a good place for it.

* When I built the docs I noted that the API version in schema.md was also updated from 449 to 470. I see in the repo that the version is 449 but in the documentation it's 470. Should I just dropt that?

Do not commit these changes - they are updated as part of our GitHub CI process

@gunstr
Copy link
Copy Markdown
Contributor Author

gunstr commented Apr 6, 2026

It might be a good addition for developers to have a --sync-worker flag to the invoke dev.server command - which only applies in debug mode. The invoke dev.server command already runs the development server, so it's a good place for it.

This was a bit unclear to me... As I see it the only reason to use sync=True is when the server is started from one of the entries in launch.json with debugpy. And what I can see invoke is not used to start a debugging session. Or are there more things happening "under the hood" that I have not understood?

@SchrodingersGat
Copy link
Copy Markdown
Member

I mean, in .vscode/launch.json adding an argument here:

  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "InvenTree Server",
      "type": "debugpy",
      "request": "launch",
      "program": "${workspaceFolder}/src/backend/InvenTree/manage.py",
      "args": [
        "runserver",
        "0.0.0.0:8000", // expose server in network (useful for testing with mobile app)
        //"--sync"// Sychronize worker tasks to foreground thread
        // "--noreload" // disable auto-reload
      ],
      "django": true,
      "justMyCode": true
    },

And then, in settings.py determine if we are running with this argument (and in DEBUG mode) and then set sync=True

@gunstr
Copy link
Copy Markdown
Contributor Author

gunstr commented Apr 7, 2026

Got it - I will try later today.

@gunstr
Copy link
Copy Markdown
Contributor Author

gunstr commented Apr 7, 2026

I have implemented the changes but I cannot commit them. Looking at the output I can find this:

codespell................................................................Failed
- hook id: codespell
- exit code: 65

I cannot figure out what is wrong. Any hints?

@gunstr
Copy link
Copy Markdown
Contributor Author

gunstr commented Apr 7, 2026

Found the spelling error... It was not marked in the editor, but reding the output log more carefullty it was mentioned there

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.44%. Comparing base (e91f306) to head (a2ad509).
⚠️ Report is 29 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11677      +/-   ##
==========================================
- Coverage   91.44%   91.44%   -0.01%     
==========================================
  Files         964      964              
  Lines       49847    49852       +5     
==========================================
+ Hits        45585    45588       +3     
- Misses       4262     4264       +2     
Flag Coverage Δ
backend 89.25% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.71% <ø> (ø)
Backend General 93.41% <ø> (ø)
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat SchrodingersGat added this to the 1.3.0 milestone Apr 8, 2026
@SchrodingersGat
Copy link
Copy Markdown
Member

@gunstr thanks for the addition!

@SchrodingersGat SchrodingersGat merged commit 1631061 into inventree:master Apr 10, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants