WorkerRun and Task TTL
https://redmine.teklia.com/issues/8785
Requires #1870 (closed)
Two new database fields are added to manage the maximum execution time of a Ponos task:
-
Task.ttl
, the TTL of a single task. Non-negative integer representing seconds. Zero means infinite. -
WorkerRun.ttl
, the TTL that will be passed on to all tasks created from this WorkerRun. Same definition asTask.ttl
.
ListWorkerRuns
and RetrieveWorkerRun
should include WorkerRun.ttl
in the API response.
CreateWorkerRun
, PartialUpdateWorkerRun
and UpdateWorkerRun
allow setting the ttl
. The maximum value for ttl
is set to Corpus.maximum_task_ttl
from the corpus of the process. If Corpus.maximum_task_ttl
is None
, to settings.PONOS_MAXIMUM_TASK_TTL
. The default value when none is sent in CreateWorkerRun
or UpdateWorkerRun
is the maximum value.
RetrieveTask
should include Task.ttl
in the API response. It should not be editable through UpdateTask
or PartialUpdateTask
.
RetrieveProcess
should include Task.ttl
in the tasks
in its response.
When creating a task, the ProcessBuilder
should set the Task.ttl
to the value of WorkerRun.ttl
.
RestartTask
should clone the Task.ttl
of the original task.
CreateProcessTemplate
should copy the TTL of the original WorkerRuns regardless of the limits. ApplyProcessTemplate
should apply the limits according to the corpus of the destination process.
It should be possible to edit the value of both of these fields in the Django admin. The maximums enforced in the WorkerRun APIs are not enforced in the admin, to allow instance admins to override the limits in special cases.