Skip to content

[19.0][IMP] queue_job: Implement on fail hook - #955

Open
grindtildeath wants to merge 3 commits into
OCA:19.0from
camptocamp:19.0-imp-queue_job_on_fail_hook
Open

[19.0][IMP] queue_job: Implement on fail hook#955
grindtildeath wants to merge 3 commits into
OCA:19.0from
camptocamp:19.0-imp-queue_job_on_fail_hook

Conversation

@grindtildeath

Copy link
Copy Markdown

Allows to execute a model function when the job fails and will not be retried.

Allows to execute a model function when the job fails and will
not be retried.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @sbidoul, @guewen,
some modules you are maintaining are being modified, check this out!

@simahawk

Copy link
Copy Markdown
Contributor

Just for the record, there were 2 other attempts to manage this

Your approach seem cleaner tho.

@simahawk simahawk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall LGTM

vals = cls._get_failure_values(job, traceback_txt, orig_exception)
job.set_failed(**vals)
job.store()
job.on_fail_hook(vals)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we pass the exception obj too?

if commit_within_job:
self.env.cr.commit() # pylint: disable=invalid-commit

def _test_on_fail_hook(self, **kw):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only for testing,this is not needed

@florentx florentx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI fails on test_queue_job add-on.

@OCA-git-bot OCA-git-bot added the mod:test_queue_job Module test_queue_job label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:queue_job Module queue_job mod:test_queue_job Module test_queue_job series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants