Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
44cd716
Add method to patch a method to be automatically delayed
Oct 28, 2020
01c8411
Update translation files
oca-transbot Nov 22, 2020
3f78ea3
[FIX] queue_job: USAGE update
atchuthan Nov 30, 2020
f3fd571
Merge PR #290 into 13.0
OCA-git-bot Nov 30, 2020
868306c
[UPD] README.rst
OCA-git-bot Nov 30, 2020
d5c74d2
Fix required sudo in Job
Dec 1, 2020
a0ab36b
Merge PR #291 into 13.0
OCA-git-bot Dec 3, 2020
fce6c5d
queue_job 13.0.3.2.1
OCA-git-bot Dec 3, 2020
d070c26
[FIX] run doctests as part of standard tests
nilshamerlinck Jan 3, 2021
04509c1
Merge PR #296 into 13.0
OCA-git-bot Jan 4, 2021
5180e51
queue_job 13.0.3.2.2
OCA-git-bot Jan 4, 2021
87ecf75
Translated using Weblate (Chinese (Simplified))
liweijie0812 Jan 18, 2021
21382cc
Translated using Weblate (Chinese (Simplified))
liweijie0812 Jan 22, 2021
f9b1cd1
Merge PR #275 into 13.0
OCA-git-bot Jan 26, 2021
c77a14d
test_queue_job 13.0.2.2.0
OCA-git-bot Jan 26, 2021
8fe68a4
queue_job 13.0.3.3.0
OCA-git-bot Jan 26, 2021
31003b3
Change technical fields to read-only
Feb 1, 2021
510dc4f
Remove initial create notification and follower
Feb 1, 2021
6527274
Merge PR #303 into 13.0
OCA-git-bot Feb 2, 2021
56b56f4
queue_job 13.0.3.3.1
OCA-git-bot Feb 2, 2021
bb88d1e
Optimize queue.job creation
Feb 2, 2021
c480e9e
Merge PR #305 into 13.0
OCA-git-bot Feb 4, 2021
0be16ae
[UPD] Update queue_job.pot
oca-travis Feb 4, 2021
15dc56f
queue_job 13.0.3.4.0
OCA-git-bot Feb 4, 2021
dd941cf
Update translation files
oca-transbot Feb 4, 2021
1245cfd
Merge PR #302 into 13.0
OCA-git-bot Feb 4, 2021
5e523a1
test_queue_job 13.0.2.3.0
OCA-git-bot Feb 4, 2021
563db61
queue_job 13.0.3.5.0
OCA-git-bot Feb 4, 2021
cb18946
Add model in search view / group by
Feb 10, 2021
c78904c
Fix missing rollback on retried jobs
wpichler Nov 19, 2020
b42945f
Fix date_done set when state changes back to pending
Feb 10, 2021
62c2431
Merge PR #310 into 13.0
OCA-git-bot Feb 11, 2021
d345e47
[UPD] Update queue_job.pot
oca-travis Feb 11, 2021
6efb1dc
queue_job 13.0.3.6.0
OCA-git-bot Feb 11, 2021
263fbaa
Update translation files
oca-transbot Feb 11, 2021
5a95553
queue_job: add exec time to view some stats
simahawk Feb 8, 2021
4e7d0ef
Merge PR #309 into 13.0
OCA-git-bot Mar 4, 2021
9bf3f24
[UPD] Update queue_job.pot
oca-travis Mar 4, 2021
764f732
Update translation files
oca-transbot Mar 4, 2021
7749fdd
Merge PR #312 into 13.0
OCA-git-bot Mar 15, 2021
f707889
queue_job 13.0.3.7.1
OCA-git-bot Mar 15, 2021
c7efaca
queue_job: close buffer when done
simahawk Mar 29, 2021
7c612ac
queue_job: store exception name and message
simahawk Mar 29, 2021
bbf9a17
queue_job: improve filtering and grouping
simahawk Mar 29, 2021
58e1e2b
queue_job: add hook to customize stored values
simahawk Mar 29, 2021
72325ae
queue_job: migration step to store exception data
simahawk Mar 29, 2021
311b727
Merge PR #328 into 13.0
OCA-git-bot Apr 19, 2021
59969ec
[UPD] Update queue_job.pot
oca-travis Apr 19, 2021
f43c583
[UPD] Update test_queue_job.pot
oca-travis Apr 19, 2021
f63b9b5
test_queue_job 13.0.2.4.0
OCA-git-bot Apr 19, 2021
ae4c01d
queue_job 13.0.3.9.0
OCA-git-bot Apr 19, 2021
d23b00f
Update translation files
oca-transbot Apr 19, 2021
8734651
Update translation files
oca-transbot Apr 19, 2021
e411ab2
Fix display on exec_time on tree view as seconds
guewen May 31, 2021
0a05596
Merge PR #352 into 13.0
OCA-git-bot Jun 1, 2021
851a560
queue_job 13.0.3.10.0
OCA-git-bot Jun 1, 2021
e81299e
APX-825: [IMP] queue_job: Queue job link with parent job and queue jo…
Jan 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion queue_job/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Example of job function:
.. code-block:: XML

<record id="job_function_sale_order_action_done" model="queue.job.function">
<field name="model_id" ref="sale.model_sale_order"</field>
<field name="model_id" ref="sale.model_sale_order" />
<field name="method">action_done</field>
<field name="channel_id" ref="channel_sale" />
<field name="related_action" eval='{"func_name": "custom_related_action"}' />
Expand Down
2 changes: 1 addition & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Job Queue",
"version": "13.0.3.2.0",
"version": "13.0.4.1.0",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue/queue_job",
"license": "LGPL-3",
Expand Down
48 changes: 39 additions & 9 deletions queue_job/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ def retry_postpone(job, message, seconds=None):

# ensure the job to run is in the correct state and lock the record
env.cr.execute(
"SELECT state FROM queue_job WHERE uuid=%s AND state=%s FOR UPDATE",
"SELECT state, parent_id FROM queue_job WHERE uuid=%s AND state=%s FOR UPDATE",
(job_uuid, ENQUEUED),
)
if not env.cr.fetchone():
data = env.cr.fetchone()

if not data:
_logger.warn(
"was requested to run job %s, but it does not exist, "
"or is not in state %s",
Expand All @@ -68,19 +70,28 @@ def retry_postpone(job, message, seconds=None):
job = Job.load(env, job_uuid)
assert job and job.state == ENQUEUED

if data and data[1]:
env.cr.execute(
"SELECT state FROM queue_job WHERE id=%s FOR UPDATE", ((data[1],)),
)
st = env.cr.fetchone()
if st and st[0] != "done":
retry_postpone(job, "Sync Call", seconds=2)
return ""
try:
try:

self._try_perform_job(env, job)
except OperationalError as err:
# Automatically retry the typical transaction serialization
# errors
if err.pgcode not in PG_CONCURRENCY_ERRORS_TO_RETRY:
raise

retry_postpone(
job, tools.ustr(err.pgerror, errors="replace"), seconds=PG_RETRY
)
_logger.debug("%s OperationalError, postponed", job)
raise RetryableJobError(
tools.ustr(err.pgerror, errors="replace"), seconds=PG_RETRY
)

except NothingToDoJob as err:
if str(err):
Expand All @@ -95,25 +106,44 @@ def retry_postpone(job, message, seconds=None):
# delay the job later, requeue
retry_postpone(job, str(err), seconds=err.seconds)
_logger.debug("%s postponed", job)
# Do not trigger the error up because we don't want an exception
# traceback in the logs we should have the traceback when all
# retries are exhausted
env.cr.rollback()

except (FailedJobError, Exception):
except (FailedJobError, Exception) as orig_exception:
buff = StringIO()
traceback.print_exc(file=buff)
_logger.error(buff.getvalue())
traceback_txt = buff.getvalue()
_logger.error(traceback_txt)
job.env.clear()
with odoo.api.Environment.manage():
with odoo.registry(job.env.cr.dbname).cursor() as new_cr:
job.env = job.env(cr=new_cr)
job.set_failed(exc_info=buff.getvalue())
vals = self._get_failure_values(job, traceback_txt, orig_exception)
job.set_failed(**vals)
job.store()
new_cr.commit()
buff.close()
raise

return ""

def _get_failure_values(self, job, traceback_txt, orig_exception):
"""Collect relevant data from exception."""
exception_name = orig_exception.__class__.__name__
if hasattr(orig_exception, "__module__"):
exception_name = orig_exception.__module__ + "." + exception_name
exc_message = getattr(orig_exception, "name", str(orig_exception))
return {
"exc_info": traceback_txt,
"exc_name": exception_name,
"exc_message": exc_message,
}

@http.route("/queue_job/create_test_job", type="http", auth="user")
def create_test_job(
self, priority=None, max_retries=None, channel="root", description="Test job"
self, priority=None, max_retries=None, channel=None, description="Test job"
):
if not http.request.env.user.has_group("base.group_erp_manager"):
raise Forbidden(_("Access Denied"))
Expand Down
55 changes: 43 additions & 12 deletions queue_job/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ msgstr "Aktivitäten"
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__activity_exception_decoration
#, fuzzy
#| msgid "Exception Information"
msgid "Activity Exception Decoration"
msgstr "Exception-Information"

Expand Down Expand Up @@ -195,6 +194,12 @@ msgstr "Zeit der Einreihung"
msgid "Enqueued"
msgstr "Eingereiht"

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_name
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Exception"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_info
msgid "Exception Info"
Expand All @@ -205,11 +210,31 @@ msgstr "Exception-Info"
msgid "Exception Information"
msgstr "Exception-Information"

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_message
msgid "Exception Message"
msgstr ""

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Exception message"
msgstr ""

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
msgid "Exception:"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__eta
msgid "Execute only after"
msgstr "Erst ausführen nach"

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exec_time
msgid "Execution Time (avg)"
msgstr ""

#. module: queue_job
#: model:ir.model.fields.selection,name:queue_job.selection__queue_job__state__failed
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
Expand Down Expand Up @@ -274,7 +299,6 @@ msgstr "Identitätsschlüssel"
#. module: queue_job
#: code:addons/queue_job/models/queue_job.py:0
#, fuzzy, python-format
#| msgid "The selected jobs will be requeued."
msgid "If both parameters are 0, ALL jobs will be requeued!"
msgstr "Die ausgewählten Jobs werden erneut eingereiht."

Expand Down Expand Up @@ -337,7 +361,6 @@ msgstr "Job-Warteschlangenverwalter"
#. module: queue_job
#: model:ir.model.fields.selection,name:queue_job.selection__ir_model_fields__ttype__job_serialized
#, fuzzy
#| msgid "Job failed"
msgid "Job Serialized"
msgstr "Job ist fehlgeschlagen"

Expand All @@ -358,6 +381,8 @@ msgstr "Job unterbrochen und als Erledigt markiert: Es ist nicht zu tun."
#: model:ir.model.fields,field_description:queue_job.field_queue_requeue_job__job_ids
#: model:ir.ui.menu,name:queue_job.menu_queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_graph
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_pivot
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Jobs"
msgstr "Jobs"
Expand Down Expand Up @@ -426,7 +451,6 @@ msgstr "Nachrichten"
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job_function__method
#, fuzzy
#| msgid "Method Name"
msgid "Method"
msgstr "Methodenname"

Expand All @@ -438,6 +462,7 @@ msgstr "Methodenname"
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__model_name
#: model:ir.model.fields,field_description:queue_job.field_queue_job_function__model_id
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Model"
msgstr "Modell"

Expand Down Expand Up @@ -505,11 +530,6 @@ msgstr "Das ist die Anzahl von Nachrichten mit Übermittlungsfehler"
msgid "Number of unread messages"
msgstr "Das ist die Anzahl von ungelesenen Nachrichten"

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__override_channel
msgid "Override Channel"
msgstr "Kanal überschreiben"

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job_channel__parent_id
msgid "Parent Channel"
Expand Down Expand Up @@ -554,7 +574,7 @@ msgstr "Job einreihen"
#. module: queue_job
#: code:addons/queue_job/models/queue_job.py:0
#, python-format
msgid "Queue jobs must created by calling 'with_delay()'."
msgid "Queue jobs must be created by calling 'with_delay()'."
msgstr ""

#. module: queue_job
Expand All @@ -565,7 +585,6 @@ msgstr "Datensatz"
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__records
#, fuzzy
#| msgid "Record"
msgid "Record(s)"
msgstr "Datensatz"

Expand All @@ -577,7 +596,6 @@ msgstr "Zugehörige Aktion anzeigen"
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job_function__edit_related_action
#, fuzzy
#| msgid "Related Record"
msgid "Related Action"
msgstr "Zugehöriger Datensatz"

Expand Down Expand Up @@ -745,6 +763,16 @@ msgstr "Die ausgewählten Jobs werden erneut eingereiht."
msgid "The selected jobs will be set to done."
msgstr "Die ausgewählten Jobs werden als Erledigt markiert."

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
msgid "Time (s)"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,help:queue_job.field_queue_job__exec_time
msgid "Time required to execute this job in seconds. Average when grouped."
msgstr ""

#. module: queue_job
#: model:ir.model.fields,help:queue_job.field_queue_job__activity_exception_decoration
msgid "Type of the exception activity on record."
Expand Down Expand Up @@ -809,6 +837,9 @@ msgstr "Assistent zur erneuten Einreihung einer Job-Auswahl"
msgid "Worker Pid"
msgstr ""

#~ msgid "Override Channel"
#~ msgstr "Kanal überschreiben"

#~ msgid "If checked new messages require your attention."
#~ msgstr ""
#~ "Wenn es gesetzt ist, erfordern neue Nachrichten Ihre Aufmerksamkeit."
Expand Down
46 changes: 40 additions & 6 deletions queue_job/i18n/queue_job.pot
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ msgstr ""
msgid "Enqueued"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_name
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Exception"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_info
msgid "Exception Info"
Expand All @@ -198,11 +204,31 @@ msgstr ""
msgid "Exception Information"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exc_message
msgid "Exception Message"
msgstr ""

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Exception message"
msgstr ""

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
msgid "Exception:"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__eta
msgid "Execute only after"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__exec_time
msgid "Execution Time (avg)"
msgstr ""

#. module: queue_job
#: model:ir.model.fields.selection,name:queue_job.selection__queue_job__state__failed
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
Expand Down Expand Up @@ -347,6 +373,8 @@ msgstr ""
#: model:ir.model.fields,field_description:queue_job.field_queue_requeue_job__job_ids
#: model:ir.ui.menu,name:queue_job.menu_queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_graph
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_pivot
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Jobs"
msgstr ""
Expand Down Expand Up @@ -425,6 +453,7 @@ msgstr ""
#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__model_name
#: model:ir.model.fields,field_description:queue_job.field_queue_job_function__model_id
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_search
msgid "Model"
msgstr ""

Expand Down Expand Up @@ -492,11 +521,6 @@ msgstr ""
msgid "Number of unread messages"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job__override_channel
msgid "Override Channel"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,field_description:queue_job.field_queue_job_channel__parent_id
msgid "Parent Channel"
Expand Down Expand Up @@ -540,7 +564,7 @@ msgstr ""
#. module: queue_job
#: code:addons/queue_job/models/queue_job.py:0
#, python-format
msgid "Queue jobs must created by calling 'with_delay()'."
msgid "Queue jobs must be created by calling 'with_delay()'."
msgstr ""

#. module: queue_job
Expand Down Expand Up @@ -715,6 +739,16 @@ msgstr ""
msgid "The selected jobs will be set to done."
msgstr ""

#. module: queue_job
#: model_terms:ir.ui.view,arch_db:queue_job.view_queue_job_form
msgid "Time (s)"
msgstr ""

#. module: queue_job
#: model:ir.model.fields,help:queue_job.field_queue_job__exec_time
msgid "Time required to execute this job in seconds. Average when grouped."
msgstr ""

#. module: queue_job
#: model:ir.model.fields,help:queue_job.field_queue_job__activity_exception_decoration
msgid "Type of the exception activity on record."
Expand Down
Loading