Andy Irvine
02/28/2024, 9:53 AM"finished_job_ttl": {
"title": "Finished Job TTL",
"description": "The number of seconds to retain jobs after completion. If set, finished jobs will be cleaned up by Kubernetes after the given delay. If not set, jobs will be retained indefinitely.",
"type": "integer",
"default": 43200
},
Marvin
02/28/2024, 9:54 AMfinished_job_ttl
when using a base template file in Prefect. However, the configuration of a work pool's base job template, including the finished_job_ttl
parameter, should be reflected when updating the work pool with a base job template file.
To update a work pool's base job template with Prefect, you would use the command:
prefect work-pool update --base-job-template base-job-template.json my-work-pool
Work Pools Documentation
Deployment Kubernetes Documentation
Please note that the configuration you've shown appears to be correct in terms of defining a default JSON schema property. However, if this isn't being respected, it could be an issue with how the base job template is being applied, or how the Prefect environment interprets the template configuration. Ensure that your base-job-template.json
file is correctly formatted and that the keys match what's expected by Prefect 2.x's job template schema.
If this isn't resolving your issue, I recommend searching through the Prefect GitHub Issues to see if others have encountered similar problems or posting a question there for more targeted support.Andy Irvine
02/28/2024, 10:09 AM"default": "43200"
inconsistent with other values such as pod_watch_timeout_seconds: 60
Andy Irvine
02/28/2024, 10:34 AMannot be handled as a Job: json: cannot unmarshal string into Go struct field JobSpec.spec.ttlSecondsAfterFinished of type int32
Andy Irvine
02/28/2024, 1:46 PMNate
02/28/2024, 1:57 PMAndy Irvine
02/28/2024, 1:58 PMAndy Irvine
02/28/2024, 1:59 PM{
"job_configuration": {
"command": "{{ command }}",
"env": "{{ env }}",
"labels": "{{ labels }}",
"name": "{{ name }}",
"namespace": "{{ namespace }}",
"job_manifest": {
"apiVersion": "batch/v1",
"kind": "Job",
"metadata": {
"labels": "{{ labels }}",
"namespace": "{{ namespace }}",
"generateName": "{{ name }}-"
},
"spec": {
"backoffLimit": 0,
"ttlSecondsAfterFinished": 43200,
vs in the variables sectionNate
02/28/2024, 2:03 PMAndy Irvine
02/28/2024, 2:07 PM{
"job_configuration": {
"spec": {
"backoffLimit": 0,
"ttlSecondsAfterFinished": 43200 <= This can be set but no longer using variables
},
"cluster_config": "{{ cluster_config }}",
"job_watch_timeout_seconds": "{{ job_watch_timeout_seconds }}",
"pod_watch_timeout_seconds": "{{ pod_watch_timeout_seconds }}",
"stream_output": "{{ stream_output }}"
},
"variables": {
"description": "Default variables for the Kubernetes worker.\n\nThe schema for this class is used to populate the `variables` section of the default\nbase job template.",
"type": "object",
"properties": {
"finished_job_ttl": {
"title": "Finished Job TTL",
"description": "The number of seconds to retain jobs after completion. If set, finished jobs will be cleaned up by Kubernetes after the given delay. If not set, jobs will be retained indefinitely.",
"type": "integer",
"default": 43200 <= This will be ignored unless quoted. Quoting it then results in an error on job submission
},
Nate
02/28/2024, 2:12 PMAndy Irvine
02/28/2024, 2:12 PM