Skip to content

Commit 078150d

Browse files
authored
Merge pull request #55 from OpenSPP/migrate-odoo-job-worker
feat: migrate from OCA queue_job to job_worker
2 parents 7f8034b + 2e0cebf commit 078150d

69 files changed

Lines changed: 158 additions & 207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ concurrency:
3030
cancel-in-progress: true
3131

3232
env:
33-
ODOO_ADDONS_PATH: /opt/odoo/odoo/addons,/opt/odoo/odoo/odoo/addons,/mnt/extra-addons/openspp,/mnt/extra-addons/server-ux,/mnt/extra-addons/server-tools,/mnt/extra-addons/queue,/mnt/extra-addons/server-backend,/mnt/extra-addons/rest-framework,/mnt/extra-addons/muk-it
33+
ODOO_ADDONS_PATH: /opt/odoo/odoo/addons,/opt/odoo/odoo/odoo/addons,/mnt/extra-addons/openspp,/mnt/extra-addons/server-ux,/mnt/extra-addons/server-tools,/mnt/extra-addons/queue,/mnt/extra-addons/odoo-job-worker,/mnt/extra-addons/server-backend,/mnt/extra-addons/rest-framework,/mnt/extra-addons/muk-it
3434

3535
jobs:
3636
# ============================================================================

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
env:
20-
ODOO_ADDONS_PATH: /opt/odoo/odoo/addons,/opt/odoo/odoo/odoo/addons,/mnt/extra-addons/openspp,/mnt/extra-addons/server-ux,/mnt/extra-addons/server-tools,/mnt/extra-addons/queue,/mnt/extra-addons/server-backend,/mnt/extra-addons/rest-framework,/mnt/extra-addons/muk-it
20+
ODOO_ADDONS_PATH: /opt/odoo/odoo/addons,/opt/odoo/odoo/odoo/addons,/mnt/extra-addons/openspp,/mnt/extra-addons/server-ux,/mnt/extra-addons/server-tools,/mnt/extra-addons/queue,/mnt/extra-addons/odoo-job-worker,/mnt/extra-addons/server-backend,/mnt/extra-addons/rest-framework,/mnt/extra-addons/muk-it
2121

2222
jobs:
2323
# ============================================================================

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ repos:
179179
- PyYAML
180180
types: [python]
181181
# Exclude: scripts, tests, migrations, and third-party modules
182-
exclude: ^scripts/|/tests/|migrations/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
182+
exclude: ^scripts/|/tests/|migrations/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
183183
pass_filenames: true
184184
- id: openspp-check-xml-ids
185185
name: "OpenSPP: XML ID naming conventions"
@@ -190,7 +190,7 @@ repos:
190190
- PyYAML
191191
types: [xml]
192192
# Exclude: scripts, tests, data, demo, and third-party modules
193-
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
193+
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
194194
pass_filenames: true
195195
# Phase 2: ACL check (warning only, runs on all files)
196196
- id: openspp-check-acl
@@ -223,7 +223,7 @@ repos:
223223
- PyYAML
224224
types: [python]
225225
# Exclude: scripts, tests, migrations, and third-party modules
226-
exclude: ^scripts/|/tests/|migrations/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
226+
exclude: ^scripts/|/tests/|migrations/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
227227
pass_filenames: true
228228
# Phase 3: Logger setup check (warning only)
229229
- id: openspp-check-logger
@@ -235,7 +235,7 @@ repos:
235235
- PyYAML
236236
types: [python]
237237
# Exclude: scripts, tests, manifests, inits, and third-party modules
238-
exclude: ^scripts/|/tests/|__manifest__|__init__|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
238+
exclude: ^scripts/|/tests/|__manifest__|__init__|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
239239
pass_filenames: true
240240
# Phase 3: UI patterns check (warning only)
241241
- id: openspp-check-ui
@@ -249,7 +249,7 @@ repos:
249249
- PyYAML
250250
types: [xml]
251251
# Exclude: scripts, tests, data, demo, and third-party modules
252-
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
252+
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
253253
pass_filenames: true
254254
# Odoo 19 Compatibility Checks
255255
- id: openspp-check-odoo19-python
@@ -261,7 +261,7 @@ repos:
261261
- PyYAML
262262
types: [python]
263263
# Exclude: scripts, tests, migrations, and third-party modules
264-
exclude: ^scripts/|/tests/|migrations/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
264+
exclude: ^scripts/|/tests/|migrations/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
265265
pass_filenames: true
266266
- id: openspp-check-odoo19-xml
267267
name: "OpenSPP: Odoo 19 compatibility (XML)"
@@ -273,7 +273,7 @@ repos:
273273
- lxml
274274
types: [xml]
275275
# Exclude: scripts, tests, data, demo, and third-party modules
276-
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|queue_job|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
276+
exclude: ^scripts/|/tests/|/data/|/demo/|^(fastapi|job_worker|base_user_role|extendable|extendable_fastapi|endpoint_route_handler)/
277277
pass_filenames: true
278278
# API authentication enforcement
279279
- id: openspp-check-api-auth

.semgrep/odoo-security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ rules:
355355
...
356356
message: |
357357
cr.commit() inside a loop can cause partial data states on failure.
358-
Use queue_job for batch operations or handle transactions properly.
358+
Use job_worker for batch operations or handle transactions properly.
359359
severity: WARNING
360360
languages: [python]
361361
metadata:

docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ services:
9191
ODOO_WORKERS: "0"
9292
ODOO_CRON_THREADS: "0"
9393

94-
# Job queue configuration (defaults to "root:2")
95-
# ODOO_QUEUE_JOB_CHANNELS: "root:4"
96-
9794
# Modules to initialize (configurable via env)
9895
# For E2E: ODOO_INIT_MODULES=spp_mis_demo_v2
9996
# For UI dev: ODOO_INIT_MODULES=spp_base (or your module)

docker/.env.production.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ DB_SSLMODE=prefer
6060
# Number of Odoo workers (rule: (CPU cores * 2) + 1; ~1 worker per 6 concurrent users)
6161
ODOO_WORKERS=2
6262

63-
# Queue job concurrent channels
64-
ODOO_QUEUE_JOB_CHANNELS=root:2
65-
6663
# Memory limits (Docker format: 512M, 1G, 2G, etc.)
6764
ODOO_MEMORY_LIMIT=4G
6865
ODOO_MEMORY_RESERVATION=2G

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ RUN --mount=type=cache,target=/tmp/downloads,sharing=locked \
112112
download_module "OCA/server-ux" "server-ux"; \
113113
download_module "OCA/server-tools" "server-tools"; \
114114
download_module "OCA/queue" "queue"; \
115+
download_module "OpenSPP/odoo-job-worker" "odoo-job-worker"; \
115116
download_module "OCA/server-backend" "server-backend"; \
116117
download_module "OCA/rest-framework" "rest-framework"; \
117118
download_module "muk-it/odoo-modules" "muk-it"

docker/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,14 @@ docker compose -f docker/docker-compose.production.yml exec clamav clamscan --ve
190190

191191
### Performance
192192

193-
| Variable | Default | Description |
194-
| ------------------------- | ---------- | ------------------------------------- |
195-
| `ODOO_WORKERS` | 2 | Number of worker processes |
196-
| `ODOO_CRON_THREADS` | 1 | Number of cron threads |
197-
| `ODOO_MEMORY_SOFT` | 2147483648 | Soft memory limit per worker (bytes) |
198-
| `ODOO_MEMORY_HARD` | 2684354560 | Hard memory limit per worker (bytes) |
199-
| `ODOO_TIME_CPU` | 600 | CPU time limit per request (seconds) |
200-
| `ODOO_TIME_REAL` | 1200 | Real time limit per request (seconds) |
201-
| `ODOO_QUEUE_JOB_CHANNELS` | root:2 | Concurrent background jobs |
193+
| Variable | Default | Description |
194+
| ------------------- | ---------- | ------------------------------------- |
195+
| `ODOO_WORKERS` | 2 | Number of worker processes |
196+
| `ODOO_CRON_THREADS` | 1 | Number of cron threads |
197+
| `ODOO_MEMORY_SOFT` | 2147483648 | Soft memory limit per worker (bytes) |
198+
| `ODOO_MEMORY_HARD` | 2684354560 | Hard memory limit per worker (bytes) |
199+
| `ODOO_TIME_CPU` | 600 | CPU time limit per request (seconds) |
200+
| `ODOO_TIME_REAL` | 1200 | Real time limit per request (seconds) |
202201

203202
### Logging
204203

docker/docker-compose.production.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ services:
252252
memory: ${ODOO_MEMORY_RESERVATION:-2G}
253253

254254
# ==========================================================================
255-
# Queue Worker - Background job processing (OCA/queue_job)
255+
# Queue Worker - Background job processing (job_worker)
256256
# ==========================================================================
257257
queue-worker:
258258
image: ${OPENSPP_IMAGE:-ghcr.io/openspp/openspp:latest}
@@ -275,17 +275,10 @@ services:
275275
DB_SSLMODE: ${DB_SSLMODE:-prefer}
276276
ODOO_ADMIN_PASSWD: ${ODOO_ADMIN_PASSWD:?ODOO_ADMIN_PASSWD is required}
277277

278-
# Queue worker mode - no HTTP, just process jobs
279-
ODOO_WORKERS: "0"
280-
ODOO_CRON_THREADS: "0"
281-
282-
# Queue job channels (number of concurrent jobs)
283-
QUEUE_JOB_CHANNELS: ${QUEUE_JOB_CHANNELS:-2}
284-
285278
# Logging
286279
LOG_LEVEL: ${LOG_LEVEL:-info}
287-
# Override command to run queue job worker
288-
command: ["odoo", "gevent", "--limit-time-real=0"]
280+
# Run job_worker standalone runner process
281+
command: ["python", "-m", "odoo.addons.job_worker.cli"]
289282
volumes:
290283
- odoo_data:/var/lib/odoo
291284
- odoo_addons:/mnt/extra-addons

docker/entrypoint.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ export ODOO_TIME_REAL="${ODOO_TIME_REAL:-1200}"
175175
export ODOO_LIMIT_REQUEST="${ODOO_LIMIT_REQUEST:-8192}"
176176
[[ -z "$ODOO_LIMIT_REQUEST" || ! "$ODOO_LIMIT_REQUEST" =~ ^[0-9]+$ ]] && export ODOO_LIMIT_REQUEST="8192"
177177

178-
# Queue Job configuration (OCA/queue)
179-
export ODOO_QUEUE_JOB_CHANNELS="${ODOO_QUEUE_JOB_CHANNELS:-root:2}"
180-
[[ -z "$ODOO_QUEUE_JOB_CHANNELS" || ! "$ODOO_QUEUE_JOB_CHANNELS" =~ ^[a-zA-Z_][a-zA-Z0-9_.]*:[0-9]+(,[a-zA-Z_][a-zA-Z0-9_.]*:[0-9]+)*$ ]] && export ODOO_QUEUE_JOB_CHANNELS="root:2"
181-
182178
# Logging
183179
export LOG_LEVEL="${LOG_LEVEL:-info}"
184180
export LOG_HANDLER="${LOG_HANDLER:-:INFO}"

0 commit comments

Comments
 (0)