Fixes #22714: translate the reconcile error and keep helpers out of the public API
Wrap the error recorded on a reconciled job in gettext_lazy, since it surfaces in the job detail UI. Drop reconcile_stale_system_jobs() and resolve_job_timeout() from __all__: they are worker-startup internals, not part of the plugin-facing jobs API exported by a wildcard import. rqworker and the tests import them by name.
This commit is contained in:
parent
42ea0df003
commit
85caca4dd9
|
|
@ -9,6 +9,7 @@ from django.conf import settings
|
|||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import classproperty
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_pglocks import advisory_lock
|
||||
from rq.timeouts import JobTimeoutException
|
||||
|
||||
|
|
@ -22,8 +23,6 @@ from utilities.request import apply_request_processors
|
|||
__all__ = (
|
||||
'AsyncViewJob',
|
||||
'JobRunner',
|
||||
'reconcile_stale_system_jobs',
|
||||
'resolve_job_timeout',
|
||||
'system_job',
|
||||
)
|
||||
|
||||
|
|
@ -112,7 +111,7 @@ def reconcile_stale_system_jobs(job_class, interval):
|
|||
# system job, terminate() sends no notification and triggers no event rule.
|
||||
job.terminate(
|
||||
status=JobStatusChoices.STATUS_ERRORED,
|
||||
error="Worker terminated before job completed",
|
||||
error=_("Worker terminated before job completed"),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ from utilities.testing import disable_warnings
|
|||
from utilities.testing.mixins import RQQueueTestMixin
|
||||
|
||||
from ..jobs import *
|
||||
from ..jobs import _INSTALL_ROOT, STALE_RUNNING_JOB_GRACE_SECONDS
|
||||
from ..jobs import (
|
||||
_INSTALL_ROOT,
|
||||
STALE_RUNNING_JOB_GRACE_SECONDS,
|
||||
reconcile_stale_system_jobs,
|
||||
resolve_job_timeout,
|
||||
)
|
||||
|
||||
|
||||
class TestJobRunner(JobRunner):
|
||||
|
|
|
|||
Loading…
Reference in New Issue