diff --git a/README.md b/README.md index b4c1186bd..2e5f65cf2 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ addon | version | maintainers | summary [queue_job_batch](queue_job_batch/) | 18.0.1.0.0 | | Job Queue Batch [queue_job_cron](queue_job_cron/) | 18.0.1.1.1 | | Scheduled Actions as Queue Jobs [queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 18.0.1.0.1 | ivantodorovich | Run jobs without a dedicated JobRunner -[queue_job_profiler](queue_job_profiler/) | 18.0.1.0.0 | simahawk | Job Queue Profiler +[queue_job_profiler](queue_job_profiler/) | 18.0.1.0.1 | simahawk | Job Queue Profiler [queue_job_subscribe](queue_job_subscribe/) | 18.0.1.0.0 | | Control which users are subscribed to queue job notifications [test_queue_job](test_queue_job/) | 18.0.2.0.5 | sbidoul | Queue Job Tests [test_queue_job_batch](test_queue_job_batch/) | 18.0.1.0.0 | | Test Job Queue Batch diff --git a/queue_job_profiler/README.rst b/queue_job_profiler/README.rst index 695bc98d1..6339df4de 100644 --- a/queue_job_profiler/README.rst +++ b/queue_job_profiler/README.rst @@ -11,7 +11,7 @@ Job Queue Profiler !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:e5e6823382b9de647ff5dda222e6338f224ea4cd51b79b69031930ebe0b35fab + !! source digest: sha256:81110cbf029c5da24b53e16e05ed53c784d8df608158c1506c7464c972af5fbc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/queue_job_profiler/__manifest__.py b/queue_job_profiler/__manifest__.py index 7db4b8345..724dad205 100644 --- a/queue_job_profiler/__manifest__.py +++ b/queue_job_profiler/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Job Queue Profiler", - "version": "18.0.1.0.0", + "version": "18.0.1.0.1", "author": "Camptocamp, Odoo Community Association (OCA)", "maintainers": ["simahawk"], "website": "https://github.com/OCA/queue", diff --git a/queue_job_profiler/controllers/main.py b/queue_job_profiler/controllers/main.py index 7a6a296d5..9717e6d38 100644 --- a/queue_job_profiler/controllers/main.py +++ b/queue_job_profiler/controllers/main.py @@ -7,24 +7,28 @@ class RunJobController(BaseController): - def _try_perform_job(self, env, job): - if self._profiler_is_enabled(env, job): - return self._profiler_perform_job(env, job) + @classmethod + def _try_perform_job(cls, env, job): + if cls._profiler_is_enabled(env, job): + return cls._profiler_perform_job(env, job) return super()._try_perform_job(env, job) - def _profiler_is_enabled(self, env, job): + @classmethod + def _profiler_is_enabled(cls, env, job): func_id = job.job_config.job_function_id if not func_id: return False job_function = env["queue.job.function"].browse(func_id) return job_function.is_profiling_enabled() - def _profiler_perform_job(self, env, job): - with self._profiler_get(env, job): + @classmethod + def _profiler_perform_job(cls, env, job): + with cls._profiler_get(env, job): result = super()._try_perform_job(env, job) return result - def _profiler_get(self, env, job): + @classmethod + def _profiler_get(cls, env, job): func_id = job.job_config.job_function_id if not func_id: return None diff --git a/queue_job_profiler/static/description/index.html b/queue_job_profiler/static/description/index.html index 6637e6a16..958d29acc 100644 --- a/queue_job_profiler/static/description/index.html +++ b/queue_job_profiler/static/description/index.html @@ -372,7 +372,7 @@

Job Queue Profiler

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:e5e6823382b9de647ff5dda222e6338f224ea4cd51b79b69031930ebe0b35fab +!! source digest: sha256:81110cbf029c5da24b53e16e05ed53c784d8df608158c1506c7464c972af5fbc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This addon adds profiling controls to queue job functions and wraps diff --git a/queue_job_profiler/tests/test_job_profiler.py b/queue_job_profiler/tests/test_job_profiler.py index ab0c907cd..d1047795c 100644 --- a/queue_job_profiler/tests/test_job_profiler.py +++ b/queue_job_profiler/tests/test_job_profiler.py @@ -111,12 +111,8 @@ def test_job_action_view_profile(self): self.assertEqual(action["res_id"], prof.id) def _run_controller(self, job, user=None): - controller = RunJobController() env = self.env(user=user) if user else self.env - with ( - patch.object(self.env.cr, "commit"), - ): - controller._try_perform_job(env, job) + RunJobController._try_perform_job(env, job) def test_controller(self): job = self.env.user.with_delay().read(["id"])